@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | try { |
| 59 | 59 | $user = $this->userRepository->store(Input::all()); |
| 60 | 60 | } |
| 61 | - catch(ValidationException $e) { |
|
| 61 | + catch (ValidationException $e) { |
|
| 62 | 62 | return redirect('app/users/register')->withInput() |
| 63 | 63 | ->with('error', $e->getMessageBag()->first()); |
| 64 | 64 | } |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | try { |
| 76 | 76 | $user = $this->userRepository->changeStatus($userId); |
| 77 | 77 | } |
| 78 | - catch(RepositoryException $e) { |
|
| 78 | + catch (RepositoryException $e) { |
|
| 79 | 79 | return redirect('app/users')->with('error', 'Could not change account status'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if($user->is_active) |
|
| 82 | + if ($user->is_active) |
|
| 83 | 83 | return redirect('app/users/disabled')->with('success', 'User <b>'.$user->firstname.'</b> enabled'); |
| 84 | 84 | else |
| 85 | 85 | return redirect('app/users')->with('success', 'User <b>'.$user->firstname.'</b> disabled'); |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | try { |
| 91 | 91 | $user = $this->userRepository->changeRole($userId); |
| 92 | 92 | } |
| 93 | - catch(RepositoryException $e) { |
|
| 93 | + catch (RepositoryException $e) { |
|
| 94 | 94 | return redirect('app/users')->with('error', 'Could not change user role'); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $redirectUrl = 'app/users'; |
| 98 | - if( !$user->is_active ) |
|
| 98 | + if (!$user->is_active) |
|
| 99 | 99 | $redirectUrl .= '/disabled'; |
| 100 | 100 | |
| 101 | - $roleNames = ['ADMN'=>'administrator','MNGR'=>'manager','USER'=>'user']; |
|
| 101 | + $roleNames = ['ADMN'=>'administrator', 'MNGR'=>'manager', 'USER'=>'user']; |
|
| 102 | 102 | $roleName = $roleNames[$user->role]; |
| 103 | 103 | |
| 104 | 104 | return redirect($redirectUrl)->with('success', 'User <b>'.$user->firstname.'</b> is now <i>'.$roleName.'</i>'); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | try { |
| 110 | 110 | $user = $this->userRepository->softDelete($userId); |
| 111 | 111 | } |
| 112 | - catch(RepositoryException $e) { |
|
| 112 | + catch (RepositoryException $e) { |
|
| 113 | 113 | return redirect('app/users')->with('error', 'User could not be deleted: '.$e->getMessage()); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | private function getRoleNames() |
| 120 | 120 | { |
| 121 | - return ['ADMN'=>'Administrator','MNGR'=>'Manager','USER'=>'User']; |
|
| 121 | + return ['ADMN'=>'Administrator', 'MNGR'=>'Manager', 'USER'=>'User']; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function handle($request, Closure $next) |
| 16 | 16 | { |
| 17 | - if ($this->auth->guest() || session('role')!=='ADMN' ) |
|
| 17 | + if ($this->auth->guest() || session('role') !== 'ADMN') |
|
| 18 | 18 | { |
| 19 | 19 | if ($request->ajax()) |
| 20 | 20 | { |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function handle($request, Closure $next) |
| 16 | 16 | { |
| 17 | - if ($this->auth->guest() || (session('role')!=='MNGR' && session('role')!=='ADMN') ) |
|
| 17 | + if ($this->auth->guest() || (session('role') !== 'MNGR' && session('role') !== 'ADMN')) |
|
| 18 | 18 | { |
| 19 | 19 | if ($request->ajax()) |
| 20 | 20 | { |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public function handle($request, Closure $next) |
| 19 | 19 | { |
| 20 | 20 | // Installation lock disabled, we can't run the install process anymore |
| 21 | - if (!file_exists(base_path() . '/' . self::INSTALLATION_FILE)) { |
|
| 21 | + if (!file_exists(base_path().'/'.self::INSTALLATION_FILE)) { |
|
| 22 | 22 | return redirect('/'); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function handle($request, Closure $next) |
| 16 | 16 | { |
| 17 | - if ($this->auth->guest() || (session('role')!=='USER' && session('role')!=='MNGR' && session('role')!=='ADMN') ) |
|
| 17 | + if ($this->auth->guest() || (session('role') !== 'USER' && session('role') !== 'MNGR' && session('role') !== 'ADMN')) |
|
| 18 | 18 | { |
| 19 | 19 | if ($request->ajax()) |
| 20 | 20 | { |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function handle($request, Closure $next) |
| 18 | 18 | { |
| 19 | 19 | // Disable CSRF control for xHttp Requests |
| 20 | - if($request->isXmlHttpRequest()) |
|
| 20 | + if ($request->isXmlHttpRequest()) |
|
| 21 | 21 | { |
| 22 | 22 | return $next($request); |
| 23 | 23 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // INSTALLATION ROUTES |
| 4 | 4 | |
| 5 | -Route::group(['prefix'=>'install', 'middleware'=>'installed'], function(){ |
|
| 5 | +Route::group(['prefix'=>'install', 'middleware'=>'installed'], function() { |
|
| 6 | 6 | |
| 7 | 7 | Route::get('/', 'InstallController@displayWelcome'); |
| 8 | 8 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | // PUBLIC ROUTES |
| 30 | 30 | |
| 31 | -Route::group(['middleware'=>'guest'], function(){ |
|
| 31 | +Route::group(['middleware'=>'guest'], function() { |
|
| 32 | 32 | |
| 33 | 33 | Route::get('/', 'LoginController@getLoginForm'); |
| 34 | 34 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // USER ROUTES |
| 40 | 40 | |
| 41 | -Route::group(['prefix'=>'app', 'middleware'=>'user'], function(){ |
|
| 41 | +Route::group(['prefix'=>'app', 'middleware'=>'user'], function() { |
|
| 42 | 42 | |
| 43 | 43 | // POS MODULE |
| 44 | 44 | |
@@ -58,15 +58,15 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | // MANAGER ROUTES |
| 60 | 60 | |
| 61 | -Route::group(['prefix'=>'app', 'middleware'=>'manager'], function(){ |
|
| 61 | +Route::group(['prefix'=>'app', 'middleware'=>'manager'], function() { |
|
| 62 | 62 | |
| 63 | 63 | // STOCK MODULE |
| 64 | 64 | |
| 65 | 65 | Route::get('stock', 'StockController@dashboard'); |
| 66 | 66 | |
| 67 | - Route::resource('stock/category', 'CategoryController', ['except' => ['create','edit']]); |
|
| 67 | + Route::resource('stock/category', 'CategoryController', ['except' => ['create', 'edit']]); |
|
| 68 | 68 | |
| 69 | - Route::resource('stock/product', 'ProductController', ['except' => ['create','edit']]); |
|
| 69 | + Route::resource('stock/product', 'ProductController', ['except' => ['create', 'edit']]); |
|
| 70 | 70 | |
| 71 | 71 | // CASH MODULE |
| 72 | 72 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | // ADMIN ROUTES |
| 94 | 94 | |
| 95 | -Route::group(['prefix'=>'app', 'middleware'=>'administrator'], function(){ |
|
| 95 | +Route::group(['prefix'=>'app', 'middleware'=>'administrator'], function() { |
|
| 96 | 96 | |
| 97 | 97 | // USERS MODULE |
| 98 | 98 | |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | Route::post('users/register', 'UsersController@registerNewUser'); |
| 108 | 108 | |
| 109 | - Route::get('users/change-status/{id}', 'UsersController@changeAccountStatus')->where('id', '[0-9]+');; |
|
| 109 | + Route::get('users/change-status/{id}', 'UsersController@changeAccountStatus')->where('id', '[0-9]+'); ; |
|
| 110 | 110 | |
| 111 | - Route::get('users/change-role/{id}', 'UsersController@changeAccountRole')->where('id', '[0-9]+');; |
|
| 111 | + Route::get('users/change-role/{id}', 'UsersController@changeAccountRole')->where('id', '[0-9]+'); ; |
|
| 112 | 112 | |
| 113 | - Route::get('users/delete/{id}', 'UsersController@deleteUser')->where('id', '[0-9]+');; |
|
| 113 | + Route::get('users/delete/{id}', 'UsersController@deleteUser')->where('id', '[0-9]+'); ; |
|
| 114 | 114 | |
| 115 | 115 | // SETTINGS MODULE |
| 116 | 116 | |
@@ -8,13 +8,13 @@ |
||
| 8 | 8 | public $primaryKey = 'cs_id'; |
| 9 | 9 | public $timestamps = false; |
| 10 | 10 | |
| 11 | - public static $validationRules = [ 'title' => 'required|name', |
|
| 11 | + public static $validationRules = ['title' => 'required|name', |
|
| 12 | 12 | 'description' => '', |
| 13 | - 'amount' => 'required|numeric|between:0,9999' ]; |
|
| 13 | + 'amount' => 'required|numeric|between:0,9999']; |
|
| 14 | 14 | |
| 15 | 15 | public function details() |
| 16 | 16 | { |
| 17 | - return $this->hasMany('App\Models\SnapshotDetails','cs_id'); |
|
| 17 | + return $this->hasMany('App\Models\SnapshotDetails', 'cs_id'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function scopeWithUsers($query) |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | protected $guarded = ['category_id']; |
| 17 | 17 | |
| 18 | - public function getKeyName(){ |
|
| 18 | + public function getKeyName() { |
|
| 19 | 19 | |
| 20 | 20 | return 'category_id'; |
| 21 | 21 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | WHERE c.group_id = ? |
| 29 | 29 | AND c.deleted_at IS NULL'; |
| 30 | 30 | |
| 31 | - return DB::select($query, [ Session::get('groupID') ]); |
|
| 31 | + return DB::select($query, [Session::get('groupID')]); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function scopeFromGroup($query) { |
| 44 | 44 | |
| 45 | - return $query->where('group_id', Session::get('groupID') ); |
|
| 45 | + return $query->where('group_id', Session::get('groupID')); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |