@@ -21,16 +21,16 @@ |
||
21 | 21 | $referenceStrings = []; |
22 | 22 | } |
23 | 23 | |
24 | - return (new Collection($referenceStrings))->reject(function ($referenceString) { |
|
24 | + return (new Collection($referenceStrings))->reject(function($referenceString) { |
|
25 | 25 | return is_null($referenceString); |
26 | - })->map(function ($referenceString) { |
|
26 | + })->map(function($referenceString) { |
|
27 | 27 | return ModelReference::fromString($referenceString)->instance(); |
28 | 28 | }); |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function toModelReferences(): Collection |
32 | 32 | { |
33 | - return (new Collection($this->all()))->map(function (ReferableModel $item) { |
|
33 | + return (new Collection($this->all()))->map(function(ReferableModel $item) { |
|
34 | 34 | return $item->modelReference()->get(); |
35 | 35 | }); |
36 | 36 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $cachableParameters = $this->convertToCachableParameters($parameters); |
21 | 21 | |
22 | - $cachekey = $this->baseKey . ':' . md5(implode('', $cachableParameters)); |
|
22 | + $cachekey = $this->baseKey.':'.md5(implode('', $cachableParameters)); |
|
23 | 23 | |
24 | 24 | if (isset(static::$cache[$cachekey])) { |
25 | 25 | return static::$cache[$cachekey]; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | foreach ($parameters as $key => $value) { |
39 | 39 | if ($value instanceof Model) { |
40 | - $parameters[$key] = get_class($value) . '@' . $value->id; |
|
40 | + $parameters[$key] = get_class($value).'@'.$value->id; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | public function render(Collection $widgets): string |
14 | 14 | { |
15 | 15 | // Validate each entry as a valid widget object. |
16 | - $widgets->each(function(Widget $widget){}); |
|
16 | + $widgets->each(function(Widget $widget) {}); |
|
17 | 17 | |
18 | 18 | // Init new loop object |
19 | 19 | $this->loopsStack = []; $this->addLoop($widgets); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->incrementLoopIndices(); |
23 | 23 | $loop = $this->getLastLoop(); |
24 | 24 | |
25 | - return $carry . $widget->renderAdminWidget($loop, $widgets); |
|
25 | + return $carry.$widget->renderAdminWidget($loop, $widgets); |
|
26 | 26 | }, ''); |
27 | 27 | } |
28 | 28 | } |
@@ -11,13 +11,13 @@ |
||
11 | 11 | |
12 | 12 | private function __construct(array $widgets) |
13 | 13 | { |
14 | - array_map(function(Widget $widget){}, $widgets); |
|
14 | + array_map(function(Widget $widget) {}, $widgets); |
|
15 | 15 | $this->widgets = $widgets; |
16 | 16 | } |
17 | 17 | |
18 | 18 | public static function fromArray(array $widgetClasses): self |
19 | 19 | { |
20 | - return new static(array_map(function(string $widgetClass){ |
|
20 | + return new static(array_map(function(string $widgetClass) { |
|
21 | 21 | return app($widgetClass); |
22 | 22 | }, $widgetClasses)); |
23 | 23 | } |
@@ -26,15 +26,15 @@ |
||
26 | 26 | { |
27 | 27 | $abilities = ['view', 'create', 'update', 'delete']; |
28 | 28 | |
29 | - return array_map(function ($val) use ($scope) { |
|
30 | - return $val . '-' . $scope; |
|
29 | + return array_map(function($val) use ($scope) { |
|
30 | + return $val.'-'.$scope; |
|
31 | 31 | }, $abilities); |
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function getPermissionsForIndex() |
35 | 35 | { |
36 | 36 | $permissions = $temp = []; |
37 | - self::all()->each(function ($permission) use (&$permissions, &$temp) { |
|
37 | + self::all()->each(function($permission) use (&$permissions, &$temp) { |
|
38 | 38 | $model = explode("_", $permission->name, 2)[1]; |
39 | 39 | $temp[$model][$permission->id] = explode("_", $permission->name, 2)[0]; |
40 | 40 | $permissions = $temp; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // Generate all permissions if only scope is passed |
43 | 43 | if (false === strpos($permissionName, '-')) { |
44 | 44 | $cleanPermissionNames = array_merge($cleanPermissionNames, Permission::generate($permissionName)); |
45 | - } else { |
|
45 | + }else { |
|
46 | 46 | // Trim the value |
47 | 47 | $cleanPermissionNames[] = $permissionName; |
48 | 48 | } |
@@ -55,6 +55,6 @@ discard block |
||
55 | 55 | $role->givePermissionTo($cleanPermissionName); |
56 | 56 | } |
57 | 57 | |
58 | - $this->info('Role ' . $role->name . ' was assigned the permissions: ' . implode(',', $cleanPermissionNames)); |
|
58 | + $this->info('Role '.$role->name.' was assigned the permissions: '.implode(',', $cleanPermissionNames)); |
|
59 | 59 | } |
60 | 60 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | Permission::findOrCreate($permission, 'chief'); |
40 | 40 | } |
41 | 41 | |
42 | - $this->info('Permissions ' . implode(', ', $permissions) . ' created.'); |
|
42 | + $this->info('Permissions '.implode(', ', $permissions).' created.'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | foreach ($roleNames as $roleName) { |
57 | 57 | if ($role = Role::where('name', trim($roleName))->first()) { |
58 | 58 | $role->syncPermissions($permissions); |
59 | - $this->info('Role ' . $roleName . ' assigned the given permissions.'); |
|
60 | - } else { |
|
61 | - $this->warn('Role not found by name ' . $roleName . '!'); |
|
59 | + $this->info('Role '.$roleName.' assigned the given permissions.'); |
|
60 | + }else { |
|
61 | + $this->warn('Role not found by name '.$roleName.'!'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public static function rolesForSelect($includeDeveloperRole = false) |
20 | 20 | { |
21 | - $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function ($role) { |
|
21 | + $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function($role) { |
|
22 | 22 | return $role->name == 'developer'; |
23 | 23 | }); |
24 | 24 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function getPermissionsForIndex() |
41 | 41 | { |
42 | - $this->permissions->each(function ($permission) { |
|
42 | + $this->permissions->each(function($permission) { |
|
43 | 43 | $model = explode("_", $permission->name, 2)[1]; |
44 | 44 | $temp = $this->permission; |
45 | 45 | $temp[$model][] = explode("_", $permission->name, 2)[0]; |
@@ -22,24 +22,24 @@ |
||
22 | 22 | public function handle(Request $request) |
23 | 23 | { |
24 | 24 | // Strict protection enabled: we won't remove assets who are still being used... |
25 | - $assetIds = collect($request->input('asset_ids', []))->reject(function($assetId){ |
|
25 | + $assetIds = collect($request->input('asset_ids', []))->reject(function($assetId) { |
|
26 | 26 | return DB::table('asset_pivots') |
27 | 27 | ->where('asset_id', $assetId) |
28 | 28 | ->where('unused', 0) |
29 | 29 | ->exists(); |
30 | 30 | })->toArray(); |
31 | 31 | |
32 | - if($assetIds) |
|
32 | + if ($assetIds) |
|
33 | 33 | { |
34 | - foreach($assetIds as $k => $assetId) { |
|
35 | - try{ |
|
34 | + foreach ($assetIds as $k => $assetId) { |
|
35 | + try { |
|
36 | 36 | $this->deleteAsset->remove($assetId); |
37 | - } catch(FileNotAccessibleException $e) { |
|
37 | + } catch (FileNotAccessibleException $e) { |
|
38 | 38 | unset($assetIds[$k]); // So our count of removed assets is correct in the log. |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | - Audit::activity()->log('removed ' . count($assetIds) . ' assets from the mediagallery.'); |
|
42 | + Audit::activity()->log('removed '.count($assetIds).' assets from the mediagallery.'); |
|
43 | 43 | |
44 | 44 | return true; |
45 | 45 | } |