app/Http/Controllers/RegionesController.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',
            'subtitulo'=>'required',
            'descripcion'=>'required',
            'num_horas'=>'required',
            'num_clases'=>'required',
            'asignatura_id'=>'required',
            'nivel_id'=>'required',
        ]);
        $region = new Regiones();
        $region->nombre = $request->get('nombre');
        $region->subtitulo = $request->get('subtitulo');
        $region->descripcion = $request->get('descripcion');
        $region->num_horas = $request->get('num_horas');
        $region->num_clases = $request->get('num_clases');
        $region->asignatura_id = $request->get('asignatura_id');
        $region->nivel_id = $request->get('nivel_id');
        $region->save();
        return redirect('admin/regiones')->with('success', 'Region creada...!');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'nombre' => 'required' , 'subtitulo' => 'required' , 'descripcion' => 'required' , 'num_horas' => 'required' , 'num_clases' => 'required' , 'asignatura_id' => 'required' , 'nivel_id' => 'required' , ] ) ; $ region = new Regiones ( ) ; $ region -> nombre = $ request -> get ( 'nombre' ) ; $ region -> subtitulo = $ request -> get ( 'subtitulo' ) ; $ region -> descripcion = $ request -> get ( 'descripcion' ) ; $ region -> num_horas = $ request -> get ( 'num_horas' ) ; $ region -> num_clases = $ request -> get ( 'num_clases' ) ; $ region -> asignatura_id = $ request -> get ( 'asignatura_id' ) ; $ region -> nivel_id = $ request -> get ( 'nivel_id' ) ; $ region -> save ( ) ; return redirect ( 'admin/regiones' ) -> with ( 'success' , 'Region creada...!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .