1
|
|
|
<?php |
2
|
|
|
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Admin; |
4
|
|
|
|
5
|
|
|
use Backpack\CRUD\app\Http\Controllers\CrudController; |
6
|
|
|
|
7
|
|
|
class JobPosterCrudController extends CrudController |
|
|
|
|
8
|
|
|
{ |
9
|
|
|
public function setup() |
|
|
|
|
10
|
|
|
{ |
11
|
|
|
$this->crud->setModel("App\Models\JobPoster"); |
12
|
|
|
$this->crud->setRoute("admin/job-poster"); |
13
|
|
|
$this->crud->setEntityNameStrings('job poster', 'job posters'); |
14
|
|
|
|
15
|
|
|
$this->crud->denyAccess('create'); |
16
|
|
|
$this->crud->denyAccess('delete'); |
17
|
|
|
|
18
|
|
|
if (!$this->request->has('order')) { |
19
|
|
|
$this->crud->orderBy('close_date_time', 'desc'); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
$this->crud->addColumn([ |
|
|
|
|
23
|
|
|
'name' => 'title', |
24
|
|
|
'type' => 'text', |
25
|
|
|
'label' => 'Title' |
26
|
|
|
]); |
|
|
|
|
27
|
|
|
$this->crud->addColumn([ |
|
|
|
|
28
|
|
|
'name' => 'open_date_time', |
29
|
|
|
'type' => 'datetime', |
30
|
|
|
'label' => 'Open Date' |
31
|
|
|
]); |
|
|
|
|
32
|
|
|
$this->crud->addColumn([ |
|
|
|
|
33
|
|
|
'name' => 'close_date_time', |
34
|
|
|
'type' => 'datetime', |
35
|
|
|
'label' => 'Close Date' |
36
|
|
|
]); |
|
|
|
|
37
|
|
|
$this->crud->addColumn([ |
|
|
|
|
38
|
|
|
'name' => "status", |
39
|
|
|
'label' => "Status", |
40
|
|
|
'type' => "model_function", |
41
|
|
|
'function_name' => 'status', |
42
|
|
|
]); |
|
|
|
|
43
|
|
|
$this->crud->addColumn([ |
|
|
|
|
44
|
|
|
'name' => "published", |
45
|
|
|
'label' => "Published", |
46
|
|
|
'type' => "check", |
47
|
|
|
]); |
|
|
|
|
48
|
|
|
$this->crud->addColumn([ |
|
|
|
|
49
|
|
|
'name' => 'manager.user.name', |
50
|
|
|
'type' => 'text', |
51
|
|
|
'label' => 'Manager' |
52
|
|
|
]); |
|
|
|
|
53
|
|
|
$this->crud->addColumn([ |
|
|
|
|
54
|
|
|
'name' => "submitted_applications_count", |
55
|
|
|
'label' => "Applications", |
56
|
|
|
'type' => "model_function", |
57
|
|
|
'function_name' => 'submitted_applications_count', |
58
|
|
|
]); |
|
|
|
|
59
|
|
|
|
60
|
|
|
$this->crud->addField([ |
|
|
|
|
61
|
|
|
'name' => 'title', |
62
|
|
|
'label' => "Title", |
63
|
|
|
'type' => 'text', |
64
|
|
|
'attributes' => [ |
65
|
|
|
'readonly' => 'readonly' |
66
|
|
|
] |
67
|
|
|
]); |
|
|
|
|
68
|
|
|
$this->crud->addField([ |
|
|
|
|
69
|
|
|
'name' => 'close_date_time', |
70
|
|
|
'label' => 'Close Date', |
71
|
|
|
'type' => 'datetime_picker', |
72
|
|
|
'datetime_picker_options' => [ |
73
|
|
|
'format' => 'YYYY-MM-DD HH:mm:ss', |
74
|
|
|
], |
75
|
|
|
]); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function update($request) |
|
|
|
|
79
|
|
|
{ |
80
|
|
|
$response = parent::updateCrud(); |
81
|
|
|
return $response; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|