app/Http/Controllers/Api/BookingController.php
/**
     * Get available seats number to the specified resource from storage.
     *
     * @param  TripRequest  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Get available seats number to the specified resource from storage.
@param  TripRequest  $request
@param  int  $id
@return \Illuminate\Http\Response
Get available seats number to the specified resource from storage . @param TripRequest $request @param int $id @return \ Illuminate \ Http \ Response
public function available(BookingRequest $request, Trip $trip)
    {
        if (!($user = $trip->users()->find(auth('api')->id()))) {
            $checked = $this->checkBooking($trip, Station::find($request->pickup_station_id), Station::find($request->arrival_station_id), 0);
            return $this->success(collect($checked)->except('can_book_a_seat'));
        } else {
            return $this->error([], "\"$user->name\" has already a booked seat.", 200);
        }
    }
public function available ( BookingRequest $ request , Trip $ trip ) { if ( ! ( $ user = $ trip -> users ( ) -> find ( auth ( 'api' ) -> id ( ) ) ) ) { $ checked = $ this -> checkBooking ( $ trip , Station :: find ( $ request -> pickup_station_id ) , Station :: find ( $ request -> arrival_station_id ) , 0 ) ; return $ this -> success ( collect ( $ checked ) -> except ( 'can_book_a_seat' ) ) ; } else { return $ this -> error ( [ ] , " \" $ user -> name \"  has already a booked seat. " , 200 ) ; } }
Get available seats number to the specified resource from storage.
Get available seats number to the specified resource from storage .