@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | 17 | $this->middleware('auth'); |
| 18 | - $this->middleware(function ($request, $next) { |
|
| 18 | + $this->middleware(function($request, $next) { |
|
| 19 | 19 | $this->authorize('hasAccess', 'Manage Equipment'); |
| 20 | 20 | return $next($request); |
| 21 | 21 | }); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | // Store the new category form |
| 36 | 36 | public function store(Request $request) |
| 37 | 37 | { |
| 38 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); |
|
| 38 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); |
|
| 39 | 39 | |
| 40 | 40 | $request->validate([ |
| 41 | 41 | 'name' => 'required|string|unique:system_categories|regex:/^[a-zA-Z0-9_ ]*$/' |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // Submit the Edit Category form |
| 54 | 54 | public function update(Request $request, $id) |
| 55 | 55 | { |
| 56 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); |
|
| 56 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); |
|
| 57 | 57 | |
| 58 | 58 | $request->validate([ |
| 59 | 59 | 'name' => [ |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | // Delete an existing category - note this will fail if the category has systems assigned to it |
| 76 | 76 | public function destroy($id) |
| 77 | 77 | { |
| 78 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 78 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 79 | 79 | |
| 80 | 80 | try { |
| 81 | 81 | SystemCategories::find($id)->delete(); |
| 82 | 82 | Log::notice('Category ID '.$id.' deleted by '.Auth::user()->full_name); |
| 83 | 83 | return response()->json(['success' => true, 'reason' => 'Category Successfully Deleted']); |
| 84 | 84 | } |
| 85 | - catch (\Illuminate\Database\QueryException $e) |
|
| 85 | + catch(\Illuminate\Database\QueryException $e) |
|
| 86 | 86 | { |
| 87 | 87 | Log::warning('User '.Auth::user()->full_name.' tried to delete category ID '.$id.' but was unable to since it is still in use.'); |
| 88 | 88 | return response()->json(['success' => false, 'reason' => 'Category still in use. You must delete all systems attached to this category first.']); |
@@ -77,7 +77,8 @@ |
||
| 77 | 77 | { |
| 78 | 78 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
| 79 | 79 | |
| 80 | - try { |
|
| 80 | + try |
|
| 81 | + { |
|
| 81 | 82 | SystemCategories::find($id)->delete(); |
| 82 | 83 | Log::notice('Category ID '.$id.' deleted by '.Auth::user()->full_name); |
| 83 | 84 | return response()->json(['success' => true, 'reason' => 'Category Successfully Deleted']); |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | // Determine if a user can see the Administration Nav Link |
| 38 | 38 | public function seeAdminLink(User $user) |
| 39 | 39 | { |
| 40 | - if ($this->isInstaller($user)) |
|
| 40 | + if($this->isInstaller($user)) |
|
| 41 | 41 | { |
| 42 | 42 | return true; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $data = UserRolePermissions::with('UserRolePermissionTypes') |
| 46 | - ->whereHas('UserRolePermissionTypes', function ($query) { |
|
| 46 | + ->whereHas('UserRolePermissionTypes', function($query) { |
|
| 47 | 47 | $query->where('description', 'Manage Users') |
| 48 | 48 | ->orWhere('description', 'Manage User Roles') |
| 49 | 49 | ->orWhere('description', 'Manage Customers') |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ->get(); |
| 55 | 55 | |
| 56 | 56 | $allow = $data->isEmpty() ? 'Denied' : 'Allowed'; |
| 57 | - Log::debug('User ' . $user->full_name . ' is trying to see admin link. Result - ' . $allow); |
|
| 57 | + Log::debug('User '.$user->full_name.' is trying to see admin link. Result - '.$allow); |
|
| 58 | 58 | |
| 59 | 59 | return $data->isEmpty() ? false : true; |
| 60 | 60 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $data = UserRolePermissions::with('UserRolePermissionTypes') |
| 72 | - ->whereHas('UserRolePermissionTypes', function ($query) use ($task) { |
|
| 72 | + ->whereHas('UserRolePermissionTypes', function($query) use ($task) { |
|
| 73 | 73 | $query->where('description', $task); |
| 74 | 74 | }) |
| 75 | 75 | ->where('role_id', $user->role_id) |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | ->get(); |
| 78 | 78 | |
| 79 | 79 | $allow = $data->isEmpty() ? 'false' : 'true'; |
| 80 | - Log::debug('User '.$user->full_name.' is trying to access '.$task.'. Result - ' . $allow); |
|
| 81 | - if ($allow === 'Denied') |
|
| 80 | + Log::debug('User '.$user->full_name.' is trying to access '.$task.'. Result - '.$allow); |
|
| 81 | + if($allow === 'Denied') |
|
| 82 | 82 | { |
| 83 | - Log::alert('User ' . $user->full_name . ' was denied from accessing '.$task.' link.'); |
|
| 83 | + Log::alert('User '.$user->full_name.' was denied from accessing '.$task.' link.'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | return $data->isEmpty() ? false : true; |