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)
    {
        $request->validate([
            'nama' => 'required',
            'invoice' => 'required',
            'total' => 'required',
        ],
        [
            'nama.required' => 'nama custumer tidak boleh kosong',
            'invoice.required' => 'invoice tidak boleh kosong',
            'total.required' => 'total tidak boleh kosong',
        ]
    );
        OrderModel::create([
            'customer_name' => $request->nama,
            'invoice' => $request->invoice,
            'total' => $request->total,
            'status_order' => $request->status_order
        ]);
        return redirect('/order')->with('status', 'data berhasil ditambahkan');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'nama' => 'required' , 'invoice' => 'required' , 'total' => 'required' , ] , [ 'nama.required' => 'nama custumer tidak boleh kosong' , 'invoice.required' => 'invoice tidak boleh kosong' , 'total.required' => 'total tidak boleh kosong' , ] ) ; OrderModel :: create ( [ 'customer_name' => $ request -> nama , 'invoice' => $ request -> invoice , 'total' => $ request -> total , 'status_order' => $ request -> status_order ] ) ; return redirect ( '/order' ) -> with ( 'status' , 'data berhasil ditambahkan' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//return $request;