app/Http/Controllers/Create_tripController.php
//show trip details by using trip_id
show trip details by using trip_id
show trip details by using trip_id
public function show_trip_detail($trip_id)
    {
          $trip = Create_trip::where('trip_id', $trip_id)->get();
          $trip_schedule = Trip_schedule::where('trip_id', $trip_id)->first();
          $user_email= Trip_participation::where('trip_id',$trip_id)->get('email')->distinct();
            $user = array();
            $i=1;
            foreach ($user_email as $key => $email)
            {
                 $user[$i] = User::where('email',$user_email)->first();
                 $i++;
            }
          $trip_activity = Checkpoint::where('trip_id',$trip_id)->get();
          return response()->json($trip , $trip_schedule, $user_email, $trip_activity);
    }
public function show_trip_detail ( $ trip_id ) { $ trip = Create_trip :: where ( 'trip_id' , $ trip_id ) -> get ( ) ; $ trip_schedule = Trip_schedule :: where ( 'trip_id' , $ trip_id ) -> first ( ) ; $ user_email = Trip_participation :: where ( 'trip_id' , $ trip_id ) -> get ( 'email' ) -> distinct ( ) ; $ user = array ( ) ; $ i = 1 ; foreach ( $ user_email as $ key => $ email ) { $ user [ $ i ] = User :: where ( 'email' , $ user_email ) -> first ( ) ; $ i ++ ; } $ trip_activity = Checkpoint :: where ( 'trip_id' , $ trip_id ) -> get ( ) ; return response ( ) -> json ( $ trip , $ trip_schedule , $ user_email , $ trip_activity ) ; }
show trip details by using trip_id
show trip details by using trip_id