|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SleepingOwl\Admin\Model; |
|
4
|
|
|
|
|
5
|
|
|
use Closure; |
|
6
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
7
|
|
|
use SleepingOwl\Admin\Contracts\Initializable; |
|
8
|
|
|
use SleepingOwl\Admin\Contracts\Form\FormInterface; |
|
9
|
|
|
use SleepingOwl\Admin\Display\DisplayDatatablesAsync; |
|
10
|
|
|
use SleepingOwl\Admin\Contracts\Display\DisplayInterface; |
|
11
|
|
|
|
|
12
|
|
|
class ModelConfiguration extends ModelConfigurationManager |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
protected $createTitle; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $editTitle; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var Closure|null |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $display; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var Closure|null |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $create; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var bool |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $displayable = true; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var bool |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $creatable = true; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var bool |
|
46
|
|
|
*/ |
|
47
|
|
|
protected $editable = true; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var bool |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $restorable = true; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var bool |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $deletable = true; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var bool |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $destroyable = true; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @var Closure|null |
|
66
|
|
|
*/ |
|
67
|
|
|
protected $edit; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var Closure|null |
|
71
|
|
|
*/ |
|
72
|
|
|
protected $delete = true; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @var Closure|null |
|
76
|
|
|
*/ |
|
77
|
|
|
protected $destroy = true; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @var Closure|null |
|
81
|
|
|
*/ |
|
82
|
|
|
protected $restore = true; |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @var string |
|
86
|
|
|
*/ |
|
87
|
|
|
protected $messageOnCreate; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @var string |
|
91
|
|
|
*/ |
|
92
|
|
|
protected $messageOnUpdate; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @var string |
|
96
|
|
|
*/ |
|
97
|
|
|
protected $messageOnDelete; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @var string |
|
101
|
|
|
*/ |
|
102
|
|
|
protected $messageOnDestroy; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @var string |
|
106
|
|
|
*/ |
|
107
|
|
|
protected $messageOnRestore; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @param string $alias |
|
111
|
|
|
* |
|
112
|
|
|
* @return $this |
|
113
|
|
|
*/ |
|
114
|
1 |
|
public function setAlias($alias) |
|
115
|
|
|
{ |
|
116
|
1 |
|
$this->alias = $alias; |
|
117
|
|
|
|
|
118
|
1 |
|
return $this; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @param string $title |
|
123
|
|
|
* |
|
124
|
|
|
* @return $this |
|
125
|
|
|
*/ |
|
126
|
1 |
|
public function setTitle($title) |
|
127
|
|
|
{ |
|
128
|
1 |
|
$this->title = $title; |
|
129
|
|
|
|
|
130
|
1 |
|
return $this; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* @return string|\Symfony\Component\Translation\TranslatorInterface |
|
135
|
|
|
*/ |
|
136
|
1 |
|
public function getCreateTitle() |
|
137
|
|
|
{ |
|
138
|
1 |
|
if (is_null($this->createTitle)) { |
|
139
|
1 |
|
return parent::getCreateTitle(); |
|
|
|
|
|
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
1 |
|
return $this->createTitle; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @param string $title |
|
147
|
|
|
* |
|
148
|
|
|
* @return $this |
|
149
|
|
|
*/ |
|
150
|
1 |
|
public function setCreateTitle($title) |
|
151
|
|
|
{ |
|
152
|
1 |
|
$this->createTitle = $title; |
|
153
|
|
|
|
|
154
|
1 |
|
return $this; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* @return string|\Symfony\Component\Translation\TranslatorInterface |
|
159
|
|
|
*/ |
|
160
|
1 |
|
public function getEditTitle() |
|
161
|
|
|
{ |
|
162
|
1 |
|
if (is_null($this->editTitle)) { |
|
163
|
1 |
|
return parent::getEditTitle(); |
|
|
|
|
|
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
1 |
|
return $this->editTitle; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* @param string $title |
|
171
|
|
|
* |
|
172
|
|
|
* @return $this |
|
173
|
|
|
*/ |
|
174
|
1 |
|
public function setEditTitle($title) |
|
175
|
|
|
{ |
|
176
|
1 |
|
$this->editTitle = $title; |
|
177
|
|
|
|
|
178
|
1 |
|
return $this; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @return bool |
|
183
|
|
|
*/ |
|
184
|
1 |
|
public function isDisplayable() |
|
185
|
|
|
{ |
|
186
|
1 |
|
return $this->displayable && parent::isDisplayable(); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* @return $this |
|
191
|
|
|
*/ |
|
192
|
1 |
|
public function disableDisplay() |
|
193
|
|
|
{ |
|
194
|
1 |
|
$this->displayable = false; |
|
195
|
|
|
|
|
196
|
1 |
|
return $this; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* @param string $action |
|
201
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
|
202
|
|
|
* |
|
203
|
|
|
* @return bool |
|
204
|
|
|
*/ |
|
205
|
6 |
|
public function can($action, Model $model) |
|
206
|
|
|
{ |
|
207
|
6 |
|
if (! $this->checkAccess) { |
|
208
|
6 |
|
return true; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
return \Gate::allows($action, $model); |
|
212
|
|
|
} |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* @return bool |
|
216
|
|
|
*/ |
|
217
|
1 |
|
public function isCreatable() |
|
218
|
|
|
{ |
|
219
|
1 |
|
if (! is_callable($this->getCreate())) { |
|
220
|
1 |
|
return false; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
1 |
|
return $this->creatable && parent::isCreatable($this->getModel()); |
|
|
|
|
|
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* @return $this |
|
228
|
|
|
*/ |
|
229
|
1 |
|
public function disableCreating() |
|
230
|
|
|
{ |
|
231
|
1 |
|
$this->creatable = false; |
|
232
|
|
|
|
|
233
|
1 |
|
return $this; |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* @param Model $model |
|
238
|
|
|
* |
|
239
|
|
|
* @return bool |
|
240
|
|
|
*/ |
|
241
|
1 |
|
public function isEditable(Model $model) |
|
242
|
|
|
{ |
|
243
|
1 |
|
if (! is_callable($this->getEdit())) { |
|
244
|
1 |
|
return false; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
1 |
|
return $this->editable && parent::isEditable($model); |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @return $this |
|
252
|
|
|
*/ |
|
253
|
1 |
|
public function disableEditing() |
|
254
|
|
|
{ |
|
255
|
1 |
|
$this->editable = false; |
|
256
|
|
|
|
|
257
|
1 |
|
return $this; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* @param bool $deletable |
|
262
|
|
|
* |
|
263
|
|
|
* @return $this |
|
264
|
|
|
*/ |
|
265
|
1 |
|
public function setDeletable($deletable) |
|
266
|
|
|
{ |
|
267
|
1 |
|
$this->deletable = (bool) $deletable; |
|
268
|
|
|
|
|
269
|
1 |
|
return $this; |
|
270
|
|
|
} |
|
271
|
|
|
|
|
272
|
|
|
/** |
|
273
|
|
|
* @param Model $model |
|
274
|
|
|
* |
|
275
|
|
|
* @return bool |
|
276
|
|
|
*/ |
|
277
|
1 |
|
public function isDeletable(Model $model) |
|
278
|
|
|
{ |
|
279
|
1 |
|
return $this->deletable && parent::isDeletable($model); |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
/** |
|
283
|
|
|
* @return $this |
|
284
|
|
|
*/ |
|
285
|
1 |
|
public function disableDeleting() |
|
286
|
|
|
{ |
|
287
|
1 |
|
$this->setDeletable(false); |
|
288
|
|
|
|
|
289
|
1 |
|
return $this; |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
/** |
|
293
|
|
|
* @param Model $model |
|
294
|
|
|
* |
|
295
|
|
|
* @return bool |
|
296
|
|
|
*/ |
|
297
|
3 |
|
public function isDestroyable(Model $model) |
|
298
|
|
|
{ |
|
299
|
3 |
|
return $this->destroyable && parent::isDestroyable($model); |
|
300
|
|
|
} |
|
301
|
|
|
|
|
302
|
|
|
/** |
|
303
|
|
|
* @return $this |
|
304
|
|
|
*/ |
|
305
|
1 |
|
public function disableDestroying() |
|
306
|
|
|
{ |
|
307
|
1 |
|
$this->destroyable = false; |
|
308
|
|
|
|
|
309
|
1 |
|
return $this; |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
|
/** |
|
313
|
|
|
* @param Model $model |
|
314
|
|
|
* |
|
315
|
|
|
* @return bool |
|
316
|
|
|
*/ |
|
317
|
1 |
|
public function isRestorable(Model $model) |
|
318
|
|
|
{ |
|
319
|
1 |
|
return $this->restorable && parent::isRestorable($model); |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
/** |
|
323
|
|
|
* @return bool |
|
324
|
|
|
*/ |
|
325
|
6 |
|
public function isRestorableModel() |
|
326
|
|
|
{ |
|
327
|
6 |
|
return $this->restorable && parent::isRestorableModel(); |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
/** |
|
331
|
|
|
* @return $this |
|
332
|
|
|
*/ |
|
333
|
1 |
|
public function disableRestoring() |
|
334
|
|
|
{ |
|
335
|
1 |
|
$this->restorable = false; |
|
336
|
|
|
|
|
337
|
1 |
|
return $this; |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
/** |
|
341
|
|
|
* @return Closure|null |
|
342
|
|
|
*/ |
|
343
|
1 |
|
public function getDisplay() |
|
344
|
|
|
{ |
|
345
|
1 |
|
return $this->display; |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
/** |
|
349
|
|
|
* @param Closure $callback |
|
350
|
|
|
* |
|
351
|
|
|
* @return $this |
|
352
|
|
|
*/ |
|
353
|
1 |
|
public function onDisplay(Closure $callback) |
|
354
|
|
|
{ |
|
355
|
1 |
|
$this->display = $callback; |
|
356
|
|
|
|
|
357
|
1 |
|
return $this; |
|
358
|
|
|
} |
|
359
|
|
|
|
|
360
|
|
|
/** |
|
361
|
|
|
* @param array|null $payload |
|
362
|
|
|
* @return DisplayInterface|mixed |
|
363
|
|
|
*/ |
|
364
|
1 |
View Code Duplication |
public function fireDisplay(array $payload = []) |
|
|
|
|
|
|
365
|
|
|
{ |
|
366
|
1 |
|
if (! is_callable($this->getDisplay())) { |
|
367
|
|
|
return; |
|
368
|
|
|
} |
|
369
|
|
|
|
|
370
|
1 |
|
$display = $this->app->call($this->getDisplay(), $payload); |
|
371
|
|
|
|
|
372
|
1 |
|
if ($display instanceof DisplayDatatablesAsync) { |
|
373
|
|
|
$display->setPayload($payload); |
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
1 |
|
if ($display instanceof DisplayInterface) { |
|
377
|
1 |
|
$display->setModelClass($this->getClass()); |
|
378
|
1 |
|
} |
|
379
|
|
|
|
|
380
|
1 |
|
if ($display instanceof Initializable) { |
|
381
|
1 |
|
$display->initialize(); |
|
382
|
1 |
|
} |
|
383
|
|
|
|
|
384
|
1 |
|
return $display; |
|
385
|
|
|
} |
|
386
|
|
|
|
|
387
|
|
|
/** |
|
388
|
|
|
* @return Closure|null |
|
389
|
|
|
*/ |
|
390
|
3 |
|
public function getCreate() |
|
391
|
|
|
{ |
|
392
|
3 |
|
return $this->create; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
/** |
|
396
|
|
|
* @param Closure|null $callback |
|
397
|
|
|
* |
|
398
|
|
|
* @return $this |
|
399
|
|
|
*/ |
|
400
|
3 |
|
public function onCreate(Closure $callback = null) |
|
401
|
|
|
{ |
|
402
|
3 |
|
$this->create = $callback; |
|
403
|
|
|
|
|
404
|
3 |
|
return $this; |
|
405
|
|
|
} |
|
406
|
|
|
|
|
407
|
|
|
/** |
|
408
|
|
|
* @return mixed|void |
|
409
|
|
|
*/ |
|
410
|
1 |
View Code Duplication |
public function fireCreate() |
|
|
|
|
|
|
411
|
|
|
{ |
|
412
|
1 |
|
if (! is_callable($this->getCreate())) { |
|
413
|
|
|
return; |
|
414
|
|
|
} |
|
415
|
|
|
|
|
416
|
1 |
|
$form = $this->app->call($this->getCreate()); |
|
417
|
1 |
|
if ($form instanceof DisplayInterface) { |
|
418
|
1 |
|
$form->setModelClass($this->getClass()); |
|
419
|
1 |
|
} |
|
420
|
|
|
|
|
421
|
1 |
|
if ($form instanceof FormInterface) { |
|
422
|
1 |
|
$form->setAction($this->getStoreUrl()); |
|
423
|
1 |
|
} |
|
424
|
|
|
|
|
425
|
1 |
|
if ($form instanceof Initializable) { |
|
426
|
1 |
|
$form->initialize(); |
|
427
|
1 |
|
} |
|
428
|
|
|
|
|
429
|
1 |
|
return $form; |
|
430
|
|
|
} |
|
431
|
|
|
|
|
432
|
|
|
/** |
|
433
|
|
|
* @return Closure|null |
|
434
|
|
|
*/ |
|
435
|
3 |
|
public function getEdit() |
|
436
|
|
|
{ |
|
437
|
3 |
|
return $this->edit; |
|
438
|
|
|
} |
|
439
|
|
|
|
|
440
|
|
|
/** |
|
441
|
|
|
* @param Closure|null $callback |
|
442
|
|
|
* |
|
443
|
|
|
* @return $this |
|
444
|
|
|
*/ |
|
445
|
3 |
|
public function onEdit(Closure $callback = null) |
|
446
|
|
|
{ |
|
447
|
3 |
|
$this->edit = $callback; |
|
448
|
|
|
|
|
449
|
3 |
|
return $this; |
|
450
|
|
|
} |
|
451
|
|
|
|
|
452
|
|
|
/** |
|
453
|
|
|
* @param int|string $id |
|
454
|
|
|
* |
|
455
|
|
|
* @return mixed|void |
|
456
|
|
|
*/ |
|
457
|
1 |
|
public function fireEdit($id) |
|
458
|
|
|
{ |
|
459
|
1 |
|
if (! is_callable($this->getEdit())) { |
|
460
|
|
|
return; |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
1 |
|
$form = $this->app->call($this->getEdit(), ['id' => $id]); |
|
464
|
1 |
|
if ($form instanceof DisplayInterface) { |
|
465
|
1 |
|
$form->setModelClass($this->getClass()); |
|
466
|
1 |
|
} |
|
467
|
|
|
|
|
468
|
1 |
|
if ($form instanceof FormInterface) { |
|
469
|
1 |
|
$form->setAction($this->getUpdateUrl($id)); |
|
470
|
1 |
|
} |
|
471
|
|
|
|
|
472
|
1 |
|
if ($form instanceof Initializable) { |
|
473
|
1 |
|
$form->initialize(); |
|
474
|
1 |
|
} |
|
475
|
|
|
|
|
476
|
1 |
|
if ($form instanceof FormInterface) { |
|
477
|
1 |
|
$form->setId($id); |
|
478
|
1 |
|
} |
|
479
|
|
|
|
|
480
|
1 |
|
return $form; |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
/** |
|
484
|
|
|
* @param Closure|null $callback |
|
485
|
|
|
* |
|
486
|
|
|
* @return $this |
|
487
|
|
|
*/ |
|
488
|
1 |
|
public function onCreateAndEdit(Closure $callback = null) |
|
489
|
|
|
{ |
|
490
|
1 |
|
$this->onCreate($callback); |
|
491
|
1 |
|
$this->onEdit($callback); |
|
492
|
|
|
|
|
493
|
1 |
|
return $this; |
|
494
|
|
|
} |
|
495
|
|
|
|
|
496
|
|
|
/** |
|
497
|
|
|
* @return Closure|null |
|
498
|
|
|
*/ |
|
499
|
1 |
|
public function getDelete() |
|
500
|
|
|
{ |
|
501
|
1 |
|
return $this->delete; |
|
502
|
|
|
} |
|
503
|
|
|
|
|
504
|
|
|
/** |
|
505
|
|
|
* @param Closure|null $callback |
|
506
|
|
|
* |
|
507
|
|
|
* @return $this |
|
508
|
|
|
*/ |
|
509
|
1 |
|
public function onDelete(Closure $callback = null) |
|
510
|
|
|
{ |
|
511
|
1 |
|
$this->delete = $callback; |
|
512
|
|
|
|
|
513
|
1 |
|
return $this; |
|
514
|
|
|
} |
|
515
|
|
|
|
|
516
|
|
|
/** |
|
517
|
|
|
* @param int|string $id |
|
518
|
|
|
* |
|
519
|
|
|
* @return mixed |
|
520
|
|
|
*/ |
|
521
|
1 |
|
public function fireDelete($id) |
|
522
|
|
|
{ |
|
523
|
1 |
|
if (is_callable($this->getDelete())) { |
|
524
|
1 |
|
return $this->app->call($this->getDelete(), [$id]); |
|
525
|
|
|
} |
|
526
|
|
|
} |
|
527
|
|
|
|
|
528
|
|
|
/** |
|
529
|
|
|
* @return Closure|null |
|
530
|
|
|
*/ |
|
531
|
1 |
|
public function getDestroy() |
|
532
|
|
|
{ |
|
533
|
1 |
|
return $this->destroy; |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
/** |
|
537
|
|
|
* @param Closure|null $callback |
|
538
|
|
|
* |
|
539
|
|
|
* @return $this |
|
540
|
|
|
*/ |
|
541
|
1 |
|
public function onDestroy(Closure $callback = null) |
|
542
|
|
|
{ |
|
543
|
1 |
|
$this->destroy = $callback; |
|
544
|
|
|
|
|
545
|
1 |
|
return $this; |
|
546
|
|
|
} |
|
547
|
|
|
|
|
548
|
|
|
/** |
|
549
|
|
|
* @param int|string $id |
|
550
|
|
|
* |
|
551
|
|
|
* @return mixed |
|
552
|
|
|
*/ |
|
553
|
1 |
|
public function fireDestroy($id) |
|
554
|
|
|
{ |
|
555
|
1 |
|
if (is_callable($this->getDestroy())) { |
|
556
|
1 |
|
return $this->app->call($this->getDestroy(), [$id]); |
|
557
|
|
|
} |
|
558
|
|
|
} |
|
559
|
|
|
|
|
560
|
|
|
/** |
|
561
|
|
|
* @return Closure|null |
|
562
|
|
|
*/ |
|
563
|
1 |
|
public function getRestore() |
|
564
|
|
|
{ |
|
565
|
1 |
|
return $this->restore; |
|
566
|
|
|
} |
|
567
|
|
|
|
|
568
|
|
|
/** |
|
569
|
|
|
* @param Closure|null $callback |
|
570
|
|
|
* |
|
571
|
|
|
* @return $this |
|
572
|
|
|
*/ |
|
573
|
1 |
|
public function onRestore(Closure $callback = null) |
|
574
|
|
|
{ |
|
575
|
1 |
|
$this->restore = $callback; |
|
576
|
|
|
|
|
577
|
1 |
|
return $this; |
|
578
|
|
|
} |
|
579
|
|
|
|
|
580
|
|
|
/** |
|
581
|
|
|
* @param int|string $id |
|
582
|
|
|
* |
|
583
|
|
|
* @return bool|mixed |
|
584
|
|
|
*/ |
|
585
|
1 |
|
public function fireRestore($id) |
|
586
|
|
|
{ |
|
587
|
1 |
|
if (is_callable($this->getRestore())) { |
|
588
|
1 |
|
return $this->app->call($this->getRestore(), [$id]); |
|
589
|
|
|
} |
|
590
|
|
|
} |
|
591
|
|
|
|
|
592
|
|
|
/** |
|
593
|
|
|
* @return string |
|
594
|
|
|
*/ |
|
595
|
1 |
|
public function getMessageOnCreate() |
|
596
|
|
|
{ |
|
597
|
1 |
|
if (is_null($this->messageOnCreate)) { |
|
598
|
1 |
|
$this->messageOnCreate = parent::getMessageOnCreate(); |
|
|
|
|
|
|
599
|
1 |
|
} |
|
600
|
|
|
|
|
601
|
1 |
|
return $this->messageOnCreate; |
|
|
|
|
|
|
602
|
|
|
} |
|
603
|
|
|
|
|
604
|
|
|
/** |
|
605
|
|
|
* @param string $messageOnCreate |
|
606
|
|
|
* |
|
607
|
|
|
* @return $this |
|
608
|
|
|
*/ |
|
609
|
1 |
|
public function setMessageOnCreate($messageOnCreate) |
|
610
|
|
|
{ |
|
611
|
1 |
|
$this->messageOnCreate = $messageOnCreate; |
|
612
|
|
|
|
|
613
|
1 |
|
return $this; |
|
614
|
|
|
} |
|
615
|
|
|
|
|
616
|
|
|
/** |
|
617
|
|
|
* @return string |
|
618
|
|
|
*/ |
|
619
|
1 |
|
public function getMessageOnUpdate() |
|
620
|
|
|
{ |
|
621
|
1 |
|
if (is_null($this->messageOnUpdate)) { |
|
622
|
1 |
|
$this->messageOnUpdate = parent::getMessageOnUpdate(); |
|
|
|
|
|
|
623
|
1 |
|
} |
|
624
|
|
|
|
|
625
|
1 |
|
return $this->messageOnUpdate; |
|
|
|
|
|
|
626
|
|
|
} |
|
627
|
|
|
|
|
628
|
|
|
/** |
|
629
|
|
|
* @param string $messageOnUpdate |
|
630
|
|
|
* |
|
631
|
|
|
* @return $this |
|
632
|
|
|
*/ |
|
633
|
1 |
|
public function setMessageOnUpdate($messageOnUpdate) |
|
634
|
|
|
{ |
|
635
|
1 |
|
$this->messageOnUpdate = $messageOnUpdate; |
|
636
|
|
|
|
|
637
|
1 |
|
return $this; |
|
638
|
|
|
} |
|
639
|
|
|
|
|
640
|
|
|
/** |
|
641
|
|
|
* @return string |
|
642
|
|
|
*/ |
|
643
|
1 |
|
public function getMessageOnDelete() |
|
644
|
|
|
{ |
|
645
|
1 |
|
if (is_null($this->messageOnDelete)) { |
|
646
|
1 |
|
$this->messageOnDelete = parent::getMessageOnDelete(); |
|
|
|
|
|
|
647
|
1 |
|
} |
|
648
|
|
|
|
|
649
|
1 |
|
return $this->messageOnDelete; |
|
|
|
|
|
|
650
|
|
|
} |
|
651
|
|
|
|
|
652
|
|
|
/** |
|
653
|
|
|
* @param string $messageOnDelete |
|
654
|
|
|
* |
|
655
|
|
|
* @return $this |
|
656
|
|
|
*/ |
|
657
|
1 |
|
public function setMessageOnDelete($messageOnDelete) |
|
658
|
|
|
{ |
|
659
|
1 |
|
$this->messageOnDelete = $messageOnDelete; |
|
660
|
|
|
|
|
661
|
1 |
|
return $this; |
|
662
|
|
|
} |
|
663
|
|
|
|
|
664
|
|
|
/** |
|
665
|
|
|
* @return string |
|
666
|
|
|
*/ |
|
667
|
1 |
|
public function getMessageOnDestroy() |
|
668
|
|
|
{ |
|
669
|
1 |
|
if (is_null($this->messageOnDestroy)) { |
|
670
|
1 |
|
$this->messageOnDestroy = parent::getMessageOnDestroy(); |
|
|
|
|
|
|
671
|
1 |
|
} |
|
672
|
|
|
|
|
673
|
1 |
|
return $this->messageOnDestroy; |
|
|
|
|
|
|
674
|
|
|
} |
|
675
|
|
|
|
|
676
|
|
|
/** |
|
677
|
|
|
* @param string $messageOnDestroy |
|
678
|
|
|
* |
|
679
|
|
|
* @return $this |
|
680
|
|
|
*/ |
|
681
|
1 |
|
public function setMessageOnDestroy($messageOnDestroy) |
|
682
|
|
|
{ |
|
683
|
1 |
|
$this->messageOnDestroy = $messageOnDestroy; |
|
684
|
|
|
|
|
685
|
1 |
|
return $this; |
|
686
|
|
|
} |
|
687
|
|
|
|
|
688
|
|
|
/** |
|
689
|
|
|
* @return string |
|
690
|
|
|
*/ |
|
691
|
1 |
|
public function getMessageOnRestore() |
|
692
|
|
|
{ |
|
693
|
1 |
|
if (is_null($this->messageOnRestore)) { |
|
694
|
1 |
|
$this->messageOnRestore = parent::getMessageOnRestore(); |
|
|
|
|
|
|
695
|
1 |
|
} |
|
696
|
|
|
|
|
697
|
1 |
|
return $this->messageOnRestore; |
|
|
|
|
|
|
698
|
|
|
} |
|
699
|
|
|
|
|
700
|
|
|
/** |
|
701
|
|
|
* @param string $messageOnRestore |
|
702
|
|
|
* |
|
703
|
|
|
* @return $this |
|
704
|
|
|
*/ |
|
705
|
1 |
|
public function setMessageOnRestore($messageOnRestore) |
|
706
|
|
|
{ |
|
707
|
1 |
|
$this->messageOnRestore = $messageOnRestore; |
|
708
|
|
|
|
|
709
|
1 |
|
return $this; |
|
710
|
|
|
} |
|
711
|
|
|
} |
|
712
|
|
|
|