app/Http/Controllers/Laundry/ServicesController.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(Request $request)
    {
        $data =  $request->validate([
            'service' => 'required'
        ]);
        $laundry = Laundry::findOrFail($request->input('laundry'));
        $laundry->services()->create([
            'name' => $data['service']
        ]);
        return back();
    }
public function store ( Request $ request ) { $ data = $ request -> validate ( [ 'service' => 'required' ] ) ; $ laundry = Laundry :: findOrFail ( $ request -> input ( 'laundry' ) ) ; $ laundry -> services ( ) -> create ( [ 'name' => $ data [ 'service' ] ] ) ; return back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .