app/Http/Controllers/Admin/RideController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(StoreRideRequest $request)
    {
        $ride = Auth::user()->company()->rides()->create($request->validated());
        if ($request->ride_type == 'cyclic') {
            $requestData = collect($request->validated());
            $rideScheduleData = $requestData
                ->only('start_date', 'end_date')
                ->merge($requestData->get('days'))
                ->toArray();
            $ride->schedule()->create($rideScheduleData);
        }
        return redirect()->route('admin.rides.index')->withSuccess('Ride created successfully.');
    }
public function store ( StoreRideRequest $ request ) { $ ride = Auth :: user ( ) -> company ( ) -> rides ( ) -> create ( $ request -> validated ( ) ) ; if ( $ request -> ride_type == 'cyclic' ) { $ requestData = collect ( $ request -> validated ( ) ) ; $ rideScheduleData = $ requestData -> only ( 'start_date' , 'end_date' ) -> merge ( $ requestData -> get ( 'days' ) ) -> toArray ( ) ; $ ride -> schedule ( ) -> create ( $ rideScheduleData ) ; } return redirect ( ) -> route ( 'admin.rides.index' ) -> withSuccess ( 'Ride created successfully.' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//