-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathArtistRepository.php
76 lines (65 loc) · 2.29 KB
/
ArtistRepository.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace App\Repositories;
use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\Behaviors\HandleSlugs;
use App\Models\Artist;
use App\Repositories\Api\BaseApiRepository;
class ArtistRepository extends BaseApiRepository
{
use HandleSlugs;
use HandleMedias;
public function __construct(Artist $model)
{
$this->model = $model;
}
public function afterSave($object, $fields)
{
$this->updateMultiBrowserApiRelated($object, $fields, 'related_items', [
'articles' => false,
'digitalPublications' => false,
'printedPublications' => false,
'educatorResources' => false,
'videos' => false,
'exhibitions' => true,
'experiences' => false,
]);
$this->updateMultiBrowserApiRelated($object, $fields, 'hidden_related_items', [
'exhibitions' => true,
]);
parent::afterSave($object, $fields);
}
public function getFormFields($object)
{
$fields = parent::getFormFields($object);
$fields['browsers']['related_items'] = $this->getFormFieldsForMultiBrowserApi($object, 'related_items', [
'experiences' => [
'apiModel' => 'App\Models\Experience',
'routePrefix' => 'collection.interactive_features',
'moduleName' => 'experiences',
],
'exhibitions' => [
'apiModel' => 'App\Models\Api\Exhibition',
'routePrefix' => 'exhibitions_events',
'moduleName' => 'exhibitions',
],
], [
'articles' => false,
'digitalPublications' => false,
'printedPublications' => false,
'educatorResources' => false,
'videos' => false,
'exhibitions' => true,
'experiences' => false,
]);
$fields['browsers']['hidden_related_items'] = $this->getFormFieldsForMultiBrowserApi($object, 'hidden_related_items', [
'exhibitions' => [
'apiModel' => 'App\Models\Api\Exhibition',
'routePrefix' => 'exhibitions_events',
'moduleName' => 'exhibitions',
],
], [
'exhibitions' => true,
]);
return $fields;
}
}