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