mercredi 3 février 2021

Laravel Get Multiple Query Values

I am using Laravel , I have got some users and appointments,

some of the users doest have appointments

I need to view both of my users who has appointments and not

also, I have added a filter that is sorted by date, while sorting I need to sort the appointment by its date and need to display the rest as it is,

is there a way to do this, this is my code

this is my code which i get the all appointments

$appointments = $this->conn->table('appointments')
          ->select('*','response->date','users.id as useid','appointments.id as app_id','appointments.created_at as created_at','appointments.response->date as app_data')
          ->join('users', 'appointments.user_id', '=', 'users.id')
   

this is what i am trying to do

   $appointments = $appointments
          ->whereNull('appointments.response->datetime')
          ->orWhere(DB::raw( "to_char((appointments.response::json->>'datetime')::timestamp, 'MM/DD/YYYY')" ), '>=', $start_date_format)
          ->orWhere([DB::raw( "to_char((appointments.response::json->>'datetime')::timestamp, 'MM/DD/YYYY')" ), '<=', $end_date_format])
          ;

this code display ass the users but when I try to filter this won't work



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire