app/Http/Controllers/OfferController.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)
    {
        $this->validate($request, [
            "name" => "required|string",
            "discount" => "required|string",
            "discount_type" => "required|string",
            "status" => "required|string"
        ]);
        $offers = new Offer([
            'name' => $request->get('name'),
            'discount' => $request->get('discount'),
            'discount_type' => $request->get('discount_type'),
            'status' => $request->get('status'),
        ]);
        $offers->save();
        return back()->with('successMsg', 'Offer created successfully');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ " name " => " required|string " , " discount " => " required|string " , " discount_type " => " required|string " , " status " => " required|string " ] ) ; $ offers = new Offer ( [ 'name' => $ request -> get ( 'name' ) , 'discount' => $ request -> get ( 'discount' ) , 'discount_type' => $ request -> get ( 'discount_type' ) , 'status' => $ request -> get ( 'status' ) , ] ) ; $ offers -> save ( ) ; return back ( ) -> with ( 'successMsg' , 'Offer created successfully' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .