example-app/app/Http/Controllers/Backsite/AppointmentBacksiteController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        abort_if(Gate::denies('appointment_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');
        $type_user_condition = Auth::user()->detail_user->type_user_id;
        if($type_user_condition == 1){
            $appointment = Appointment::orderBy('created_at', 'desc')->get();
        }else{
            $appointment = Appointment::orderBy('created_at', 'desc')->get();
        }
        return view('pages.backsite.operational.appointment.index', compact('appointment'));
    }
public function index ( ) { abort_if ( Gate :: denies ( 'appointment_access' ) , Response :: HTTP_FORBIDDEN , '403 Forbidden' ) ; $ type_user_condition = Auth :: user ( ) -> detail_user -> type_user_id ; if ( $ type_user_condition == 1 ) { $ appointment = Appointment :: orderBy ( 'created_at' , 'desc' ) -> get ( ) ; } else { $ appointment = Appointment :: orderBy ( 'created_at' , 'desc' ) -> get ( ) ; } return view ( 'pages.backsite.operational.appointment.index' , compact ( 'appointment' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .
// pasang gate untuk menolak akses ketika tidak punya permissions // Pasang kondisi untuk masing-masing detail users // for admin // Other admin for doctor & patient (task for everyone here)