app/Http/Controllers/OrderController.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)
    {
        $user=User::all();
        $data=request()->validate([
           'name'=>'required',
           'email'=>'required',
           'Quantity'=>'required',
           'size'=>'required',
           'phone'=>'required',
            'product_name'=>'required',
            'address'=>'required',
            'message'=>'required'
        ]);
        $order=Order::create([
            'name'=>$data['name'],
            'email'=>$data['email'],
            'Quantity'=>$data['Quantity'],
            'size'=>$data['size'],
            'phone'=>$data['phone'],
            'product_name'=>$data['product_name'],
            'address'=>$data['address'],
            'message'=>$data['message'],
        ]);
        Notification::send($user, new OrderNotification($order));
        return redirect('/');
    }
public function store ( Request $ request ) { $ user = User :: all ( ) ; $ data = request ( ) -> validate ( [ 'name' => 'required' , 'email' => 'required' , 'Quantity' => 'required' , 'size' => 'required' , 'phone' => 'required' , 'product_name' => 'required' , 'address' => 'required' , 'message' => 'required' ] ) ; $ order = Order :: create ( [ 'name' => $ data [ 'name' ] , 'email' => $ data [ 'email' ] , 'Quantity' => $ data [ 'Quantity' ] , 'size' => $ data [ 'size' ] , 'phone' => $ data [ 'phone' ] , 'product_name' => $ data [ 'product_name' ] , 'address' => $ data [ 'address' ] , 'message' => $ data [ 'message' ] , ] ) ; Notification :: send ( $ user , new OrderNotification ( $ order ) ) ; return redirect ( '/' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .