| @@ -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; | 
| @@ -7,8 +7,7 @@ | ||
| 7 | 7 | use Carbon\Carbon; | 
| 8 | 8 | use Illuminate\Foundation\Auth\User as Authenticatable; | 
| 9 | 9 | |
| 10 | -class User extends Authenticatable | |
| 11 | -{ | |
| 10 | +class User extends Authenticatable { | |
| 12 | 11 | use Notifiable; | 
| 13 | 12 | |
| 14 | 13 | /** | 
| @@ -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; | 
| @@ -7,8 +7,7 @@ | ||
| 7 | 7 | use Illuminate\Contracts\Auth\MustVerifyEmail; | 
| 8 | 8 | use Illuminate\Foundation\Auth\User as Authenticatable; | 
| 9 | 9 | |
| 10 | -class Doctor extends Authenticatable | |
| 11 | -{ | |
| 10 | +class Doctor extends Authenticatable { | |
| 12 | 11 | use Notifiable; | 
| 13 | 12 | |
| 14 | 13 | protected $guard = 'doctor'; | 
| @@ -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 | * | 
| @@ -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 | * | 
| @@ -47,13 +47,13 @@ discard block | ||
| 47 | 47 | 'updated_at' => Carbon::now() | 
| 48 | 48 | )); | 
| 49 | 49 | |
| 50 | -        if($room_id != null && $hospital_id != null) { | |
| 50 | +        if ($room_id != null && $hospital_id != null) { | |
| 51 | 51 | $data = [ | 
| 52 | 52 | 'hospital_id' => $hospital_id, | 
| 53 | 53 | 'room_id' => $room_id | 
| 54 | 54 | ]; | 
| 55 | 55 | |
| 56 | -            if($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) { | |
| 56 | +            if ($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) { | |
| 57 | 57 |                  return redirect(route('hospital.show', $hospital_id)); | 
| 58 | 58 | } | 
| 59 | 59 | } | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | |
| 113 | 113 |          $hospital = $this->updateHospitalUpdatedAt($request->input('hospital_id')); | 
| 114 | 114 | |
| 115 | -        if($room->save() && $hospital == true) { | |
| 115 | +        if ($room->save() && $hospital == true) { | |
| 116 | 116 |              return redirect(route('hospital.show', $request->input('hospital_id'))); | 
| 117 | 117 | } | 
| 118 | 118 | } | 
| @@ -130,8 +130,8 @@ discard block | ||
| 130 | 130 | $hospital = $this->updateHospitalUpdatedAt($hospital_id); | 
| 131 | 131 | $detail = $this->deleteRoomDetails($room_id, $hospital_id); | 
| 132 | 132 | |
| 133 | -        if($room && $hospital && $detail) { | |
| 134 | -            return redirect(route('hospital.show', ['id' => $hospital_id])); | |
| 133 | +        if ($room && $hospital && $detail) { | |
| 134 | +            return redirect(route('hospital.show', [ 'id' => $hospital_id ])); | |
| 135 | 135 | } | 
| 136 | 136 | } | 
| 137 | 137 | |
| @@ -143,11 +143,11 @@ discard block | ||
| 143 | 143 |      { | 
| 144 | 144 |          $insert = DB::table('room_details') | 
| 145 | 145 | ->insert([ | 
| 146 | - 'room_id' => $data['room_id'], | |
| 147 | - 'hospital_id' => $data['hospital_id'] | |
| 146 | + 'room_id' => $data[ 'room_id' ], | |
| 147 | + 'hospital_id' => $data[ 'hospital_id' ] | |
| 148 | 148 | ]); | 
| 149 | 149 | |
| 150 | -        if($insert) { | |
| 150 | +        if ($insert) { | |
| 151 | 151 | return true; | 
| 152 | 152 | } | 
| 153 | 153 | |
| @@ -166,7 +166,7 @@ discard block | ||
| 166 | 166 |              ->where('hospital_id', '=', $hospital_id) | 
| 167 | 167 | ->delete(); | 
| 168 | 168 | |
| 169 | -        if($delete) { | |
| 169 | +        if ($delete) { | |
| 170 | 170 | return true; | 
| 171 | 171 | } | 
| 172 | 172 | |
| @@ -181,7 +181,7 @@ discard block | ||
| 181 | 181 |      { | 
| 182 | 182 | $hospital = Hospital::find($id); | 
| 183 | 183 | $hospital->updated_at = Carbon::now(); | 
| 184 | -        if($hospital->save()) { | |
| 184 | +        if ($hospital->save()) { | |
| 185 | 185 | return true; | 
| 186 | 186 | } | 
| 187 | 187 | |
| @@ -8,8 +8,7 @@ | ||
| 8 | 8 | use App\Hospital; | 
| 9 | 9 | use App\Room; | 
| 10 | 10 | |
| 11 | -class RoomController extends Controller | |
| 12 | -{ | |
| 11 | +class RoomController extends Controller { | |
| 13 | 12 | /** | 
| 14 | 13 | * Show the form for creating a new resource. | 
| 15 | 14 | * | 
| @@ -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 |      { | 
| @@ -32,7 +32,7 @@ discard block | ||
| 32 | 32 | $user = null; | 
| 33 | 33 | $err = null; | 
| 34 | 34 | |
| 35 | -        if($provider == 'google') { | |
| 35 | +        if ($provider == 'google') { | |
| 36 | 36 | $user = Socialite::driver($provider)->stateless()->user(); | 
| 37 | 37 |          } else { | 
| 38 | 38 | $user = Socialite::driver($provider)->user(); | 
| @@ -40,13 +40,13 @@ discard block | ||
| 40 | 40 | |
| 41 | 41 | $authUser = $this->findOrCreateUser($user, $provider); | 
| 42 | 42 | |
| 43 | -        $attempt = Auth::guard('web')->attempt(['email' => $authUser->email, 'password' => $authUser->provider_id]); | |
| 43 | +        $attempt = Auth::guard('web')->attempt([ 'email' => $authUser->email, 'password' => $authUser->provider_id ]); | |
| 44 | 44 | |
| 45 | 45 | $req = new Request([ | 
| 46 | 46 | 'email' => $authUser->email, | 
| 47 | 47 | ]); | 
| 48 | 48 | |
| 49 | -        if($attempt) { | |
| 49 | +        if ($attempt) { | |
| 50 | 50 | $msg = "Selamat Datang ".$authUser->name." !"; | 
| 51 | 51 |              return redirect(route('home'))->with('info', $msg); | 
| 52 | 52 | } | 
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 | private function findOrCreateUser($user, $provider) | 
| 66 | 66 |      { | 
| 67 | 67 |          $authUser = User::where('email', $user->getEmail())->first(); | 
| 68 | -        if($authUser) { | |
| 68 | +        if ($authUser) { | |
| 69 | 69 | return $authUser; | 
| 70 | 70 | } | 
| 71 | 71 | |
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | private function sendFailedLoginResponse(Request $request) | 
| 85 | 85 |      { | 
| 86 | 86 | throw ValidationException::withMessages([ | 
| 87 | -            'email' => [trans('auth.failed')], | |
| 87 | +            'email' => [ trans('auth.failed') ], | |
| 88 | 88 | ]); | 
| 89 | 89 | |
| 90 | 90 | } | 
| @@ -10,8 +10,7 @@ | ||
| 10 | 10 | use Illuminate\Validation\ValidationException; | 
| 11 | 11 | use Laravel\Socialite\Facades\Socialite; | 
| 12 | 12 | |
| 13 | -class OAuthController extends Controller | |
| 14 | -{ | |
| 13 | +class OAuthController extends Controller { | |
| 15 | 14 | |
| 16 | 15 | public function redirectToProvider($provider) | 
| 17 | 16 |      { | 
| @@ -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 |      { |