We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 11 | class PageCrudController extends CrudController |
||
| 12 | { |
||
| 13 | use PageTemplates; |
||
| 14 | |||
| 15 | public function setup($template_name = false) |
||
| 16 | { |
||
| 17 | parent::__construct(); |
||
| 18 | |||
| 19 | $modelClass = config('backpack.pagemanager.page_model_class', 'Backpack\PageManager\app\Models\Page'); |
||
| 20 | |||
| 21 | /* |
||
| 22 | |-------------------------------------------------------------------------- |
||
| 23 | | BASIC CRUD INFORMATION |
||
| 24 | |-------------------------------------------------------------------------- |
||
| 25 | */ |
||
| 26 | $this->crud->setModel($modelClass); |
||
| 27 | $this->crud->setRoute(config('backpack.base.route_prefix').'/page'); |
||
| 28 | $this->crud->setEntityNameStrings(trans('backpack::pagemanager.page'), trans('backpack::pagemanager.pages')); |
||
| 29 | |||
| 30 | /* |
||
| 31 | |-------------------------------------------------------------------------- |
||
| 32 | | COLUMNS |
||
| 33 | |-------------------------------------------------------------------------- |
||
| 34 | */ |
||
| 35 | |||
| 36 | $this->crud->addColumn([ |
||
| 37 | 'name' => 'name', |
||
| 38 | 'label' => trans('backpack::pagemanager.name'), |
||
| 39 | ]); |
||
| 40 | $this->crud->addColumn([ |
||
| 41 | 'name' => 'template', |
||
| 42 | 'label' => trans('backpack::pagemanager.template'), |
||
| 43 | 'type' => 'model_function', |
||
| 44 | 'function_name' => 'getTemplateName', |
||
| 45 | ]); |
||
| 46 | $this->crud->addColumn([ |
||
| 47 | 'name' => 'slug', |
||
| 48 | 'label' => trans('backpack::pagemanager.slug'), |
||
| 49 | ]); |
||
| 50 | |||
| 51 | /* |
||
| 52 | |-------------------------------------------------------------------------- |
||
| 53 | | FIELDS |
||
| 54 | |-------------------------------------------------------------------------- |
||
| 55 | */ |
||
| 56 | |||
| 57 | // In PageManager, |
||
| 58 | // - default fields, that all templates are using, are set using $this->addDefaultPageFields(); |
||
| 59 | // - template-specific fields are set per-template, in the PageTemplates trait; |
||
| 60 | |||
| 61 | /* |
||
| 62 | |-------------------------------------------------------------------------- |
||
| 63 | | BUTTONS |
||
| 64 | |-------------------------------------------------------------------------- |
||
| 65 | */ |
||
| 66 | $this->crud->addButtonFromModelFunction('line', 'open', 'getOpenButton', 'beginning'); |
||
| 67 | } |
||
| 68 | |||
| 69 | // ----------------------------------------------- |
||
| 70 | // Overwrites of CrudController |
||
| 71 | // ----------------------------------------------- |
||
| 72 | |||
| 73 | // Overwrites the CrudController create() method to add template usage. |
||
| 74 | public function create($template = false) |
||
| 81 | |||
| 82 | // Overwrites the CrudController store() method to add template usage. |
||
| 83 | public function store(StoreRequest $request) |
||
| 90 | |||
| 91 | // Overwrites the CrudController edit() method to add template usage. |
||
| 92 | public function edit($id, $template = false) |
||
| 106 | |||
| 107 | // Overwrites the CrudController update() method to add template usage. |
||
| 108 | public function update(UpdateRequest $request) |
||
| 115 | |||
| 116 | // ----------------------------------------------- |
||
| 117 | // Methods that are particular to the PageManager. |
||
| 118 | // ----------------------------------------------- |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Populate the create/update forms with basic fields, that all pages need. |
||
| 122 | * |
||
| 123 | * @param string $template The name of the template that should be used in the current form. |
||
| 124 | */ |
||
| 125 | public function addDefaultPageFields($template = false) |
||
| 161 | |||
| 162 | /** |
||
| 163 | * Add the fields defined for a specific template. |
||
| 164 | * |
||
| 165 | * @param string $template_name The name of the template that should be used in the current form. |
||
| 166 | */ |
||
| 167 | public function useTemplate($template_name = false) |
||
| 181 | |||
| 182 | /** |
||
| 183 | * Get all defined templates. |
||
| 184 | */ |
||
| 185 | public function getTemplates($template_name = false) |
||
| 198 | |||
| 199 | /** |
||
| 200 | * Get all defined template as an array. |
||
| 201 | * |
||
| 202 | * Used to populate the template dropdown in the create/update forms. |
||
| 203 | */ |
||
| 204 | public function getTemplatesArray() |
||
| 214 | } |
||
| 215 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.