app/Http/Controllers/DiscountController.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)
    {
        if ( $request->start < date("Y-m-d") || $request->end < $request->start ) {
            return redirect()->back()->with('error','Tanggal start tidak boleh kurang dari hari ini atau tanggal end tidak boleh kurang dari tanggal start!');
        }else{
                $discounts = $request->all();
                Discount::create($discounts);
                return redirect('discount');
        }
    }
public function store ( Request $ request ) { if ( $ request -> start < date ( " Y-m-d " ) || $ request -> end < $ request -> start ) { return redirect ( ) -> back ( ) -> with ( 'error' , 'Tanggal start tidak boleh kurang dari hari ini atau tanggal end tidak boleh kurang dari tanggal start!' ) ; } else { $ discounts = $ request -> all ( ) ; Discount :: create ( $ discounts ) ; return redirect ( 'discount' ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .