This improves the extensibility of the record finder form widget by passing the current model to the query scope that will be applied to the records being displayed. It allows the use of attributes of the current model in the query scope applied to the records being displayed as options to select.
In my use case, I have a main Survey model with related Field models. Field models can have parents and children for a tree structure, but I only want fields to have parents and children that are:
**a) Not the main record itself**
**and b) Members of / related to the same Survey model**
By passing the current model to my query scope, I can filter out ineligible records like so:
```
/**
* Limit results to only records that are eligible to be parents of the provided model
*
* @param Query $query
* @param Model $model The model to check for eligible parents agains
* @return Query
*/
public function scopeEligibleParents($query, $model) {
return $query->where('id', '!=', $model->id)
->where('parent_id', '!=', $model->id)
->where('survey_id', '=', $model->survey_id);
}
```
|
||
|---|---|---|
| bootstrap | ||
| config | ||
| modules | ||
| plugins/october/demo | ||
| storage | ||
| tests | ||
| themes/demo | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .htaccess | ||
| .travis.yml | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| ISSUE_TEMPLATE.md | ||
| README.md | ||
| artisan | ||
| composer.json | ||
| index.php | ||
| phpunit.xml | ||
| server.php | ||
README.md
October is a Content Management System (CMS) and web platform whose sole purpose is to make your development workflow simple again. It was born out of frustration with existing systems. We feel building websites has become a convoluted and confusing process that leaves developers unsatisfied. We want to turn you around to the simpler side and get back to basics.
October's mission is to show the world that web development is not rocket science.
Learning October
The best place to learn October is by reading the documentation or following some tutorials.
You may also watch these introductory videos for beginners and advanced users.
Installing October
Instructions on how to install October can be found at the installation guide.
Quick start installation
For advanced users, run this in your terminal to install October from command line:
php -r "eval('?>'.file_get_contents('https://octobercms.com/api/installer'));"
If you plan on using a database, run this command:
php artisan october:install
Development Team
October was created by Alexey Bobkov and Samuel Georges, who both continue to develop the platform.
Foundation library
The CMS uses Laravel as a foundation PHP framework.
Contact
You can communicate with us using the following mediums:
- Follow us on Twitter for announcements and updates.
- Follow us on Facebook for announcements and updates.
- Join us on IRC to chat with us.
License
The OctoberCMS platform is open-sourced software licensed under the MIT license.
Contributing
Before sending a Pull Request, be sure to review the Contributing Guidelines first.
Coding standards
Please follow the following guides and code standards: