app/Http/Controllers/Create_tripController.php
//show user's visited trips
show user's visited trips
show user ' s visited trips
public function user_visited_trip($email)                                                 
    {
        $user_trip_id= Trip_participation::where('user_email',$email)->where('trip_status','=','end')->get('trip_id');
        $trip=array();
        $i=1;
        foreach ($user_trip_id as $key => $user) 
        {  
           $trip[$i]= Create_trip::where('trip_id',$user->trip_id)->get();
           $i++;   
        }
        return response()->json($trip);
    }
public function user_visited_trip ( $ email ) { $ user_trip_id = Trip_participation :: where ( 'user_email' , $ email ) -> where ( 'trip_status' , '=' , 'end' ) -> get ( 'trip_id' ) ; $ trip = array ( ) ; $ i = 1 ; foreach ( $ user_trip_id as $ key => $ user ) { $ trip [ $ i ] = Create_trip :: where ( 'trip_id' , $ user -> trip_id ) -> get ( ) ; $ i ++ ; } return response ( ) -> json ( $ trip ) ; }
show user's visited trips
show user ' s visited trips
//**also for trip_org**// //from here we get  trip_id but it is in form of array and we have to find details of all these trip id and send them in response// //$trip[$i] = array(); //trip_id/name , trip_org ,  destination , time, rating.