app/Http/Controllers/Laundry/BranchesController.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([
            'city' => 'required',
            'street' => 'required',
            'type' => 'required'
        ]);
        $laundry = Laundry::findOrFail($request->input('laundry'));
        $laundry->branches()->create([
            'city' => $data['city'],
            'street' => $data['street'],
            'type' => $data['type']
        ]);
        return back()->with('success','Branch successfully added.');
    }
public function store ( Request $ request ) { $ data = $ request -> validate ( [ 'city' => 'required' , 'street' => 'required' , 'type' => 'required' ] ) ; $ laundry = Laundry :: findOrFail ( $ request -> input ( 'laundry' ) ) ; $ laundry -> branches ( ) -> create ( [ 'city' => $ data [ 'city' ] , 'street' => $ data [ 'street' ] , 'type' => $ data [ 'type' ] ] ) ; return back ( ) -> with ( 'success' , 'Branch successfully added.' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .