@@ -2,9 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | -use App\Http\Requests; |
|
| 6 | -use Illuminate\Http\Request; |
|
| 7 | - |
|
| 8 | 5 | class HomeController extends Controller |
| 9 | 6 | { |
| 10 | 7 | /** |
@@ -26,19 +26,19 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function index() |
| 28 | 28 | { |
| 29 | - $user = auth()->user(); |
|
| 29 | + $user = auth()->user(); |
|
| 30 | 30 | |
| 31 | - if(Bouncer::is($user)->a('Administrator', 'Manager')) { |
|
| 32 | - return redirect()->route('dashboard.administration'); |
|
| 33 | - } |
|
| 31 | + if(Bouncer::is($user)->a('Administrator', 'Manager')) { |
|
| 32 | + return redirect()->route('dashboard.administration'); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - elseif(Bouncer::is($user)->an('Agent')) { |
|
| 35 | + elseif(Bouncer::is($user)->an('Agent')) { |
|
| 36 | 36 | return redirect()->route('dashboard.agent'); |
| 37 | - } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - elseif(Bouncer::is($user)->an('Customer')) { |
|
| 40 | - return redirect('/'); |
|
| 41 | - } |
|
| 39 | + elseif(Bouncer::is($user)->an('Customer')) { |
|
| 40 | + return redirect('/'); |
|
| 41 | + } |
|
| 42 | 42 | return redirect('/'); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -50,25 +50,25 @@ discard block |
||
| 50 | 50 | public function administration() |
| 51 | 51 | { |
| 52 | 52 | |
| 53 | - if (\Auth::check()) { |
|
| 53 | + if (\Auth::check()) { |
|
| 54 | 54 | // The user is logged in... |
| 55 | 55 | |
| 56 | - $data["chart"] = Charts::create('percentage', 'justgage') |
|
| 57 | - ->setTitle('') |
|
| 58 | - ->setElementLabel('Open requests') |
|
| 59 | - ->setValues([1,0,2]) |
|
| 60 | - ->setResponsive(false) |
|
| 61 | - ->setHeight(250) |
|
| 62 | - ->setWidth(0); |
|
| 63 | - |
|
| 64 | - $data["overdue"] = Charts::create('percentage', 'justgage') |
|
| 65 | - ->setElementLabel('Overdue requests') |
|
| 66 | - ->setValues([65,0,100]) |
|
| 67 | - ->setResponsive(false) |
|
| 68 | - ->setHeight(300) |
|
| 69 | - ->setWidth(0); |
|
| 70 | - |
|
| 71 | - $data["assigned"] = Charts::create('percentage', 'justgage') |
|
| 56 | + $data["chart"] = Charts::create('percentage', 'justgage') |
|
| 57 | + ->setTitle('') |
|
| 58 | + ->setElementLabel('Open requests') |
|
| 59 | + ->setValues([1,0,2]) |
|
| 60 | + ->setResponsive(false) |
|
| 61 | + ->setHeight(250) |
|
| 62 | + ->setWidth(0); |
|
| 63 | + |
|
| 64 | + $data["overdue"] = Charts::create('percentage', 'justgage') |
|
| 65 | + ->setElementLabel('Overdue requests') |
|
| 66 | + ->setValues([65,0,100]) |
|
| 67 | + ->setResponsive(false) |
|
| 68 | + ->setHeight(300) |
|
| 69 | + ->setWidth(0); |
|
| 70 | + |
|
| 71 | + $data["assigned"] = Charts::create('percentage', 'justgage') |
|
| 72 | 72 | ->setTitle('') |
| 73 | 73 | ->setElementLabel('Tasks assigned') |
| 74 | 74 | ->setValues([10, 0, 2]) |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function agent() |
| 90 | 90 | { |
| 91 | 91 | |
| 92 | - if (\Auth::check()) { |
|
| 92 | + if (\Auth::check()) { |
|
| 93 | 93 | // The user is logged in... |
| 94 | 94 | |
| 95 | 95 | |
@@ -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 |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function index() |
| 29 | 29 | { |
| 30 | - $user = auth()->user(); |
|
| 30 | + $user = auth()->user(); |
|
| 31 | 31 | |
| 32 | - if ($user->is('Agent') || $user->is('Manager') || $user->is('Administrator')) { |
|
| 32 | + if ($user->is('Agent') || $user->is('Manager') || $user->is('Administrator')) { |
|
| 33 | 33 | $data['customers'] = Customer::orderBy('status' , 'asc')->paginate(15); |
| 34 | 34 | return view('customers/index', $data); |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | return redirect()->back(); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | if (! $user->is('Guest') || ! $user->is('Agent') || ! $user->is('Manager') || ! $user->is('Administrator')) |
| 67 | 67 | { |
| 68 | - Customer::create($input->except('_token')); |
|
| 69 | - session()->flash('message', 'Customer created'); |
|
| 70 | - return redirect()->to('/customers'); |
|
| 68 | + Customer::create($input->except('_token')); |
|
| 69 | + session()->flash('message', 'Customer created'); |
|
| 70 | + return redirect()->to('/customers'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | return redirect()->back(); |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | $user = auth()->user(); |
| 85 | 85 | |
| 86 | 86 | if(! $user->is('Customer') || ! $user->is('Agent') || ! $user->is('Manager') || ! $user->is('Administrator')) { |
| 87 | - $data['customer'] = Customer::where('id', $id)->get(); |
|
| 88 | - return view('customers/edit', $data); |
|
| 87 | + $data['customer'] = Customer::where('id', $id)->get(); |
|
| 88 | + return view('customers/edit', $data); |
|
| 89 | 89 | |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | return redirect()->back(); |
| 93 | 93 | } |
@@ -2,10 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | -use App\User; |
|
| 6 | 5 | use Illuminate\Http\Request; |
| 7 | 6 | use Chrisbjr\ApiGuard\Models\ApiKey; |
| 8 | -use App\Http\Requests; |
|
| 9 | 7 | |
| 10 | 8 | class ApiKeyController extends Controller |
| 11 | 9 | { |
@@ -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 | /** |
@@ -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 | ]; |
@@ -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 |
@@ -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 | /** |
@@ -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 |
@@ -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 | } |