app/Http/Controllers/CustomerController.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([
            'name' => 'bail|required|unique:customers|max:255',
        ]);
        Customer::create([
            'name' => $request->get('name'),
            'category_id' => $request->get('category_id'),
        ]);
        return redirect('/clientes')->with('success', 'Contact saved!');
    }
public function store ( Request $ request ) { $ validatedData = $ request -> validate ( [ 'name' => 'bail|required|unique:customers|max:255' , ] ) ; Customer :: create ( [ 'name' => $ request -> get ( 'name' ) , 'category_id' => $ request -> get ( 'category_id' ) , ] ) ; return redirect ( '/clientes' ) -> with ( 'success' , 'Contact saved!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .