app/Http/Controllers/ShiftsController.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(Shift $shift)
    {
       request()->validate([
              'shift_name'=>'required',
              'start_time'=>'required',
              'end_time'=>'required'
          ]);
          $shift = new Shift();
          $shift->shift_name=request('shift_name');
          $shift->start_time=request('start_time');
          $shift->end_time=request('end_time');
     $shift->save();
          Branch::create(request(['branch_name','location']));
          return redirect('/shift');
        }
public function store ( Shift $ shift ) { request ( ) -> validate ( [ 'shift_name' => 'required' , 'start_time' => 'required' , 'end_time' => 'required' ] ) ; $ shift -> shift_name = request ( 'shift_name' ) ; $ shift -> start_time = request ( 'start_time' ) ; $ shift -> end_time = request ( 'end_time' ) ; $ shift -> save ( ) ; return redirect ( '/shift' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// //$shift = new Shift(); //Branch::create(request(['branch_name','location']));