@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @var DatastoreRepository |
19 | 19 | */ |
20 | - protected $datastoreRepository; |
|
21 | - |
|
22 | - /** |
|
23 | - * UserController constructor. |
|
24 | - * |
|
25 | - * @param DatastoreRepository $datastoreRepository |
|
26 | - */ |
|
27 | - public function __construct(DatastoreRepository $datastoreRepository) |
|
28 | - { |
|
29 | - $this->datastoreRepository = $datastoreRepository; |
|
20 | + protected $datastoreRepository; |
|
21 | + |
|
22 | + /** |
|
23 | + * UserController constructor. |
|
24 | + * |
|
25 | + * @param DatastoreRepository $datastoreRepository |
|
26 | + */ |
|
27 | + public function __construct(DatastoreRepository $datastoreRepository) |
|
28 | + { |
|
29 | + $this->datastoreRepository = $datastoreRepository; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | protected function iCan($permission, $then, $else){ |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | $this->datastoreRepository->paginateSearchProp('author', $author_id, Phpsa\Datastore\Ams\Article\ItemAsset::class, $this->canViewAll('published')); |
76 | 76 | } |
77 | 77 | |
78 | - public function ___tests() |
|
79 | - { |
|
78 | + public function ___tests() |
|
79 | + { |
|
80 | 80 | |
81 | 81 | //ok we need a list of objects we can usse:: |
82 | 82 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $tester = Datastore::getAsset(ContentAsset::class); |
89 | 89 | |
90 | 90 | $tester->prop('title', 'Moe Title'); |
91 | - $tester->prop('content', '<p>Rhoncus hac aliquam aliquam! Et mauris, et quis platea ut elementum natoque sit natoque lectus augue integer aliquam porta rhoncus nec, cursus diam a parturient augue ut! Tincidunt eros urna lacus lorem, sit scelerisque. Proin duis auctor ut. Turpis? Sed, diam elit sed velit dapibus phasellus, pulvinar mattis! Sociis augue in parturient sed ultricies et.</p>'); |
|
91 | + $tester->prop('content', '<p>Rhoncus hac aliquam aliquam! Et mauris, et quis platea ut elementum natoque sit natoque lectus augue integer aliquam porta rhoncus nec, cursus diam a parturient augue ut! Tincidunt eros urna lacus lorem, sit scelerisque. Proin duis auctor ut. Turpis? Sed, diam elit sed velit dapibus phasellus, pulvinar mattis! Sociis augue in parturient sed ultricies et.</p>'); |
|
92 | 92 | $tester->prop('status', 'published'); |
93 | 93 | |
94 | 94 | //echo '<pre>$tester->val(): '; print_r($tester->val()); echo '</pre>'; die(); |
@@ -29,31 +29,31 @@ discard block |
||
29 | 29 | $this->datastoreRepository = $datastoreRepository; |
30 | 30 | } |
31 | 31 | |
32 | - protected function iCan($permission, $then, $else){ |
|
32 | + protected function iCan($permission, $then, $else) { |
|
33 | 33 | $user = auth()->user(); |
34 | 34 | return $user && $user->can($permission) ? $then : $else; |
35 | 35 | } |
36 | 36 | |
37 | - protected function canViewAll($status = 'published'){ |
|
38 | - return $this->iCan('manage datastore', null , $status); |
|
37 | + protected function canViewAll($status = 'published') { |
|
38 | + return $this->iCan('manage datastore', null, $status); |
|
39 | 39 | } |
40 | 40 | |
41 | - protected function getPageBySlug($slug){ |
|
41 | + protected function getPageBySlug($slug) { |
|
42 | 42 | $page = DatastorePages::where('slug', $slug)->first(); |
43 | - if(!$page){ |
|
43 | + if (!$page) { |
|
44 | 44 | abort(404); |
45 | 45 | } |
46 | 46 | |
47 | 47 | $datastore = $page->datastore; |
48 | 48 | $user = auth()->user(); |
49 | 49 | |
50 | - if(!$datastore->statusIsActive() && (!$user || !$user->can('manage datastore'))) { |
|
50 | + if (!$datastore->statusIsActive() && (!$user || !$user->can('manage datastore'))) { |
|
51 | 51 | abort(404); |
52 | 52 | } |
53 | 53 | return $page; |
54 | 54 | } |
55 | 55 | |
56 | - public function page($slug){ |
|
56 | + public function page($slug) { |
|
57 | 57 | |
58 | 58 | $page = $this->getPageBySlug($slug); |
59 | 59 | |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | |
68 | 68 | } |
69 | 69 | |
70 | - public function childPage($parent_slug, $slug){ |
|
70 | + public function childPage($parent_slug, $slug) { |
|
71 | 71 | return $this->page($slug); |
72 | 72 | } |
73 | 73 | |
74 | - public function articleByAuthor($author_id, $slug){ |
|
74 | + public function articleByAuthor($author_id, $slug) { |
|
75 | 75 | $this->datastoreRepository->paginateSearchProp('author', $author_id, Phpsa\Datastore\Ams\Article\ItemAsset::class, $this->canViewAll('published')); |
76 | 76 | } |
77 | 77 |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @var DatastoreRepository |
28 | 28 | */ |
29 | - protected $datastoreRepository; |
|
29 | + protected $datastoreRepository; |
|
30 | 30 | |
31 | - /** |
|
32 | - * UserController constructor. |
|
33 | - * |
|
34 | - * @param DatastoreRepository $datastoreRepository |
|
35 | - */ |
|
36 | - public function __construct(DatastoreRepository $datastoreRepository) |
|
37 | - { |
|
38 | - $this->datastoreRepository = $datastoreRepository; |
|
39 | - } |
|
31 | + /** |
|
32 | + * UserController constructor. |
|
33 | + * |
|
34 | + * @param DatastoreRepository $datastoreRepository |
|
35 | + */ |
|
36 | + public function __construct(DatastoreRepository $datastoreRepository) |
|
37 | + { |
|
38 | + $this->datastoreRepository = $datastoreRepository; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | public function file(Request $request) { |
332 | 332 | $this->validate($request, [ |
333 | - 'file' => 'required' |
|
333 | + 'file' => 'required' |
|
334 | 334 | ]); |
335 | 335 | |
336 | 336 | $originalFile= $request->file('file'); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | public function image(Request $request) { |
349 | 349 | $this->validate($request, [ |
350 | - 'file' => 'image|required|mimes:jpeg,png,jpg,gif,svg' |
|
350 | + 'file' => 'image|required|mimes:jpeg,png,jpg,gif,svg' |
|
351 | 351 | ]); |
352 | 352 | |
353 | 353 | $originalImage= $request->file('file'); |
@@ -403,35 +403,35 @@ discard block |
||
403 | 403 | $term = $request->input('term'); |
404 | 404 | $q = $request->input('q'); |
405 | 405 | |
406 | - if ($term) { |
|
407 | - $vars = array(); |
|
408 | - $type = null; |
|
406 | + if ($term) { |
|
407 | + $vars = array(); |
|
408 | + $type = null; |
|
409 | 409 | |
410 | - //determine what to look for |
|
411 | - switch ($q) { |
|
412 | - case "checkbox": |
|
413 | - $type = \Phpsa\CamsGallery\Ams\Gallery\ImageAsset::class; |
|
414 | - break; |
|
410 | + //determine what to look for |
|
411 | + switch ($q) { |
|
412 | + case "checkbox": |
|
413 | + $type = \Phpsa\CamsGallery\Ams\Gallery\ImageAsset::class; |
|
414 | + break; |
|
415 | 415 | |
416 | - case "radio": |
|
417 | - $type = Phpsa\Datastore\Ams\BooleanAsset::class; |
|
418 | - break; |
|
416 | + case "radio": |
|
417 | + $type = Phpsa\Datastore\Ams\BooleanAsset::class; |
|
418 | + break; |
|
419 | 419 | |
420 | - case "textfield": |
|
421 | - $type = Phpsa\Datastore\Ams\BooleanAsset::class; |
|
422 | - break; |
|
420 | + case "textfield": |
|
421 | + $type = Phpsa\Datastore\Ams\BooleanAsset::class; |
|
422 | + break; |
|
423 | 423 | |
424 | - case "textarea": |
|
425 | - $type = Phpsa\Datastore\Ams\BooleanAsset::class; |
|
426 | - break; |
|
424 | + case "textarea": |
|
425 | + $type = Phpsa\Datastore\Ams\BooleanAsset::class; |
|
426 | + break; |
|
427 | 427 | |
428 | - case "fieldset": |
|
429 | - $type = Phpsa\Datastore\Ams\BooleanAsset::class; |
|
430 | - break; |
|
428 | + case "fieldset": |
|
429 | + $type = Phpsa\Datastore\Ams\BooleanAsset::class; |
|
430 | + break; |
|
431 | 431 | |
432 | - default: |
|
433 | - return false; |
|
434 | - } |
|
432 | + default: |
|
433 | + return false; |
|
434 | + } |
|
435 | 435 | |
436 | 436 | |
437 | 437 | $query = DatastoreModel::where('value','like','%' . $term . '%') |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | $data = db::getAll($sql, $vars); |
455 | 455 | echo json_encode($data); |
456 | 456 | exit;*/ |
457 | - } |
|
458 | - return response()->json( []); |
|
459 | - } |
|
457 | + } |
|
458 | + return response()->json( []); |
|
459 | + } |
|
460 | 460 | |
461 | 461 | } |
@@ -45,31 +45,31 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
47 | 47 | */ |
48 | - public function list($asset,Request $request){ |
|
48 | + public function list($asset, Request $request){ |
|
49 | 49 | |
50 | 50 | $assetData = Helpers::parseAssetType($asset); |
51 | 51 | |
52 | 52 | return view('phpsa-datastore::backend.ams.list') |
53 | 53 | ->withAsset($assetData) |
54 | 54 | ->withAssetType($asset) |
55 | - ->withContent($this->datastoreRepository->paginateAssets($assetData, 25, 'page' )); |
|
55 | + ->withContent($this->datastoreRepository->paginateAssets($assetData, 25, 'page')); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
59 | - public function inject(Request $request){ |
|
59 | + public function inject(Request $request) { |
|
60 | 60 | $assetData = Helpers::parseAssetType($request->input('asset'), true); |
61 | 61 | $newAsset = Datastore::getAsset($assetData); |
62 | 62 | return response($newAsset->injectForm($request->input('idx'))); |
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | - protected function _getKids($asset){ |
|
66 | + protected function _getKids($asset) { |
|
67 | 67 | $children = []; |
68 | - if ( ! empty($asset->children)) |
|
68 | + if (!empty($asset->children)) |
|
69 | 69 | { |
70 | - $children = Helpers::assetInfo($asset->children); |
|
71 | - $children['classname'] = $asset->children; |
|
72 | - $children['path'] = Helpers::getPath($asset->children); |
|
70 | + $children = Helpers::assetInfo($asset->children); |
|
71 | + $children['classname'] = $asset->children; |
|
72 | + $children['path'] = Helpers::getPath($asset->children); |
|
73 | 73 | |
74 | 74 | $kids = $asset->children(); |
75 | 75 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return $children; |
84 | 84 | } |
85 | 85 | |
86 | - protected function _getParents($asset){ |
|
86 | + protected function _getParents($asset) { |
|
87 | 87 | |
88 | 88 | $type = str_replace('\\', "\\\\", $asset->type); |
89 | 89 | $parentAssets = $this->datastoreRepository->where('accept', '%' . $type . '%', 'like')->distinct()->get(['type', 'name', 'accept_limit'])->toArray(); |
@@ -118,19 +118,19 @@ discard block |
||
118 | 118 | return $parentAssets; |
119 | 119 | } |
120 | 120 | |
121 | - protected function _getPageData($asset){ |
|
122 | - return ($asset->is_child || !$asset->id )? null : DatastorePages::where('asset', $asset->id)->first(); |
|
121 | + protected function _getPageData($asset) { |
|
122 | + return ($asset->is_child || !$asset->id) ? null : DatastorePages::where('asset', $asset->id)->first(); |
|
123 | 123 | } |
124 | 124 | |
125 | - public function create($assetType, Request $request){ |
|
125 | + public function create($assetType, Request $request) { |
|
126 | 126 | |
127 | 127 | |
128 | 128 | $assetData = Helpers::parseAssetType($assetType, true); |
129 | 129 | $newAsset = Datastore::getAsset($assetData); |
130 | 130 | |
131 | - if($newAsset->max_instances > 0){ |
|
131 | + if ($newAsset->max_instances > 0) { |
|
132 | 132 | $count = DatastoreModel::where('type', $assetData)->count(); |
133 | - if($count >= $newAsset->max_instances){ |
|
133 | + if ($count >= $newAsset->max_instances) { |
|
134 | 134 | return redirect()->route('admin.ams.content.list', $assetType)->withFlashDanger("You can only create " . $newAsset->max_instances . " instances of this Asset"); |
135 | 135 | } |
136 | 136 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | ->withPageData($pageData); |
148 | 148 | } |
149 | 149 | |
150 | - public function edit($assetType, $id){ |
|
150 | + public function edit($assetType, $id) { |
|
151 | 151 | |
152 | 152 | $asset = Datastore::getAssetById($id); |
153 | 153 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | ->withPageData($pageData); |
164 | 164 | } |
165 | 165 | |
166 | - public function save($assetType , Request $request){ |
|
166 | + public function save($assetType, Request $request) { |
|
167 | 167 | |
168 | 168 | |
169 | 169 | $assetData = Helpers::parseAssetType($assetType, true); |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | unset($form['assetRemove']); |
176 | 176 | |
177 | 177 | |
178 | - $form_valid = $newAsset->validate($form); |
|
179 | - if(!$form_valid){ |
|
178 | + $form_valid = $newAsset->validate($form); |
|
179 | + if (!$form_valid) { |
|
180 | 180 | die("@TODO STILL"); |
181 | 181 | } |
182 | 182 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
278 | - if(!empty($form['page_title']) && !empty($form['page_slug'])){ |
|
278 | + if (!empty($form['page_title']) && !empty($form['page_slug'])) { |
|
279 | 279 | $pageData = DatastorePages::firstOrNew(['asset' => $id]); |
280 | 280 | $pageData->title = $form['page_title']; |
281 | 281 | $pageData->slug = $form['page_slug']; |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | |
292 | - public function destroy($id, Request $request){ |
|
292 | + public function destroy($id, Request $request) { |
|
293 | 293 | $asset = DatastoreModel::findOrFail($id); |
294 | - if(!$asset || $asset->namespace !== 'asset'){ |
|
294 | + if (!$asset || $asset->namespace !== 'asset') { |
|
295 | 295 | throw new GeneralException("NOT FOUND"); |
296 | 296 | } |
297 | 297 | $path = $asset->content_path; |
@@ -306,24 +306,24 @@ discard block |
||
306 | 306 | { |
307 | 307 | DB::enableQueryLog(); |
308 | 308 | |
309 | - $slug = $request->input('page_slug'); |
|
310 | - $id = (int)$request->input('id'); |
|
309 | + $slug = $request->input('page_slug'); |
|
310 | + $id = (int) $request->input('id'); |
|
311 | 311 | $generate = $request->input('generate'); |
312 | 312 | |
313 | 313 | |
314 | - if($generate){ |
|
314 | + if ($generate) { |
|
315 | 315 | $slug = Str::slug($slug); |
316 | 316 | } |
317 | 317 | |
318 | 318 | $exists = DatastorePages::where('slug', $slug)->where('asset', '!=', $id)->exists(); |
319 | 319 | |
320 | - if($generate){ |
|
320 | + if ($generate) { |
|
321 | 321 | return response()->json([ |
322 | 322 | 'slug' => $slug, |
323 | 323 | 'available' => $exists ? 0 : 1 |
324 | 324 | ]); |
325 | 325 | } |
326 | - return response()->json($exists ? "Slug already in use": true); |
|
326 | + return response()->json($exists ? "Slug already in use" : true); |
|
327 | 327 | |
328 | 328 | |
329 | 329 | } |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | 'file' => 'required' |
334 | 334 | ]); |
335 | 335 | |
336 | - $originalFile= $request->file('file'); |
|
336 | + $originalFile = $request->file('file'); |
|
337 | 337 | |
338 | 338 | $t = time(); |
339 | - $filename = Str::slug($t.$originalFile->getClientOriginalName(),"."); |
|
339 | + $filename = Str::slug($t . $originalFile->getClientOriginalName(), "."); |
|
340 | 340 | |
341 | 341 | $path = $request->file('file')->storeAs( |
342 | 342 | 'public', $filename |
@@ -350,26 +350,26 @@ discard block |
||
350 | 350 | 'file' => 'image|required|mimes:jpeg,png,jpg,gif,svg' |
351 | 351 | ]); |
352 | 352 | |
353 | - $originalImage= $request->file('file'); |
|
353 | + $originalImage = $request->file('file'); |
|
354 | 354 | |
355 | 355 | $t = time(); |
356 | - $filename = Str::slug($t.$originalImage->getClientOriginalName(),"."); |
|
356 | + $filename = Str::slug($t . $originalImage->getClientOriginalName(), "."); |
|
357 | 357 | |
358 | 358 | |
359 | - if(!is_dir(public_path().'/vendor/phpsa-datastore/thumbs')){ |
|
360 | - mkdir(public_path().'/vendor/phpsa-datastore/thumbs', 0755, true); |
|
359 | + if (!is_dir(public_path() . '/vendor/phpsa-datastore/thumbs')) { |
|
360 | + mkdir(public_path() . '/vendor/phpsa-datastore/thumbs', 0755, true); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
364 | 364 | $thumbnailImage = Image::make($originalImage); |
365 | - $thumbnailPath = public_path().'/vendor/phpsa-datastore/img/'; |
|
366 | - $originalPath = public_path().'/vendor/phpsa-datastore/thumbs/'; |
|
367 | - $thumbnailImage->save($originalPath.$filename); |
|
365 | + $thumbnailPath = public_path() . '/vendor/phpsa-datastore/img/'; |
|
366 | + $originalPath = public_path() . '/vendor/phpsa-datastore/thumbs/'; |
|
367 | + $thumbnailImage->save($originalPath . $filename); |
|
368 | 368 | |
369 | - $thumbnailImage->resize(150,150, function ($constraint) { |
|
369 | + $thumbnailImage->resize(150, 150, function($constraint) { |
|
370 | 370 | $constraint->aspectRatio(); |
371 | 371 | }); |
372 | - $thumbnailImage->save($thumbnailPath.$filename); |
|
372 | + $thumbnailImage->save($thumbnailPath . $filename); |
|
373 | 373 | |
374 | 374 | |
375 | 375 | return response()->json(["file" => $filename]); |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | |
378 | 378 | |
379 | 379 | |
380 | - public function indentityAutocomplete(Request $request){ |
|
380 | + public function indentityAutocomplete(Request $request) { |
|
381 | 381 | $search = urldecode($request->input('q')); |
382 | 382 | $results = []; |
383 | - if( strlen($search) >= 3 ) |
|
383 | + if (strlen($search) >= 3) |
|
384 | 384 | { |
385 | 385 | $userModel = config('auth.providers.users.model'); |
386 | - $records = $userModel::whereRaw("concat_ws(' ', first_name, last_name) like ? ", ["{$search}%"])->limit(10)->get(['id','first_name','last_name']); |
|
387 | - foreach($records as $record) |
|
386 | + $records = $userModel::whereRaw("concat_ws(' ', first_name, last_name) like ? ", ["{$search}%"])->limit(10)->get(['id', 'first_name', 'last_name']); |
|
387 | + foreach ($records as $record) |
|
388 | 388 | { |
389 | 389 | $result = [ |
390 | 390 | 'value' => $record->id, |
@@ -434,13 +434,13 @@ discard block |
||
434 | 434 | } |
435 | 435 | |
436 | 436 | |
437 | - $query = DatastoreModel::where('value','like','%' . $term . '%') |
|
437 | + $query = DatastoreModel::where('value', 'like', '%' . $term . '%') |
|
438 | 438 | ->where('type', $type); |
439 | - if($q == 'fieldset'){ |
|
439 | + if ($q == 'fieldset') { |
|
440 | 440 | $query->order_by('value'); |
441 | 441 | } |
442 | 442 | $data = $query->get(['value as label', 'id as value']); |
443 | - return response()->json($data ); |
|
443 | + return response()->json($data); |
|
444 | 444 | /* |
445 | 445 | //db query |
446 | 446 | if ($q == 'fieldset') { |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | echo json_encode($data); |
456 | 456 | exit;*/ |
457 | 457 | } |
458 | - return response()->json( []); |
|
458 | + return response()->json([]); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | } |
@@ -108,8 +108,7 @@ |
||
108 | 108 | } |
109 | 109 | } |
110 | 110 | $parentAssets[$k]['related'] = $parents; |
111 | - } |
|
112 | - else |
|
111 | + } else |
|
113 | 112 | { |
114 | 113 | $parentAssets[$k]['related'] = false; |
115 | 114 | } |
@@ -9,22 +9,22 @@ |
||
9 | 9 | |
10 | 10 | class CommentsController extends Controller |
11 | 11 | { |
12 | - /** |
|
13 | - * Store a newly created resource in storage. |
|
14 | - * |
|
15 | - * @param \Illuminate\Http\Request $request |
|
16 | - * @return \Illuminate\Http\Response |
|
17 | - */ |
|
18 | - public function store(Request $request) |
|
19 | - { |
|
20 | - $request->validate([ |
|
12 | + /** |
|
13 | + * Store a newly created resource in storage. |
|
14 | + * |
|
15 | + * @param \Illuminate\Http\Request $request |
|
16 | + * @return \Illuminate\Http\Response |
|
17 | + */ |
|
18 | + public function store(Request $request) |
|
19 | + { |
|
20 | + $request->validate([ |
|
21 | 21 | 'body'=>'required', |
22 | 22 | 'datastore_id' => 'required' |
23 | - ]); |
|
24 | - $input = $request->all(); |
|
25 | - $input['user_id'] = auth()->user()->id; |
|
26 | - DatastoreComments::create($input); |
|
27 | - return back(); |
|
28 | - } |
|
23 | + ]); |
|
24 | + $input = $request->all(); |
|
25 | + $input['user_id'] = auth()->user()->id; |
|
26 | + DatastoreComments::create($input); |
|
27 | + return back(); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | $prefix = config("datastore.urlprefix"); |
12 | 12 | |
13 | -Route::group(['namespace' => 'Backend', 'prefix' => 'admin', 'as' => 'admin.ams.', 'middleware' => ['admin', 'permission:manage datastore']], function () { |
|
13 | +Route::group(['namespace' => 'Backend', 'prefix' => 'admin', 'as' => 'admin.ams.', 'middleware' => ['admin', 'permission:manage datastore']], function() { |
|
14 | 14 | Route::get('ams/slug', [AdminController::class, 'slug'])->name('content.slug'); |
15 | 15 | Route::post('ams/file', [AdminController::class, 'file'])->name('content.file'); |
16 | 16 | Route::post('ams/image', [AdminController::class, 'image'])->name('content.image'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | Route::get('/ams/gettypedata', [AdminController::class, 'getTypeData'])->name('content.test.typedata'); |
27 | 27 | }); |
28 | 28 | |
29 | -Route::group(['namespace' => 'Frontend', 'as' => 'frontend.ams.', 'prefix' => $prefix ], function () { |
|
29 | +Route::group(['namespace' => 'Frontend', 'as' => 'frontend.ams.', 'prefix' => $prefix], function() { |
|
30 | 30 | Route::get('{slug}', [DatastoreController::class, 'page'])->name('page.slug'); |
31 | 31 | Route::get('articles/author/{id}-{slug}', [DatastoreController::class, 'articleByAuthor'])->name('article.byauthor'); |
32 | 32 | Route::get('articles/{slug}', [DatastoreController::class, 'page'])->name('article.category'); |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | Breadcrumbs::for('admin.ams.content.list', function ($trail, $asset) { |
4 | - $trail->parent('admin.dashboard'); |
|
4 | + $trail->parent('admin.dashboard'); |
|
5 | 5 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.main'), route('admin.ams.content.list', $asset)); |
6 | 6 | }); |
7 | 7 | |
8 | 8 | Breadcrumbs::for('admin.ams.content.create', function ($trail, $asset) { |
9 | - $trail->parent('admin.dashboard'); |
|
9 | + $trail->parent('admin.dashboard'); |
|
10 | 10 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.main'), route('admin.ams.content.list', $asset)); |
11 | 11 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.create')); |
12 | 12 | }); |
13 | 13 | |
14 | 14 | Breadcrumbs::for('admin.ams.content.update', function ($trail, $asset) { |
15 | - $trail->parent('admin.dashboard'); |
|
15 | + $trail->parent('admin.dashboard'); |
|
16 | 16 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.main'), route('admin.ams.content.list', $asset)); |
17 | 17 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.update')); |
18 | 18 | }); |
19 | 19 | \ No newline at end of file |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -Breadcrumbs::for('admin.ams.content.list', function ($trail, $asset) { |
|
3 | +Breadcrumbs::for ('admin.ams.content.list', function($trail, $asset) { |
|
4 | 4 | $trail->parent('admin.dashboard'); |
5 | 5 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.main'), route('admin.ams.content.list', $asset)); |
6 | 6 | }); |
7 | 7 | |
8 | -Breadcrumbs::for('admin.ams.content.create', function ($trail, $asset) { |
|
8 | +Breadcrumbs::for ('admin.ams.content.create', function($trail, $asset) { |
|
9 | 9 | $trail->parent('admin.dashboard'); |
10 | 10 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.main'), route('admin.ams.content.list', $asset)); |
11 | 11 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.create')); |
12 | 12 | }); |
13 | 13 | |
14 | -Breadcrumbs::for('admin.ams.content.update', function ($trail, $asset) { |
|
14 | +Breadcrumbs::for ('admin.ams.content.update', function($trail, $asset) { |
|
15 | 15 | $trail->parent('admin.dashboard'); |
16 | 16 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.main'), route('admin.ams.content.list', $asset)); |
17 | 17 | $trail->push(__('phpsa-datastore::backend.menus.sidebar.update')); |
@@ -6,8 +6,8 @@ |
||
6 | 6 | |
7 | 7 | class Datastore extends Facade |
8 | 8 | { |
9 | - protected static function getFacadeAccessor() |
|
10 | - { |
|
11 | - return 'datastore'; |
|
12 | - } |
|
9 | + protected static function getFacadeAccessor() |
|
10 | + { |
|
11 | + return 'datastore'; |
|
12 | + } |
|
13 | 13 | } |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | |
10 | 10 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
11 | 11 | { |
12 | - const CONFIG_PATH = __DIR__ . '/../config/datastore.php'; |
|
12 | + const CONFIG_PATH = __DIR__ . '/../config/datastore.php'; |
|
13 | 13 | |
14 | - public function boot() |
|
15 | - { |
|
14 | + public function boot() |
|
15 | + { |
|
16 | 16 | // publish our pacakge |
17 | - $this->publishes([ |
|
18 | - self::CONFIG_PATH => config_path('datastore.php'), |
|
17 | + $this->publishes([ |
|
18 | + self::CONFIG_PATH => config_path('datastore.php'), |
|
19 | 19 | ], 'config'); |
20 | 20 | |
21 | 21 | //set our migratinos directory |
@@ -43,17 +43,17 @@ discard block |
||
43 | 43 | ]); |
44 | 44 | |
45 | 45 | $this->registerBladeHelpers(); |
46 | - } |
|
46 | + } |
|
47 | 47 | |
48 | - public function register() |
|
49 | - { |
|
50 | - $this->mergeConfigFrom( |
|
51 | - self::CONFIG_PATH, |
|
52 | - 'datastore' |
|
53 | - ); |
|
48 | + public function register() |
|
49 | + { |
|
50 | + $this->mergeConfigFrom( |
|
51 | + self::CONFIG_PATH, |
|
52 | + 'datastore' |
|
53 | + ); |
|
54 | 54 | |
55 | - $this->app->bind('datastore', function () { |
|
56 | - return new Datastore(); |
|
55 | + $this->app->bind('datastore', function () { |
|
56 | + return new Datastore(); |
|
57 | 57 | }); |
58 | 58 | |
59 | 59 | $this->loadViewsFrom(__DIR__.'/views', 'phpsa-datastore'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | public function registerBladeHelpers(){ |
64 | 64 | Blade::directive('datastoreAssetList', function ($grouped = false) { |
65 | - return Helpers::getAssetList($grouped, false); |
|
65 | + return Helpers::getAssetList($grouped, false); |
|
66 | 66 | }); |
67 | 67 | |
68 | 68 | Blade::directive('forDatastores', function () { |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | ], 'config'); |
20 | 20 | |
21 | 21 | //set our migratinos directory |
22 | - $this->loadMigrationsFrom(__DIR__.'/Database/migrations'); |
|
22 | + $this->loadMigrationsFrom(__DIR__ . '/Database/migrations'); |
|
23 | 23 | |
24 | 24 | //Router |
25 | 25 | Route::middleware('web') |
26 | - ->group(__DIR__.'/routes.php'); |
|
26 | + ->group(__DIR__ . '/routes.php'); |
|
27 | 27 | |
28 | 28 | //Breadcrumbs |
29 | 29 | if (class_exists('Breadcrumbs')) { |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | //Translations |
34 | - $this->loadTranslationsFrom(__DIR__.'/translations', 'phpsa-datastore'); |
|
34 | + $this->loadTranslationsFrom(__DIR__ . '/translations', 'phpsa-datastore'); |
|
35 | 35 | |
36 | 36 | $this->publishes([ |
37 | - __DIR__.'/translations' => resource_path('lang/vendor/phpsa-datastore'), |
|
37 | + __DIR__ . '/translations' => resource_path('lang/vendor/phpsa-datastore'), |
|
38 | 38 | // Assets |
39 | - __DIR__.'/resources/js' => public_path('vendor/phpsa-datastore/js'), |
|
40 | - __DIR__.'/resources/css' => public_path('vendor/phpsa-datastore/css'), |
|
41 | - __DIR__.'/resources/img' => public_path('vendor/phpsa-datastore/img'), |
|
42 | - __DIR__.'/resources/thumbs' => public_path('vendor/phpsa-datastore/thumbs'), |
|
39 | + __DIR__ . '/resources/js' => public_path('vendor/phpsa-datastore/js'), |
|
40 | + __DIR__ . '/resources/css' => public_path('vendor/phpsa-datastore/css'), |
|
41 | + __DIR__ . '/resources/img' => public_path('vendor/phpsa-datastore/img'), |
|
42 | + __DIR__ . '/resources/thumbs' => public_path('vendor/phpsa-datastore/thumbs'), |
|
43 | 43 | ]); |
44 | 44 | |
45 | 45 | $this->registerBladeHelpers(); |
@@ -52,24 +52,24 @@ discard block |
||
52 | 52 | 'datastore' |
53 | 53 | ); |
54 | 54 | |
55 | - $this->app->bind('datastore', function () { |
|
55 | + $this->app->bind('datastore', function() { |
|
56 | 56 | return new Datastore(); |
57 | 57 | }); |
58 | 58 | |
59 | - $this->loadViewsFrom(__DIR__.'/views', 'phpsa-datastore'); |
|
59 | + $this->loadViewsFrom(__DIR__ . '/views', 'phpsa-datastore'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | - public function registerBladeHelpers(){ |
|
64 | - Blade::directive('datastoreAssetList', function ($grouped = false) { |
|
63 | + public function registerBladeHelpers() { |
|
64 | + Blade::directive('datastoreAssetList', function($grouped = false) { |
|
65 | 65 | return Helpers::getAssetList($grouped, false); |
66 | 66 | }); |
67 | 67 | |
68 | - Blade::directive('forDatastores', function () { |
|
68 | + Blade::directive('forDatastores', function() { |
|
69 | 69 | return "<?php foreach(Phpsa\Datastore\Helpers::getAssetList(1, 0) as \$datastoreKey => \$datastoreData): ?>"; |
70 | 70 | }); |
71 | 71 | |
72 | - Blade::directive('endforDatastores', function () { |
|
72 | + Blade::directive('endforDatastores', function() { |
|
73 | 73 | return "<?php endforeach; ?>"; |
74 | 74 | }); |
75 | 75 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | - $src = $params['assetClass']::getImageUrl($value, !empty($params['width']) ? $params['width']: null,!empty($params['height']) ? $params['height']: null); |
|
2 | + $src = $params['assetClass']::getImageUrl($value, !empty($params['width']) ? $params['width'] : null, !empty($params['height']) ? $params['height'] : null); |
|
3 | 3 | $image = html()->img()->src($src); |
4 | - foreach(['id','class','onError','alt','title'] as $prop){ |
|
5 | - if(!empty($params[$prop])){ |
|
4 | + foreach (['id', 'class', 'onError', 'alt', 'title'] as $prop) { |
|
5 | + if (!empty($params[$prop])) { |
|
6 | 6 | $image = $image->attribute($prop, $params[$prop]); |
7 | 7 | } |
8 | 8 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | @foreach ($datastoreData as $ksk => $dsa) |
27 | 27 | <?php |
28 | - $link = strtolower($datastoreKey ? $datastoreKey .'.' . $ksk : $ksk); |
|
28 | + $link = strtolower($datastoreKey ? $datastoreKey . '.' . $ksk : $ksk); |
|
29 | 29 | $route = 'admin.ams.content.list'; |
30 | 30 | |
31 | 31 | ?> |