@@ -5,10 +5,7 @@ |
||
| 5 | 5 | use App\Departments; |
| 6 | 6 | use App\User; |
| 7 | 7 | use App\Roles; |
| 8 | - |
|
| 9 | 8 | use Chrisbjr\ApiGuard\Models\ApiKey; |
| 10 | -use Illuminate\Http\Request; |
|
| 11 | - |
|
| 12 | 9 | use App\Http\Requests; |
| 13 | 10 | use Bouncer; |
| 14 | 11 | |
@@ -64,36 +64,36 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | if ($user->is('Manager') || $user->is('Administrator')) |
| 66 | 66 | { |
| 67 | - $password = $faker->password; |
|
| 68 | - // Save the user to the database. |
|
| 69 | - $NewUser = User::create( |
|
| 67 | + $password = $faker->password; |
|
| 68 | + // Save the user to the database. |
|
| 69 | + $NewUser = User::create( |
|
| 70 | 70 | [ |
| 71 | - 'fname' => $input->fname, |
|
| 72 | - 'name' => $input->name, |
|
| 73 | - 'email' => $input->email, |
|
| 74 | - 'password' => \Hash::make($password), |
|
| 75 | - 'biography' => nl2br($input->biography), |
|
| 71 | + 'fname' => $input->fname, |
|
| 72 | + 'name' => $input->name, |
|
| 73 | + 'email' => $input->email, |
|
| 74 | + 'password' => \Hash::make($password), |
|
| 75 | + 'biography' => nl2br($input->biography), |
|
| 76 | 76 | ] |
| 77 | - )->id; |
|
| 78 | - // Assign the user to the selected department |
|
| 77 | + )->id; |
|
| 78 | + // Assign the user to the selected department |
|
| 79 | 79 | User::find($NewUser)->departments()->attach($input->department); |
| 80 | - // Assign the user to the selected role. |
|
| 80 | + // Assign the user to the selected role. |
|
| 81 | 81 | Bouncer::assign($input->role)->to($user); |
| 82 | - // Send a confirmation mail to the user. |
|
| 82 | + // Send a confirmation mail to the user. |
|
| 83 | 83 | Mail::send('emails.welcome', ['user' => $NewUser, 'password' => $password], function ($message) use ($user) |
| 84 | 84 | { |
| 85 | - $message->from(env('MAIL_USERNAME')); |
|
| 86 | - $message->to('[email protected]', 'John Smith')->subject('Welcome to Ring Me!'); |
|
| 85 | + $message->from(env('MAIL_USERNAME')); |
|
| 86 | + $message->to('[email protected]', 'John Smith')->subject('Welcome to Ring Me!'); |
|
| 87 | 87 | } |
| 88 | - ); |
|
| 89 | - session()->flash('message', 'The new user has been created and is assigned to his department and role.'); |
|
| 90 | - return redirect("staff"); |
|
| 91 | - } |
|
| 92 | - else |
|
| 93 | - { |
|
| 94 | - return redirect()->back(302); |
|
| 95 | - } |
|
| 96 | - } |
|
| 88 | + ); |
|
| 89 | + session()->flash('message', 'The new user has been created and is assigned to his department and role.'); |
|
| 90 | + return redirect("staff"); |
|
| 91 | + } |
|
| 92 | + else |
|
| 93 | + { |
|
| 94 | + return redirect()->back(302); |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Update the staff member. |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
| 129 | 129 | */ |
| 130 | 130 | public function index() |
| 131 | - { |
|
| 131 | + { |
|
| 132 | 132 | $data["departments"] = Departments::all(); |
| 133 | - $data['users'] = User::paginate(15); |
|
| 134 | - return view('users/index', $data); |
|
| 133 | + $data['users'] = User::paginate(15); |
|
| 134 | + return view('users/index', $data); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $id = auth()->user()->id; |
| 173 | 173 | $data['tokens'] = ApiKey::where('user_id', $id)->get(); |
| 174 | - return view('users/profile', $data); |
|
| 174 | + return view('users/profile', $data); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | session()->flash('message', 'The user has been removed.'); |
| 194 | 194 | |
| 195 | 195 | return redirect()->to('/staff'); |
| 196 | - } |
|
| 197 | - else |
|
| 198 | - { |
|
| 196 | + } |
|
| 197 | + else |
|
| 198 | + { |
|
| 199 | 199 | return redirect()->back(); |
| 200 | - } |
|
| 200 | + } |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | public function get_roles() |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $data2 = []; |
| 207 | 207 | foreach($items as $role) |
| 208 | 208 | { |
| 209 | - $data2[] = [ |
|
| 209 | + $data2[] = [ |
|
| 210 | 210 | 'value' => $role["id"], |
| 211 | 211 | 'text' => $role["name"] |
| 212 | 212 | ]; |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | $user = auth()->user(); |
| 42 | 42 | |
| 43 | 43 | if ($user->is('Manager') || $user->is('Administrator')) { |
| 44 | - $data['departments'] = Departments::all(); |
|
| 45 | - $data['roles'] = Roles::all(); |
|
| 44 | + $data[ 'departments' ] = Departments::all(); |
|
| 45 | + $data[ 'roles' ] = Roles::all(); |
|
| 46 | 46 | |
| 47 | 47 | return view('staff.create', $data); |
| 48 | 48 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | // Assign the user to the selected role. |
| 81 | 81 | Bouncer::assign($input->role)->to($user); |
| 82 | 82 | // Send a confirmation mail to the user. |
| 83 | - Mail::send('emails.welcome', ['user' => $NewUser, 'password' => $password], function ($message) use ($user) |
|
| 83 | + Mail::send('emails.welcome', [ 'user' => $NewUser, 'password' => $password ], function($message) use ($user) |
|
| 84 | 84 | { |
| 85 | 85 | $message->from(env('MAIL_USERNAME')); |
| 86 | 86 | $message->to('[email protected]', 'John Smith')->subject('Welcome to Ring Me!'); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function update(Requests\NewStaffValidator $input, $id) |
| 107 | 107 | { |
| 108 | - User::find($id)-update($input->except('_token')); |
|
| 108 | + User::find($id) - update($input->except('_token')); |
|
| 109 | 109 | //session()->flash('message', 'Staff member has been updated'); |
| 110 | 110 | |
| 111 | 111 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function edit($id) |
| 120 | 120 | { |
| 121 | - $data['query'] = User::find($id); |
|
| 121 | + $data[ 'query' ] = User::find($id); |
|
| 122 | 122 | return view('staff.edit', $data); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function index() |
| 131 | 131 | { |
| 132 | - $data["departments"] = Departments::all(); |
|
| 133 | - $data['users'] = User::paginate(15); |
|
| 132 | + $data[ "departments" ] = Departments::all(); |
|
| 133 | + $data[ 'users' ] = User::paginate(15); |
|
| 134 | 134 | return view('users/index', $data); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | public function profile() |
| 171 | 171 | { |
| 172 | 172 | $id = auth()->user()->id; |
| 173 | - $data['tokens'] = ApiKey::where('user_id', $id)->get(); |
|
| 173 | + $data[ 'tokens' ] = ApiKey::where('user_id', $id)->get(); |
|
| 174 | 174 | return view('users/profile', $data); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | $user = auth()->user(); |
| 186 | 186 | |
| 187 | - if (! $user->is('Manager') || ! $user->is('Administrator')) { |
|
| 187 | + if (!$user->is('Manager') || !$user->is('Administrator')) { |
|
| 188 | 188 | |
| 189 | 189 | $user = User::find($id); |
| 190 | - $user->roles()->sync([]); |
|
| 190 | + $user->roles()->sync([ ]); |
|
| 191 | 191 | |
| 192 | 192 | User::destroy($id); |
| 193 | 193 | session()->flash('message', 'The user has been removed.'); |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | public function get_roles() |
| 204 | 204 | { |
| 205 | 205 | $items = Roles::all(); |
| 206 | - $data2 = []; |
|
| 207 | - foreach($items as $role) |
|
| 206 | + $data2 = [ ]; |
|
| 207 | + foreach ($items as $role) |
|
| 208 | 208 | { |
| 209 | - $data2[] = [ |
|
| 210 | - 'value' => $role["id"], |
|
| 211 | - 'text' => $role["name"] |
|
| 209 | + $data2[ ] = [ |
|
| 210 | + 'value' => $role[ "id" ], |
|
| 211 | + 'text' => $role[ "name" ] |
|
| 212 | 212 | ]; |
| 213 | 213 | |
| 214 | 214 | } |
@@ -88,8 +88,7 @@ discard block |
||
| 88 | 88 | ); |
| 89 | 89 | session()->flash('message', 'The new user has been created and is assigned to his department and role.'); |
| 90 | 90 | return redirect("staff"); |
| 91 | - } |
|
| 92 | - else |
|
| 91 | + } else |
|
| 93 | 92 | { |
| 94 | 93 | return redirect()->back(302); |
| 95 | 94 | } |
@@ -193,8 +192,7 @@ discard block |
||
| 193 | 192 | session()->flash('message', 'The user has been removed.'); |
| 194 | 193 | |
| 195 | 194 | return redirect()->to('/staff'); |
| 196 | - } |
|
| 197 | - else |
|
| 195 | + } else |
|
| 198 | 196 | { |
| 199 | 197 | return redirect()->back(); |
| 200 | 198 | } |
@@ -19,5 +19,5 @@ |
||
| 19 | 19 | * |
| 20 | 20 | * @var array |
| 21 | 21 | */ |
| 22 | - protected $fillable = ['name']; |
|
| 22 | + protected $fillable = [ 'name' ]; |
|
| 23 | 23 | } |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function index() |
| 18 | 18 | { |
| 19 | - $data['roles'] = Roles::all(); |
|
| 20 | - return view('roles.index', $data); |
|
| 19 | + $data['roles'] = Roles::all(); |
|
| 20 | + return view('roles.index', $data); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use Illuminate\Http\Request; |
| 6 | -use App\Http\Requests; |
|
| 7 | 6 | use Silber\Bouncer\Database\Constraints\Roles; |
| 8 | 7 | |
| 9 | 8 | class RolesController extends Controller |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function index() |
| 18 | 18 | { |
| 19 | - $data['roles'] = Roles::all(); |
|
| 19 | + $data[ 'roles' ] = Roles::all(); |
|
| 20 | 20 | return view('roles.index', $data); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function search(Request $request) |
| 30 | 30 | { |
| 31 | 31 | $term = $request->get('term'); |
| 32 | - $data['roles'] = Roles::where('name', 'LIKE', "$term")->get(); |
|
| 32 | + $data[ 'roles' ] = Roles::where('name', 'LIKE', "$term")->get(); |
|
| 33 | 33 | return view('roles.index', $data); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function show($id) |
| 43 | 43 | { |
| 44 | - $data['query'] = Roles::find($id); |
|
| 44 | + $data[ 'query' ] = Roles::find($id); |
|
| 45 | 45 | return view('roles.specific', $data); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function edit($id) |
| 77 | 77 | { |
| 78 | - $data['query'] = Roles::find($id); |
|
| 79 | - $data['permissions'] = Permissions::orderBy('name', 'asc')->get(); |
|
| 78 | + $data[ 'query' ] = Roles::find($id); |
|
| 79 | + $data[ 'permissions' ] = Permissions::orderBy('name', 'asc')->get(); |
|
| 80 | 80 | |
| 81 | 81 | return view('roles.edit', $data); |
| 82 | 82 | } |
@@ -3,8 +3,6 @@ |
||
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use App\Customer; |
| 6 | -use Illuminate\Http\Request; |
|
| 7 | - |
|
| 8 | 6 | use App\Http\Requests; |
| 9 | 7 | |
| 10 | 8 | class CustomersController extends Controller |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class BackupController extends Controller |
| 11 | 11 | { |
| 12 | - public function __construct() |
|
| 12 | + public function __construct() |
|
| 13 | 13 | { |
| 14 | 14 | $this->middleware('auth'); |
| 15 | 15 | $this->middleware('lang'); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $data['MonthlyBackups'] = Config::get('laravel-backup.cleanup.defaultStrategy.keepMonthlyBackupsForMonths'); |
| 31 | 31 | $data['KeepYearlyBackups'] = Config::get('laravel-backup.cleanup.defaultStrategy.keepYearlyBackupsForYears'); |
| 32 | 32 | |
| 33 | - return view('settings.backups', $data); |
|
| 33 | + return view('settings.backups', $data); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | |
| 26 | 26 | // Config data |
| 27 | - $data['StoreAllBackups'] = Config::get('laravel-backup.cleanup.defaultStrategy.keepAllBackupsForDays'); |
|
| 28 | - $data['KeepDailyBackups'] = Config::get('laravel-backup.cleanup.defaultStrategy.keepDailyBackupsForDays'); |
|
| 29 | - $data['WeeklyBackups'] = Config::get('laravel-backup.cleanup.defaultStrategy.keepWeeklyBackupsForWeeks'); |
|
| 30 | - $data['MonthlyBackups'] = Config::get('laravel-backup.cleanup.defaultStrategy.keepMonthlyBackupsForMonths'); |
|
| 31 | - $data['KeepYearlyBackups'] = Config::get('laravel-backup.cleanup.defaultStrategy.keepYearlyBackupsForYears'); |
|
| 27 | + $data[ 'StoreAllBackups' ] = Config::get('laravel-backup.cleanup.defaultStrategy.keepAllBackupsForDays'); |
|
| 28 | + $data[ 'KeepDailyBackups' ] = Config::get('laravel-backup.cleanup.defaultStrategy.keepDailyBackupsForDays'); |
|
| 29 | + $data[ 'WeeklyBackups' ] = Config::get('laravel-backup.cleanup.defaultStrategy.keepWeeklyBackupsForWeeks'); |
|
| 30 | + $data[ 'MonthlyBackups' ] = Config::get('laravel-backup.cleanup.defaultStrategy.keepMonthlyBackupsForMonths'); |
|
| 31 | + $data[ 'KeepYearlyBackups' ] = Config::get('laravel-backup.cleanup.defaultStrategy.keepYearlyBackupsForYears'); |
|
| 32 | 32 | |
| 33 | 33 | return view('settings.backups', $data); |
| 34 | 34 | } |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | public function storeBackup(Requests\BackupSettingValidator $input) |
| 44 | 44 | { |
| 45 | 45 | $config = new \Larapack\ConfigWriter\Repository('laravel-backup'); |
| 46 | - $config->set('cleanup.defaultStrategy.keepAllBackupsForDays', $input->keepAllBackupsForDaysAll); |
|
| 47 | - $config->set('cleanup.defaultStrategy.keepDailyBackupsForDays', $input->keepAllBackupsForDays); |
|
| 48 | - $config->set('cleanup.defaultStrategy.keepWeeklyBackupsForWeeks', $input->keepWeeklyBackupsForWeeks); |
|
| 46 | + $config->set('cleanup.defaultStrategy.keepAllBackupsForDays', $input->keepAllBackupsForDaysAll); |
|
| 47 | + $config->set('cleanup.defaultStrategy.keepDailyBackupsForDays', $input->keepAllBackupsForDays); |
|
| 48 | + $config->set('cleanup.defaultStrategy.keepWeeklyBackupsForWeeks', $input->keepWeeklyBackupsForWeeks); |
|
| 49 | 49 | $config->set('cleanup.defaultStrategy.keepMonthlyBackupsForMonths', $input->keepMonthlyBackupsForWeeks); |
| 50 | - $config->set('cleanup.defaultStrategy.keepYearlyBackupsForYears', $input->keepAllBackupsYearly); |
|
| 50 | + $config->set('cleanup.defaultStrategy.keepYearlyBackupsForYears', $input->keepAllBackupsYearly); |
|
| 51 | 51 | $config->save(); |
| 52 | 52 | |
| 53 | 53 | if ($config) { |
@@ -3,11 +3,8 @@ |
||
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use App\User; |
| 6 | -use Illuminate\Http\Request; |
|
| 7 | - |
|
| 8 | 6 | use App\Http\Requests; |
| 9 | 7 | use Illuminate\Support\Facades\Input; |
| 10 | -use Illuminate\Support\Facades\Storage; |
|
| 11 | 8 | use Intervention\Image\Facades\Image; |
| 12 | 9 | |
| 13 | 10 | class ProfileController extends Controller |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | public function updateProfile(Requests\ProfileValidator $input) |
| 31 | 31 | { |
| 32 | 32 | // User information |
| 33 | - User::find(auth()->user()->id)->update($input->except(['_token', 'avatar'])); |
|
| 33 | + User::find(auth()->user()->id)->update($input->except([ '_token', 'avatar' ])); |
|
| 34 | 34 | |
| 35 | 35 | // User image information. |
| 36 | 36 | if (Input::file()) { |
| 37 | 37 | $image = Input::file('avatar'); |
| 38 | - $filename = time() . '.' . $image->getClientOriginalExtension(); |
|
| 39 | - $path = public_path('avatars/' . $filename); |
|
| 38 | + $filename = time().'.'.$image->getClientOriginalExtension(); |
|
| 39 | + $path = public_path('avatars/'.$filename); |
|
| 40 | 40 | |
| 41 | 41 | //Image::make($image->getRealPath())->resize(80, 80)->save($path); |
| 42 | 42 | $image->move(public_path('avatars'), $filename); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function updateSecurity(Requests\PasswordValidation $input) |
| 60 | 60 | { |
| 61 | - $data['password'] = bcrypt($input->password); |
|
| 61 | + $data[ 'password' ] = bcrypt($input->password); |
|
| 62 | 62 | |
| 63 | 63 | User::find(auth()->user()->id)->update($data); |
| 64 | 64 | session()->flash('message', 'Your password has been updated.'); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | // TODO: Needs phpunit tests. -> create github issue |
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * SettingsController constructor. |
| 15 | 15 | */ |
| 16 | 16 | public function __construct() |
@@ -26,17 +26,17 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function index() |
| 28 | 28 | { |
| 29 | - return view('settings.index'); |
|
| 29 | + return view('settings.index'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Get the email settings page. |
|
| 34 | - * |
|
| 35 | - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
| 36 | - */ |
|
| 37 | - public function email() |
|
| 38 | - { |
|
| 39 | - return view('settings.email'); |
|
| 40 | - } |
|
| 32 | + /** |
|
| 33 | + * Get the email settings page. |
|
| 34 | + * |
|
| 35 | + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
| 36 | + */ |
|
| 37 | + public function email() |
|
| 38 | + { |
|
| 39 | + return view('settings.email'); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | } |
@@ -19,5 +19,5 @@ |
||
| 19 | 19 | * |
| 20 | 20 | * @var array |
| 21 | 21 | */ |
| 22 | - protected $fillable = ['name']; |
|
| 22 | + protected $fillable = [ 'name' ]; |
|
| 23 | 23 | } |
@@ -10,12 +10,12 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class ProductsCategories extends Model |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Model table. |
|
| 15 | - * |
|
| 16 | - * @var string |
|
| 17 | - */ |
|
| 18 | - protected $table = 'products_categories'; |
|
| 13 | + /** |
|
| 14 | + * Model table. |
|
| 15 | + * |
|
| 16 | + * @var string |
|
| 17 | + */ |
|
| 18 | + protected $table = 'products_categories'; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Mass-assign fields |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @var array |
| 24 | 24 | */ |
| 25 | - protected $fillable = ['name', 'category_id']; |
|
| 25 | + protected $fillable = [ 'name', 'category_id' ]; |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use App\Departments; |
| 6 | 6 | use Illuminate\Http\Request; |
| 7 | - |
|
| 8 | 7 | use App\Http\Requests; |
| 9 | 8 | |
| 10 | 9 | /** |
@@ -35,17 +35,17 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function edit_categories($id) |
| 37 | 37 | { |
| 38 | - $data['category'] = ProductsCategories::find($id); |
|
| 39 | - return view('products.edit_category', $data); |
|
| 38 | + $data['category'] = ProductsCategories::find($id); |
|
| 39 | + return view('products.edit_category', $data); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function remove_category($id) |
| 43 | 43 | { |
| 44 | - $category = ProductsCategories::find($id); |
|
| 45 | - $category->delete(); |
|
| 44 | + $category = ProductsCategories::find($id); |
|
| 45 | + $category->delete(); |
|
| 46 | 46 | |
| 47 | - session()->flash('message', trans('products.removed_category')); |
|
| 48 | - return redirect()->back(); |
|
| 47 | + session()->flash('message', trans('products.removed_category')); |
|
| 48 | + return redirect()->back(); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | public function store(Requests\ProductValidator $input) |
| 62 | 62 | { |
| 63 | 63 | $this->validate($input, [ |
| 64 | - 'name' => 'required', |
|
| 65 | - 'category' => 'required', |
|
| 66 | - ]); |
|
| 64 | + 'name' => 'required', |
|
| 65 | + 'category' => 'required', |
|
| 66 | + ]); |
|
| 67 | 67 | |
| 68 | 68 | $product = new Products(); |
| 69 | 69 | $product->name = $input->name; |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function saveCat(Request $input) |
| 87 | 87 | { |
| 88 | - $this->validate($input, [ |
|
| 88 | + $this->validate($input, [ |
|
| 89 | 89 | 'name' => 'required|unique:products_categories' |
| 90 | - ]); |
|
| 90 | + ]); |
|
| 91 | 91 | |
| 92 | 92 | $category = new ProductsCategories(); |
| 93 | 93 | $category->name = $input->name; |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | public function remove($id) |
| 102 | 102 | { |
| 103 | - $product = Products::find($id); |
|
| 104 | - $product->delete(); |
|
| 103 | + $product = Products::find($id); |
|
| 104 | + $product->delete(); |
|
| 105 | 105 | |
| 106 | - session()->flash('message', trans('products.removed')); |
|
| 107 | - return redirect()->back(); |
|
| 106 | + session()->flash('message', trans('products.removed')); |
|
| 107 | + return redirect()->back(); |
|
| 108 | 108 | } |
| 109 | 109 | } |
@@ -21,21 +21,21 @@ |
||
| 21 | 21 | |
| 22 | 22 | public function index() |
| 23 | 23 | { |
| 24 | - $data['products'] = Products::with('category')->paginate(10); |
|
| 25 | - $data['category'] = ProductsCategories::with('products')->paginate(10)->sortBy("name")->all(); |
|
| 24 | + $data[ 'products' ] = Products::with('category')->paginate(10); |
|
| 25 | + $data[ 'category' ] = ProductsCategories::with('products')->paginate(10)->sortBy("name")->all(); |
|
| 26 | 26 | |
| 27 | 27 | return view('products.index', $data); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function categories() |
| 31 | 31 | { |
| 32 | - $data['category'] = ProductsCategories::with('products')->paginate(10)->sortBy("name")->all(); |
|
| 32 | + $data[ 'category' ] = ProductsCategories::with('products')->paginate(10)->sortBy("name")->all(); |
|
| 33 | 33 | return view('products.categories', $data); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function edit_categories($id) |
| 37 | 37 | { |
| 38 | - $data['category'] = ProductsCategories::find($id); |
|
| 38 | + $data[ 'category' ] = ProductsCategories::find($id); |
|
| 39 | 39 | return view('products.edit_category', $data); |
| 40 | 40 | } |
| 41 | 41 | |