@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function trimStr(string $str) |
53 | 53 | { |
54 | - if(strlen($str) > 50) { |
|
54 | + if (strlen($str) > 50) { |
|
55 | 55 | return substr($str, '0', '50')."..."; |
56 | 56 | } |
57 | 57 | return $str; |
@@ -8,8 +8,7 @@ discard block |
||
8 | 8 | use Illuminate\Foundation\Auth\User as Authenticatable; |
9 | 9 | use Illuminate\Support\Facades\Auth; |
10 | 10 | |
11 | -class User extends Authenticatable |
|
12 | -{ |
|
11 | +class User extends Authenticatable { |
|
13 | 12 | use Notifiable; |
14 | 13 | |
15 | 14 | /** |
@@ -47,14 +46,16 @@ discard block |
||
47 | 46 | 'updated_at' |
48 | 47 | ]; |
49 | 48 | |
50 | - public function thread() { |
|
49 | + public function thread() |
|
50 | + { |
|
51 | 51 | return $this->hasMany('App\Thread', 'user_id'); |
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @return int |
56 | 56 | */ |
57 | - public function threadAnswered() { |
|
57 | + public function threadAnswered() |
|
58 | + { |
|
58 | 59 | return count( |
59 | 60 | Thread::where('status', true) |
60 | 61 | ->where('user_id', Auth::guard('web') |
@@ -78,7 +78,7 @@ |
||
78 | 78 | */ |
79 | 79 | public function trimStr($str) |
80 | 80 | { |
81 | - if(strlen($str) > 20) { |
|
81 | + if (strlen($str) > 20) { |
|
82 | 82 | return substr($str, 0, 20)."..."; |
83 | 83 | } |
84 | 84 | return $str; |
@@ -9,8 +9,7 @@ discard block |
||
9 | 9 | use Illuminate\Contracts\Auth\MustVerifyEmail; |
10 | 10 | use Illuminate\Foundation\Auth\User as Authenticatable; |
11 | 11 | |
12 | -class Doctor extends Authenticatable |
|
13 | -{ |
|
12 | +class Doctor extends Authenticatable { |
|
14 | 13 | use Notifiable; |
15 | 14 | |
16 | 15 | protected $guard = 'doctor'; |
@@ -72,15 +71,18 @@ discard block |
||
72 | 71 | return $this->belongsTo('App\DoctorSpecialization', 'specialization_id'); |
73 | 72 | } |
74 | 73 | |
75 | - public function city() { |
|
74 | + public function city() |
|
75 | + { |
|
76 | 76 | return $this->belongsTo('App\City', 'city_id'); |
77 | 77 | } |
78 | 78 | |
79 | - public function thread() { |
|
79 | + public function thread() |
|
80 | + { |
|
80 | 81 | return $this->hasMany('App\Thread', 'doctor_id'); |
81 | 82 | } |
82 | 83 | |
83 | - public function hospital() { |
|
84 | + public function hospital() |
|
85 | + { |
|
84 | 86 | return $this->belongsToMany('App\Hospital', 'doctor_details', 'doctor_id', 'hospital_id'); |
85 | 87 | } |
86 | 88 |
@@ -14,10 +14,10 @@ |
||
14 | 14 | */ |
15 | 15 | protected function redirectTo($request) |
16 | 16 | { |
17 | - if (! $request->expectsJson()) { |
|
18 | - if($request->is('admin') || $request->is('admin/*')) { |
|
17 | + if (!$request->expectsJson()) { |
|
18 | + if ($request->is('admin') || $request->is('admin/*')) { |
|
19 | 19 | return route('admin.login'); |
20 | - } else if($request->is('doctor') || $request->is('doctor/*')) { |
|
20 | + } else if ($request->is('doctor') || $request->is('doctor/*')) { |
|
21 | 21 | return route('doctor.login'); |
22 | 22 | } else { |
23 | 23 | return route('login'); |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Auth\Middleware\Authenticate as Middleware; |
6 | 6 | |
7 | -class Authenticate extends Middleware |
|
8 | -{ |
|
7 | +class Authenticate extends Middleware { |
|
9 | 8 | /** |
10 | 9 | * Get the path the user should be redirected to when they are not authenticated. |
11 | 10 | * |
@@ -30,7 +30,7 @@ |
||
30 | 30 | break; |
31 | 31 | default: |
32 | 32 | if (Auth::guard($guard)->check()) { |
33 | - return redirect()->route('home'); |
|
33 | + return redirect()->route('home'); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 |
@@ -17,14 +17,14 @@ |
||
17 | 17 | */ |
18 | 18 | public function handle($request, Closure $next, $guard = null) |
19 | 19 | { |
20 | - switch($guard) { |
|
20 | + switch ($guard) { |
|
21 | 21 | case 'admin': |
22 | - if(Auth::guard($guard)->check()) { |
|
22 | + if (Auth::guard($guard)->check()) { |
|
23 | 23 | return redirect()->route('admin.index'); |
24 | 24 | } |
25 | 25 | break; |
26 | 26 | case 'doctor': |
27 | - if(Auth::guard($guard)->check()) { |
|
27 | + if (Auth::guard($guard)->check()) { |
|
28 | 28 | return redirect()->route('admin.index'); |
29 | 29 | } |
30 | 30 | break; |
@@ -5,8 +5,7 @@ |
||
5 | 5 | use Closure; |
6 | 6 | use Illuminate\Support\Facades\Auth; |
7 | 7 | |
8 | -class RedirectIfAuthenticated |
|
9 | -{ |
|
8 | +class RedirectIfAuthenticated { |
|
10 | 9 | /** |
11 | 10 | * Handle an incoming request. |
12 | 11 | * |
@@ -59,7 +59,7 @@ |
||
59 | 59 | private function sendFailedLoginResponse(Request $request) |
60 | 60 | { |
61 | 61 | throw ValidationException::withMessages([ |
62 | - 'email' => [trans('auth.failed')], |
|
62 | + 'email' => [trans('auth.failed')], |
|
63 | 63 | ]); |
64 | 64 | } |
65 | 65 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | 'password' => 'required|min:6' |
35 | 35 | ]); |
36 | 36 | |
37 | - if($validate->fails()) { |
|
37 | + if ($validate->fails()) { |
|
38 | 38 | return redirect()->back()->withErrors($validate); |
39 | 39 | } |
40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ]; |
45 | 45 | |
46 | 46 | // Attempt Login |
47 | - if(Auth::guard('doctor')->attempt($credentials, $request->remember)) { |
|
47 | + if (Auth::guard('doctor')->attempt($credentials, $request->remember)) { |
|
48 | 48 | // If 'true' -> redirect to admin.index |
49 | 49 | session([ |
50 | 50 | 'role' => 'Doctor', |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | private function sendFailedLoginResponse(Request $request) |
60 | 60 | { |
61 | 61 | throw ValidationException::withMessages([ |
62 | - 'email' => [trans('auth.failed')], |
|
62 | + 'email' => [ trans('auth.failed') ], |
|
63 | 63 | ]); |
64 | 64 | } |
65 | 65 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | use Illuminate\Support\Facades\Validator; |
9 | 9 | use Illuminate\Validation\ValidationException; |
10 | 10 | |
11 | -class DoctorLoginController extends Controller |
|
12 | -{ |
|
11 | +class DoctorLoginController extends Controller { |
|
13 | 12 | |
14 | 13 | public function __construct() |
15 | 14 | { |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | protected function validator(array $data) |
50 | 50 | { |
51 | 51 | return Validator::make($data, [ |
52 | - 'name' => ['required', 'string', 'max:255'], |
|
53 | - 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
|
54 | - 'password' => ['required', 'string', 'min:8', 'confirmed'], |
|
52 | + 'name' => [ 'required', 'string', 'max:255' ], |
|
53 | + 'email' => [ 'required', 'string', 'email', 'max:255', 'unique:users' ], |
|
54 | + 'password' => [ 'required', 'string', 'min:8', 'confirmed' ], |
|
55 | 55 | ]); |
56 | 56 | } |
57 | 57 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | protected function create(array $data) |
65 | 65 | { |
66 | 66 | return User::create([ |
67 | - 'name' => $data['name'], |
|
68 | - 'email' => $data['email'], |
|
69 | - 'password' => Hash::make($data['password']), |
|
67 | + 'name' => $data[ 'name' ], |
|
68 | + 'email' => $data[ 'email' ], |
|
69 | + 'password' => Hash::make($data[ 'password' ]), |
|
70 | 70 | ]); |
71 | 71 | } |
72 | 72 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | use Illuminate\Support\Facades\Validator; |
9 | 9 | use Illuminate\Foundation\Auth\RegistersUsers; |
10 | 10 | |
11 | -class RegisterController extends Controller |
|
12 | -{ |
|
11 | +class RegisterController extends Controller { |
|
13 | 12 | /* |
14 | 13 | |-------------------------------------------------------------------------- |
15 | 14 | | Register Controller |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | 'password' => 'required|min:6' |
35 | 35 | ]); |
36 | 36 | |
37 | - if($validate->fails()) { |
|
37 | + if ($validate->fails()) { |
|
38 | 38 | return redirect()->back()->withErrors($validate); |
39 | 39 | } |
40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ]; |
45 | 45 | |
46 | 46 | // Attempt Login |
47 | - if(Auth::guard('admin')->attempt($credentials, $request->remember)) { |
|
47 | + if (Auth::guard('admin')->attempt($credentials, $request->remember)) { |
|
48 | 48 | // If 'true' -> redirect to admin.index |
49 | 49 | session([ |
50 | 50 | 'role' => 'Admin', |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | private function sendFailedLoginResponse(Request $request) |
61 | 61 | { |
62 | 62 | throw ValidationException::withMessages([ |
63 | - 'email' => [trans('auth.failed')], |
|
63 | + 'email' => [ trans('auth.failed') ], |
|
64 | 64 | ]); |
65 | 65 | } |
66 | 66 |
@@ -8,8 +8,7 @@ |
||
8 | 8 | use Illuminate\Support\Facades\Validator; |
9 | 9 | use Illuminate\Validation\ValidationException; |
10 | 10 | |
11 | -class AdminLoginController extends Controller |
|
12 | -{ |
|
11 | +class AdminLoginController extends Controller { |
|
13 | 12 | |
14 | 13 | public function __construct() |
15 | 14 | { |
@@ -15,12 +15,12 @@ |
||
15 | 15 | |
16 | 16 | public function index() |
17 | 17 | { |
18 | - $user = User::orderBy('name','asc')->paginate(10); |
|
18 | + $user = User::orderBy('name', 'asc')->paginate(10); |
|
19 | 19 | $data = [ |
20 | 20 | 'role' => session('role'), |
21 | 21 | 'user' => $user, |
22 | 22 | ]; |
23 | - return view('pages.member')->with('data',$data); |
|
23 | + return view('pages.member')->with('data', $data); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -5,8 +5,7 @@ |
||
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | use App\User; |
7 | 7 | |
8 | -class MemberController extends Controller |
|
9 | -{ |
|
8 | +class MemberController extends Controller { |
|
10 | 9 | /** |
11 | 10 | * Display a listing of the resource. |
12 | 11 | * |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | protected function mapWebRoutes() |
53 | 53 | { |
54 | 54 | Route::middleware('web') |
55 | - ->namespace($this->namespace) |
|
56 | - ->group(base_path('routes/web.php')); |
|
55 | + ->namespace($this->namespace) |
|
56 | + ->group(base_path('routes/web.php')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | protected function mapApiRoutes() |
67 | 67 | { |
68 | 68 | Route::prefix('api') |
69 | - ->middleware('api') |
|
70 | - ->namespace($this->namespace) |
|
71 | - ->group(base_path('routes/api.php')); |
|
69 | + ->middleware('api') |
|
70 | + ->namespace($this->namespace) |
|
71 | + ->group(base_path('routes/api.php')); |
|
72 | 72 | } |
73 | 73 | } |
@@ -5,8 +5,7 @@ |
||
5 | 5 | use Illuminate\Support\Facades\Route; |
6 | 6 | use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
7 | 7 | |
8 | -class RouteServiceProvider extends ServiceProvider |
|
9 | -{ |
|
8 | +class RouteServiceProvider extends ServiceProvider { |
|
10 | 9 | /** |
11 | 10 | * This namespace is applied to your controller routes. |
12 | 11 | * |