app/Http/Controllers/ComunasController.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([
            'nombre'=>'required',
            'region_id'=>'required',
        ]);
        $comuna = new Comunas();
        $comuna->nombre = $request->get('nombre');
        $comuna->region_id = $request->get('region_id');
        $comuna->save();
        return redirect('admin/comunas')->with('success', 'Comuna creada...!');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'nombre' => 'required' , 'region_id' => 'required' , ] ) ; $ comuna = new Comunas ( ) ; $ comuna -> nombre = $ request -> get ( 'nombre' ) ; $ comuna -> region_id = $ request -> get ( 'region_id' ) ; $ comuna -> save ( ) ; return redirect ( 'admin/comunas' ) -> with ( 'success' , 'Comuna creada...!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .