We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace Backpack\CRUD; |
| 3 | 3 | |
| 4 | 4 | use Illuminate\Support\ServiceProvider; |
| 5 | -use Illuminate\Routing\Router; |
|
| 6 | 5 | use Route; |
| 7 | 6 | |
| 8 | 7 | class CrudServiceProvider extends ServiceProvider |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | * Remove the specified resource from storage. |
| 162 | 162 | * |
| 163 | 163 | * @param int $id |
| 164 | - * @return string |
|
| 164 | + * @return \Illuminate\Http\Response |
|
| 165 | 165 | */ |
| 166 | 166 | public function destroy($id) |
| 167 | 167 | { |
@@ -3,16 +3,12 @@ |
||
| 3 | 3 | use Illuminate\Foundation\Bus\DispatchesJobs; |
| 4 | 4 | use Illuminate\Routing\Controller as BaseController; |
| 5 | 5 | use Illuminate\Foundation\Validation\ValidatesRequests; |
| 6 | -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
|
| 7 | -use Illuminate\Support\Facades\Form as Form; |
|
| 8 | 6 | use Illuminate\Http\Request; |
| 9 | 7 | use Backpack\CRUD\Crud; |
| 10 | -use Crypt; |
|
| 11 | 8 | use Alert; |
| 12 | 9 | |
| 13 | 10 | |
| 14 | 11 | // VALIDATION: change the requests to match your own file names if you need form validation |
| 15 | -use Backpack\CRUD\app\Http\Requests\CrudRequest as StoreRequest; |
|
| 16 | 12 | use Backpack\CRUD\app\Http\Requests\CrudRequest as UpdateRequest; |
| 17 | 13 | |
| 18 | 14 | class CrudController extends BaseController { |
@@ -1,12 +1,8 @@ |
||
| 1 | 1 | <?php namespace App\Http\Controllers\Admin; |
| 2 | 2 | |
| 3 | -use App\Http\Requests; |
|
| 4 | -use App\Http\Controllers\Controller; |
|
| 5 | 3 | use Backpack\CRUD\app\Http\Controllers\CrudController; |
| 6 | -use Illuminate\Http\Request; |
|
| 7 | 4 | |
| 8 | 5 | // VALIDATION: change the requests to match your own file names if you need form validation |
| 9 | -use Backpack\CRUD\app\Http\Requests\CrudRequest as StoreRequest; |
|
| 10 | 6 | use Backpack\CRUD\app\Http\Requests\CrudRequest as UpdateRequest; |
| 11 | 7 | |
| 12 | 8 | class ExampleCrudController extends CrudController { |
@@ -1,9 +1,6 @@ |
||
| 1 | 1 | <?php namespace Backpack\Crud\app\Http\Controllers; |
| 2 | 2 | |
| 3 | -use Illuminate\Foundation\Bus\DispatchesJobs; |
|
| 4 | 3 | use Illuminate\Routing\Controller as BaseController; |
| 5 | -use Illuminate\Foundation\Validation\ValidatesRequests; |
|
| 6 | -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
|
| 7 | 4 | use Backpack\CRUD\Crud; |
| 8 | 5 | |
| 9 | 6 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * Store a newly created resource in storage. |
| 55 | 55 | * |
| 56 | 56 | * @param \Illuminate\Http\Request $request |
| 57 | - * @return \Illuminate\Http\Response |
|
| 57 | + * @return \Illuminate\Http\RedirectResponse |
|
| 58 | 58 | */ |
| 59 | 59 | public function crudStore(Request $request = null) |
| 60 | 60 | { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @param \Illuminate\Http\Request $request |
| 103 | 103 | * @param int $id |
| 104 | - * @return \Illuminate\Http\Response |
|
| 104 | + * @return \Illuminate\Http\RedirectResponse |
|
| 105 | 105 | */ |
| 106 | 106 | public function crudUpdate($parentId, $id, Request $request = null) |
| 107 | 107 | { |
@@ -4,10 +4,7 @@ |
||
| 4 | 4 | */ |
| 5 | 5 | namespace Backpack\Crud\Http\Controllers; |
| 6 | 6 | |
| 7 | -use Illuminate\Foundation\Bus\DispatchesJobs; |
|
| 8 | 7 | use Illuminate\Routing\Controller as BaseController; |
| 9 | -use Illuminate\Foundation\Validation\ValidatesRequests; |
|
| 10 | -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
|
| 11 | 8 | use Backpack\Crud\Crud; |
| 12 | 9 | |
| 13 | 10 | /** |
@@ -286,6 +286,7 @@ discard block |
||
| 286 | 286 | * Delete a row from the database. |
| 287 | 287 | * |
| 288 | 288 | * @param [int] The id of the item to be deleted. |
| 289 | + * @param integer $id |
|
| 289 | 290 | * @return [bool] Deletion confirmation. |
| 290 | 291 | * |
| 291 | 292 | * TODO: should this delete items with relations to it too? |
@@ -404,7 +405,8 @@ discard block |
||
| 404 | 405 | * Check if a permission is enabled for a Crud Panel. Fail if not. |
| 405 | 406 | * |
| 406 | 407 | * @param [string] Permission. |
| 407 | - * @return boolean |
|
| 408 | + * @param string $permission |
|
| 409 | + * @return boolean|null |
|
| 408 | 410 | */ |
| 409 | 411 | public function hasAccessOrFail($permission) |
| 410 | 412 | { |
@@ -433,6 +435,7 @@ discard block |
||
| 433 | 435 | * All Create-Read-Update-Delete operations are done using that Eloquent Collection. |
| 434 | 436 | * |
| 435 | 437 | * @param [string] Full model namespace. Ex: App\Models\Article |
| 438 | + * @param string $model_namespace |
|
| 436 | 439 | */ |
| 437 | 440 | public function setModel($model_namespace) |
| 438 | 441 | { |
@@ -460,6 +463,7 @@ discard block |
||
| 460 | 463 | * |
| 461 | 464 | * @param [string] Route name. |
| 462 | 465 | * @param [array] Parameters. |
| 466 | + * @param string $route |
|
| 463 | 467 | */ |
| 464 | 468 | public function setRoute($route) |
| 465 | 469 | { |
@@ -492,7 +496,7 @@ discard block |
||
| 492 | 496 | * - $this->crud->setRouteName('admin.article') |
| 493 | 497 | * - $this->crud->route = "admin/article" |
| 494 | 498 | * |
| 495 | - * @return [string] |
|
| 499 | + * @return string |
|
| 496 | 500 | */ |
| 497 | 501 | public function getRoute() |
| 498 | 502 | { |
@@ -505,6 +509,8 @@ discard block |
||
| 505 | 509 | * |
| 506 | 510 | * @param [string] Entity name, in singular. Ex: article |
| 507 | 511 | * @param [string] Entity name, in plural. Ex: articles |
| 512 | + * @param string $singular |
|
| 513 | + * @param string $plural |
|
| 508 | 514 | */ |
| 509 | 515 | public function setEntityNameStrings($singular, $plural) { |
| 510 | 516 | $this->entity_name = $singular; |
@@ -1237,6 +1243,9 @@ discard block |
||
| 1237 | 1243 | return array_filter($this->{$entity}[] = $this->syncField($field)); |
| 1238 | 1244 | } |
| 1239 | 1245 | |
| 1246 | + /** |
|
| 1247 | + * @param string $entity |
|
| 1248 | + */ |
|
| 1240 | 1249 | public function addMultiple($entity, $field) |
| 1241 | 1250 | { |
| 1242 | 1251 | $this->{$entity} = array_filter(array_map([$this, 'syncField'], $fields)); |
@@ -1256,16 +1265,25 @@ discard block |
||
| 1256 | 1265 | |
| 1257 | 1266 | |
| 1258 | 1267 | |
| 1268 | + /** |
|
| 1269 | + * @param string $entity |
|
| 1270 | + */ |
|
| 1259 | 1271 | public function remove($entity, $fields) |
| 1260 | 1272 | { |
| 1261 | 1273 | return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);})); |
| 1262 | 1274 | } |
| 1263 | 1275 | |
| 1276 | + /** |
|
| 1277 | + * @param string $items |
|
| 1278 | + */ |
|
| 1264 | 1279 | public function setSort($items, $order) |
| 1265 | 1280 | { |
| 1266 | 1281 | $this->sort[$items] = $order; |
| 1267 | 1282 | } |
| 1268 | 1283 | |
| 1284 | + /** |
|
| 1285 | + * @param string $items |
|
| 1286 | + */ |
|
| 1269 | 1287 | public function sort($items) |
| 1270 | 1288 | { |
| 1271 | 1289 | if (array_key_exists($items, $this->sort)) |
@@ -1301,6 +1319,10 @@ discard block |
||
| 1301 | 1319 | } |
| 1302 | 1320 | |
| 1303 | 1321 | // face un fel de merge intre ce ii dai si ce e in CRUD |
| 1322 | + |
|
| 1323 | + /** |
|
| 1324 | + * @param string $entity |
|
| 1325 | + */ |
|
| 1304 | 1326 | public function syncRelations($entity) |
| 1305 | 1327 | { |
| 1306 | 1328 | foreach ($this->relations as $field => $relation) { |
@@ -1,9 +1,6 @@ |
||
| 1 | 1 | <?php namespace Backpack\CRUD; |
| 2 | 2 | |
| 3 | -use Illuminate\Database\Eloquent\Collection; |
|
| 4 | -use Illuminate\Database\Eloquent\Model; |
|
| 5 | 3 | use DB; |
| 6 | -use Lang; |
|
| 7 | 4 | |
| 8 | 5 | trait CrudTrait { |
| 9 | 6 | |
@@ -38,6 +38,9 @@ discard block |
||
| 38 | 38 | $this->initState(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + /** |
|
| 42 | + * @param string $model |
|
| 43 | + */ |
|
| 41 | 44 | public function setModel($model) |
| 42 | 45 | { |
| 43 | 46 | if (!class_exists($model)) throw new \Exception('This model does not exist.', 404); |
@@ -54,6 +57,10 @@ discard block |
||
| 54 | 57 | } |
| 55 | 58 | |
| 56 | 59 | // TODO: make this work without having to specify "index" |
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @param string $route |
|
| 63 | + */ |
|
| 57 | 64 | public function setRoute($route, $parameters = []) |
| 58 | 65 | { |
| 59 | 66 | if (!\Route::has($route)) throw new \Exception('This route does not exist.', 404); |
@@ -259,6 +266,9 @@ discard block |
||
| 259 | 266 | return $model; |
| 260 | 267 | } |
| 261 | 268 | |
| 269 | + /** |
|
| 270 | + * @param integer $id |
|
| 271 | + */ |
|
| 262 | 272 | public function delete($id) // DONE |
| 263 | 273 | { |
| 264 | 274 | return $this->model->destroy($id); |
@@ -489,6 +499,9 @@ discard block |
||
| 489 | 499 | return array_filter($this->{$entity}[] = $this->syncField($field)); |
| 490 | 500 | } |
| 491 | 501 | |
| 502 | + /** |
|
| 503 | + * @param string $entity |
|
| 504 | + */ |
|
| 492 | 505 | private function addMultiple($entity, $field) |
| 493 | 506 | { |
| 494 | 507 | $this->{$entity} = array_filter(array_map([$this, 'syncField'], $fields)); |
@@ -506,16 +519,25 @@ discard block |
||
| 506 | 519 | } |
| 507 | 520 | } |
| 508 | 521 | |
| 522 | + /** |
|
| 523 | + * @param string $entity |
|
| 524 | + */ |
|
| 509 | 525 | private function remove($entity, $fields) |
| 510 | 526 | { |
| 511 | 527 | return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);})); |
| 512 | 528 | } |
| 513 | 529 | |
| 530 | + /** |
|
| 531 | + * @param string $items |
|
| 532 | + */ |
|
| 514 | 533 | private function setSort($items, $order) |
| 515 | 534 | { |
| 516 | 535 | $this->sort[$items] = $order; |
| 517 | 536 | } |
| 518 | 537 | |
| 538 | + /** |
|
| 539 | + * @param string $items |
|
| 540 | + */ |
|
| 519 | 541 | private function sort($items) |
| 520 | 542 | { |
| 521 | 543 | if (array_key_exists($items, $this->sort)) |
@@ -561,6 +583,9 @@ discard block |
||
| 561 | 583 | return $values->get()->lists($field, $model->getKeyName())->toArray(); |
| 562 | 584 | } |
| 563 | 585 | |
| 586 | + /** |
|
| 587 | + * @param string $entity |
|
| 588 | + */ |
|
| 564 | 589 | private function syncRelations($entity) |
| 565 | 590 | { |
| 566 | 591 | foreach ($this->relations as $field => $relation) { |