1 | <?php |
||
19 | class AttributesController extends AuthorizedController |
||
20 | { |
||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | protected $resource = Attribute::class; |
||
25 | |||
26 | /** |
||
27 | * List all attributes. |
||
28 | * |
||
29 | * @param \Cortex\Attributes\DataTables\Adminarea\AttributesDataTable $attributesDataTable |
||
30 | * |
||
31 | * @return \Illuminate\Http\JsonResponse|\Illuminate\View\View |
||
32 | */ |
||
33 | public function index(AttributesDataTable $attributesDataTable) |
||
39 | |||
40 | /** |
||
41 | * List attribute logs. |
||
42 | * |
||
43 | * @param \Cortex\Attributes\Models\Attribute $attribute |
||
44 | * @param \Cortex\Foundation\DataTables\LogsDataTable $logsDataTable |
||
45 | * |
||
46 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse |
||
47 | */ |
||
48 | public function logs(Attribute $attribute, LogsDataTable $logsDataTable) |
||
49 | { |
||
50 | return $logsDataTable->with([ |
||
51 | 'resource' => $attribute, |
||
52 | 'tabs' => 'adminarea.attributes.tabs', |
||
53 | 'id' => "adminarea-attributes-{$attribute->getRouteKey()}-logs-table", |
||
54 | ])->render('cortex/foundation::adminarea.pages.datatable-tab'); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Import attributes. |
||
59 | * |
||
60 | * @param \Cortex\Attributes\Models\Attribute $attribute |
||
61 | * @param \Cortex\Foundation\DataTables\ImportRecordsDataTable $importRecordsDataTable |
||
62 | * |
||
63 | * @return \Illuminate\View\View |
||
64 | */ |
||
65 | public function import(Attribute $attribute, ImportRecordsDataTable $importRecordsDataTable) |
||
74 | |||
75 | /** |
||
76 | * Stash attributes. |
||
77 | * |
||
78 | * @param \Cortex\Foundation\Http\Requests\ImportFormRequest $request |
||
79 | * @param \Cortex\Foundation\Importers\DefaultImporter $importer |
||
80 | * |
||
81 | * @return void |
||
82 | */ |
||
83 | public function stash(ImportFormRequest $request, DefaultImporter $importer) |
||
89 | |||
90 | /** |
||
91 | * Hoard attributes. |
||
92 | * |
||
93 | * @param \Cortex\Foundation\Http\Requests\ImportFormRequest $request |
||
94 | * |
||
95 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse |
||
96 | */ |
||
97 | public function hoard(ImportFormRequest $request) |
||
120 | |||
121 | /** |
||
122 | * List attribute import logs. |
||
123 | * |
||
124 | * @param \Cortex\Foundation\DataTables\ImportLogsDataTable $importLogsDatatable |
||
125 | * |
||
126 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse |
||
127 | */ |
||
128 | public function importLogs(ImportLogsDataTable $importLogsDatatable) |
||
136 | |||
137 | /** |
||
138 | * Show attribute create/edit form. |
||
139 | * |
||
140 | * @param \Cortex\Attributes\Models\Attribute $attribute |
||
141 | * |
||
142 | * @return \Illuminate\View\View |
||
143 | */ |
||
144 | protected function form(Attribute $attribute) |
||
158 | |||
159 | /** |
||
160 | * Store new attribute. |
||
161 | * |
||
162 | * @param \Cortex\Attributes\Http\Requests\Adminarea\AttributeFormRequest $request |
||
163 | * @param \Cortex\Attributes\Models\Attribute $attribute |
||
164 | * |
||
165 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse |
||
166 | */ |
||
167 | public function store(AttributeFormRequest $request, Attribute $attribute) |
||
171 | |||
172 | /** |
||
173 | * Update given attribute. |
||
174 | * |
||
175 | * @param \Cortex\Attributes\Http\Requests\Adminarea\AttributeFormRequest $request |
||
176 | * @param \Cortex\Attributes\Models\Attribute $attribute |
||
177 | * |
||
178 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse |
||
179 | */ |
||
180 | public function update(AttributeFormRequest $request, Attribute $attribute) |
||
184 | |||
185 | /** |
||
186 | * Process stored/updated attribute. |
||
187 | * |
||
188 | * @param \Illuminate\Foundation\Http\FormRequest $request |
||
189 | * @param \Cortex\Attributes\Models\Attribute $attribute |
||
190 | * |
||
191 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse |
||
192 | */ |
||
193 | protected function process(FormRequest $request, Attribute $attribute) |
||
206 | |||
207 | /** |
||
208 | * Destroy given attribute. |
||
209 | * |
||
210 | * @param \Cortex\Attributes\Models\Attribute $attribute |
||
211 | * |
||
212 | * @throws \Exception |
||
213 | * |
||
214 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse |
||
215 | */ |
||
216 | public function destroy(Attribute $attribute) |
||
225 | } |
||
226 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.