@@ -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 | ]; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $data['callback'] = Callback::with('users', 'customers', 'departments')->get(); |
37 | 37 | $data['users'] = User::all(); |
38 | - return view('callbacks/list', $data); |
|
38 | + return view('callbacks/list', $data); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -64,31 +64,31 @@ discard block |
||
64 | 64 | { |
65 | 65 | $user = auth()->user(); |
66 | 66 | |
67 | - // Callback::create($input->except('_token', 'product', 'description')); |
|
68 | - $faker = \Faker\Factory::create(); |
|
69 | - $Callback = new Callback; |
|
67 | + // Callback::create($input->except('_token', 'product', 'description')); |
|
68 | + $faker = \Faker\Factory::create(); |
|
69 | + $Callback = new Callback; |
|
70 | 70 | |
71 | - $Callback->type = $faker->numberBetween($min = 1, $max = 3); |
|
72 | - $Callback->customer = $faker->numberBetween($min = 1, $max = 9); |
|
73 | - $Callback->agent_id = '1'; |
|
74 | - $Callback->description = $request->description; |
|
75 | - $Callback->status = 'Open'; |
|
71 | + $Callback->type = $faker->numberBetween($min = 1, $max = 3); |
|
72 | + $Callback->customer = $faker->numberBetween($min = 1, $max = 9); |
|
73 | + $Callback->agent_id = '1'; |
|
74 | + $Callback->description = $request->description; |
|
75 | + $Callback->status = 'Open'; |
|
76 | 76 | |
77 | - $Callback->save(); |
|
77 | + $Callback->save(); |
|
78 | 78 | |
79 | - // Send confirmation email to the customer. |
|
79 | + // Send confirmation email to the customer. |
|
80 | 80 | Mail::send('emails.request', ['user' => $user, 'callback' => $Callback], function ($m) use ($user) { |
81 | - $m->from('[email protected]', 'Ring Me'); |
|
81 | + $m->from('[email protected]', 'Ring Me'); |
|
82 | 82 | |
83 | - $m->to($user->email, $user->fname)->subject('Call back requested'); |
|
84 | - }); |
|
83 | + $m->to($user->email, $user->fname)->subject('Call back requested'); |
|
84 | + }); |
|
85 | 85 | |
86 | - // Send request email to the agent. |
|
87 | - Mail::send('emails.request', ['user' => $user, 'callback' => $Callback], function ($m) use ($user) { |
|
88 | - $m->from('[email protected]', 'Ring Me'); |
|
86 | + // Send request email to the agent. |
|
87 | + Mail::send('emails.request', ['user' => $user, 'callback' => $Callback], function ($m) use ($user) { |
|
88 | + $m->from('[email protected]', 'Ring Me'); |
|
89 | 89 | |
90 | - $m->to("[email protected]")->subject('Call back request!'); |
|
91 | - }); |
|
90 | + $m->to("[email protected]")->subject('Call back request!'); |
|
91 | + }); |
|
92 | 92 | return back(); |
93 | 93 | } |
94 | 94 | |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | |
123 | 123 | if (! $user->is('Agent') || ! $user->is('Manager') || ! $user->is('Administrator')) { |
124 | 124 | |
125 | - $callback = Callback::find($id); |
|
126 | - $callback->delete(); |
|
127 | - return redirect('callbacks'); |
|
125 | + $callback = Callback::find($id); |
|
126 | + $callback->delete(); |
|
127 | + return redirect('callbacks'); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | return redirect()->back(302); |
@@ -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 | } |