app/Http/Controllers/CarController.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)
    {
        $validatedData = $request->validate([
            'car_name' => 'required|max:255',
            'car_price' => 'required|numeric',
            'car_stock' => 'required|numeric',
        ]);
        Car::create($validatedData);
        return redirect()->route('car.index')->with('success','Data Successfully Added');
    }
public function store ( Request $ request ) { $ validatedData = $ request -> validate ( [ 'car_name' => 'required|max:255' , 'car_price' => 'required|numeric' , 'car_stock' => 'required|numeric' , ] ) ; Car :: create ( $ validatedData ) ; return redirect ( ) -> route ( 'car.index' ) -> with ( 'success' , 'Data Successfully Added' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .