| 1 | <?php |
||
| 8 | class AdminController extends Controller |
||
| 9 | { |
||
| 10 | use HasResourceActions; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Title for current resource. |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $title = 'Title'; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Set description for following 4 action pages. |
||
| 21 | * |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | protected $description = [ |
||
| 25 | // 'index' => 'Index', |
||
| 26 | // 'show' => 'Show', |
||
| 27 | // 'edit' => 'Edit', |
||
| 28 | // 'create' => 'Create', |
||
| 29 | ]; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Get content title. |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | protected function title() |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Index interface. |
||
| 43 | * |
||
| 44 | * @param Content $content |
||
| 45 | * |
||
| 46 | * @return Content |
||
| 47 | */ |
||
| 48 | public function index(Content $content) |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Show interface. |
||
| 58 | * |
||
| 59 | * @param mixed $id |
||
| 60 | * @param Content $content |
||
| 61 | * |
||
| 62 | * @return Content |
||
| 63 | */ |
||
| 64 | public function show($id, Content $content) |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Edit interface. |
||
| 74 | * |
||
| 75 | * @param mixed $id |
||
| 76 | * @param Content $content |
||
| 77 | * |
||
| 78 | * @return Content |
||
| 79 | */ |
||
| 80 | public function edit($id, Content $content) |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Create interface. |
||
| 90 | * |
||
| 91 | * @param Content $content |
||
| 92 | * |
||
| 93 | * @return Content |
||
| 94 | */ |
||
| 95 | public function create(Content $content) |
||
| 102 | } |
||
| 103 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: