MemberCrudController::setupListOperation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Http\Controllers\Admin;
4
5
use App\Http\Requests\MemberRequest;
6
use App\Models\Member;
7
use Backpack\CRUD\app\Http\Controllers\CrudController;
8
use Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
9
use Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
10
use Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
11
use Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
12
use Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
13
use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
14
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
15
16
/**
17
 * Class MemberCrudController
18
 * @property-read CrudPanel $crud
19
 */
20
class MemberCrudController extends CrudController
21
{
22
    use ListOperation;
0 ignored issues
show
introduced by
The trait Backpack\CRUD\app\Http\C...perations\ListOperation requires some properties which are not provided by App\Http\Controllers\Admin\MemberCrudController: $model, $query, $entity_name_plural
Loading history...
23
    use CreateOperation;
0 ignored issues
show
Bug introduced by
The trait Backpack\CRUD\app\Http\C...rations\CreateOperation requires the property $entity_name which is not provided by App\Http\Controllers\Admin\MemberCrudController.
Loading history...
24
    use UpdateOperation;
0 ignored issues
show
introduced by
The trait Backpack\CRUD\app\Http\C...rations\UpdateOperation requires some properties which are not provided by App\Http\Controllers\Admin\MemberCrudController: $entity_name, $model
Loading history...
25
    use DeleteOperation;
26
    use ShowOperation;
0 ignored issues
show
introduced by
The trait Backpack\CRUD\app\Http\C...perations\ShowOperation requires some properties which are not provided by App\Http\Controllers\Admin\MemberCrudController: $route, $entity_name
Loading history...
27
28
    /**
29
     * Configure the CrudPanel object. Apply settings to all operations.
30
     *
31
     * @return void
32
     */
33
    public function setup()
34
    {
35
        CRUD::setModel(Member::class);
36
        CRUD::setRoute(config('backpack.base.route_prefix').'/member');
37
        CRUD::setEntityNameStrings('member', 'members');
38
    }
39
40
    /**
41
     * Define what happens when the List operation is loaded.
42
     *
43
     * @see  https://backpackforlaravel.com/docs/crud-operation-list-entries
44
     * @return void
45
     */
46
    protected function setupListOperation()
47
    {
48
        CRUD::setFromDb(); // columns
49
50
        /**
51
         * Columns can be defined using the fluent syntax or array syntax:
52
         * - CRUD::column('price')->type('number');
53
         * - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
54
         */
55
    }
56
57
    /**
58
     * Define what happens when the Create operation is loaded.
59
     *
60
     * @see https://backpackforlaravel.com/docs/crud-operation-create
61
     * @return void
62
     */
63
    protected function setupCreateOperation()
64
    {
65
        CRUD::setValidation(MemberRequest::class);
66
67
        CRUD::setFromDb(); // fields
68
69
        /**
70
         * Fields can be defined using the fluent syntax or array syntax:
71
         * - CRUD::field('price')->type('number');
72
         * - CRUD::addField(['name' => 'price', 'type' => 'number']));
73
         */
74
    }
75
76
    /**
77
     * Define what happens when the Update operation is loaded.
78
     *
79
     * @see https://backpackforlaravel.com/docs/crud-operation-update
80
     * @return void
81
     */
82
    protected function setupUpdateOperation()
83
    {
84
        $this->setupCreateOperation();
85
    }
86
}
87