app/Http/Controllers/EleveController.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, Tuteur $tuteur)
    {
        $data= request()->validate([
            'prenom'=>'required',
            'nom'=>'required',
            'naissance'=>'required',
            'sexe'=>'required',
            'niveau'=> 'required',
          ]);
          $data = array_merge($data, ['tuteur_id'=>$tuteur->id]);
          Eleve::create($data);
          return redirect('tuteurs/'.$tuteur->id); 
    }
public function store ( Request $ request , Tuteur $ tuteur ) { $ data = request ( ) -> validate ( [ 'prenom' => 'required' , 'nom' => 'required' , 'naissance' => 'required' , 'sexe' => 'required' , 'niveau' => 'required' , ] ) ; $ data = array_merge ( $ data , [ 'tuteur_id' => $ tuteur -> id ] ) ; Eleve :: create ( $ data ) ; return redirect ( 'tuteurs/' . $ tuteur -> id ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .