@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <div class="row form-group"> |
2 | - <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key'] ; ?> |
|
2 | + <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key']; ?> |
|
3 | 3 | {{ html()->label($data['name'])->class('col-md-2 form-control-label')->for($key) }} |
4 | 4 | <div class="col-md-10"> |
5 | 5 | |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | ->text() |
8 | 8 | ->attribute('id', $key) |
9 | 9 | ->class('form-control'); |
10 | - if($data['required']){ |
|
10 | + if ($data['required']) { |
|
11 | 11 | $input = $input->required(); |
12 | 12 | } |
13 | - if($asset_classname){ |
|
13 | + if ($asset_classname) { |
|
14 | 14 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
15 | - }else{ |
|
15 | + }else { |
|
16 | 16 | $name = $data['key']; |
17 | 17 | } |
18 | 18 | |
19 | - $name .= (isset($multiform) && $multiform) ? '[]' : '';?> |
|
19 | + $name .= (isset($multiform) && $multiform) ? '[]' : ''; ?> |
|
20 | 20 | |
21 | 21 | {{ $input->name($name)->value(old($name, !empty($data['value']) ? $data['value'] : NULL)) }} |
22 | 22 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | } |
14 | 14 | if($asset_classname){ |
15 | 15 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
16 | - }else{ |
|
16 | + } else{ |
|
17 | 17 | $name = $data['key']; |
18 | 18 | } |
19 | 19 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | public static function html($data) :string |
66 | 66 | { |
67 | 67 | return '<img src="' . self::getImageUrl($data['value']) . '" />'; |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | 71 |
@@ -31,24 +31,24 @@ |
||
31 | 31 | */ |
32 | 32 | public static function getImageUrl(string $filename, int $width = null, int $height = null) :string |
33 | 33 | { |
34 | - $imagePath = public_path().'/vendor/phpsa-datastore/'; |
|
34 | + $imagePath = public_path() . '/vendor/phpsa-datastore/'; |
|
35 | 35 | |
36 | 36 | if ($width !== null || $height !== null) { |
37 | - $path = 'thumbs/' . (int) $width . 'x' . (int) $height . '.' . $filename; |
|
37 | + $path = 'thumbs/' . (int) $width . 'x' . (int) $height . '.' . $filename; |
|
38 | 38 | |
39 | - if(!is_file($imagePath . $path)){ |
|
40 | - try{ |
|
39 | + if (!is_file($imagePath . $path)) { |
|
40 | + try { |
|
41 | 41 | Image::make($imagePath . 'img/' . $filename) |
42 | - ->resize($width, $height, function ($constraint) |
|
42 | + ->resize($width, $height, function($constraint) |
|
43 | 43 | { |
44 | 44 | $constraint->aspectRatio(); |
45 | 45 | }) |
46 | 46 | ->save($imagePath . $path); |
47 | - }catch(\Exception $e){ |
|
47 | + }catch (\Exception $e) { |
|
48 | 48 | //Silent fallback as the image does not exist! |
49 | 49 | } |
50 | 50 | } |
51 | - }else{ |
|
51 | + }else { |
|
52 | 52 | $path = 'img/' . $filename; |
53 | 53 | } |
54 | 54 | return '/vendor/phpsa-datastore/' . $path; |
@@ -44,11 +44,11 @@ |
||
44 | 44 | $constraint->aspectRatio(); |
45 | 45 | }) |
46 | 46 | ->save($imagePath . $path); |
47 | - }catch(\Exception $e){ |
|
47 | + } catch(\Exception $e){ |
|
48 | 48 | //Silent fallback as the image does not exist! |
49 | 49 | } |
50 | 50 | } |
51 | - }else{ |
|
51 | + } else{ |
|
52 | 52 | $path = 'img/' . $filename; |
53 | 53 | } |
54 | 54 | return '/vendor/phpsa-datastore/' . $path; |
@@ -17,17 +17,17 @@ |
||
17 | 17 | /** |
18 | 18 | * @var DatastoreRepository |
19 | 19 | */ |
20 | - protected $datastoreRepository; |
|
20 | + protected $datastoreRepository; |
|
21 | 21 | |
22 | - /** |
|
23 | - * UserController constructor. |
|
24 | - * |
|
25 | - * @param DatastoreRepository $datastoreRepository |
|
22 | + /** |
|
23 | + * UserController constructor. |
|
24 | + * |
|
25 | + * @param DatastoreRepository $datastoreRepository |
|
26 | 26 | * @todo get rid of these datastoreRepository and make use of the mode only |
27 | - */ |
|
28 | - public function __construct(DatastoreRepository $datastoreRepository) |
|
29 | - { |
|
30 | - $this->datastoreRepository = $datastoreRepository; |
|
27 | + */ |
|
28 | + public function __construct(DatastoreRepository $datastoreRepository) |
|
29 | + { |
|
30 | + $this->datastoreRepository = $datastoreRepository; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return DatastorePages |
54 | 54 | */ |
55 | - protected function getPageBySlug($slug){ |
|
55 | + protected function getPageBySlug($slug) { |
|
56 | 56 | $page = DatastorePages::where('slug', $slug)->first(); |
57 | - if(!$page){ |
|
57 | + if (!$page) { |
|
58 | 58 | abort(404); |
59 | 59 | } |
60 | 60 | |
61 | 61 | $datastore = $page->datastore; |
62 | 62 | $user = auth()->user(); |
63 | 63 | |
64 | - if(!$datastore->statusIsActive() && (!$user || !$user->can('manage datastore'))) { |
|
64 | + if (!$datastore->statusIsActive() && (!$user || !$user->can('manage datastore'))) { |
|
65 | 65 | abort(404); |
66 | 66 | } |
67 | 67 | return $page; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory |
76 | 76 | */ |
77 | - public function page($slug){ |
|
77 | + public function page($slug) { |
|
78 | 78 | |
79 | 79 | $page = $this->getPageBySlug($slug); |
80 | 80 | |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | } |
90 | 90 | |
91 | - public function childPage($parent_slug, $slug){ |
|
91 | + public function childPage($parent_slug, $slug) { |
|
92 | 92 | return $this->page($slug); |
93 | 93 | } |
94 | 94 | |
95 | - public function articleByAuthor($author_id, $slug){ |
|
95 | + public function articleByAuthor($author_id, $slug) { |
|
96 | 96 | $this->datastoreRepository->paginateSearchProp('author', $author_id, Phpsa\Datastore\Ams\Article\ItemAsset::class, $this->canViewAll('published')); |
97 | 97 | } |
98 | 98 |