app/Http/Controllers/PersonnesController.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)
    {
        $personne = Personne::create([
            'nom'           => $request->input('nom'),
            'prenom'           => $request->input('prenom'),
            'datenaiss'           => $request->input('datenaiss'),
            'lieunaiss'           => $request->input('lieunaiss'),
            'tel'           => $request->input('tel'),
            'email'           => $request->input('email'),
            'cq'           => $request->input('cq'),
            'ville'           => $request->input('ville')
        ]);
        if($personne){
            $user = User::create([
                'personne_id'       => $personne->id,
                'name'              => $personne->nom. ' '. $personne->prenom,
                'login'             => $personne->nom. ' '. $personne->prenom,
                'email'             => $personne->email,
                'password'          => Hash::make($request->input('password')),
                'statut_user'       => 0
            ]);
            if($user){
                $compte = Compte::create([
                    'user_id'           => $user->id,
                    'structure_id'      => 0,
                    'typecompte_id'     => 1,
                ]);
                if($compte) {
                    return redirect('/login');
                }
            }
        }
    }
public function store ( Request $ request ) { $ personne = Personne :: create ( [ 'nom' => $ request -> input ( 'nom' ) , 'prenom' => $ request -> input ( 'prenom' ) , 'datenaiss' => $ request -> input ( 'datenaiss' ) , 'lieunaiss' => $ request -> input ( 'lieunaiss' ) , 'tel' => $ request -> input ( 'tel' ) , 'email' => $ request -> input ( 'email' ) , 'cq' => $ request -> input ( 'cq' ) , 'ville' => $ request -> input ( 'ville' ) ] ) ; if ( $ personne ) { $ user = User :: create ( [ 'personne_id' => $ personne -> id , 'name' => $ personne -> nom . ' ' . $ personne -> prenom , 'login' => $ personne -> nom . ' ' . $ personne -> prenom , 'email' => $ personne -> email , 'password' => Hash :: make ( $ request -> input ( 'password' ) ) , 'statut_user' => 0 ] ) ; if ( $ user ) { $ compte = Compte :: create ( [ 'user_id' => $ user -> id , 'structure_id' => 0 , 'typecompte_id' => 1 , ] ) ; if ( $ compte ) { return redirect ( '/login' ) ; } } } }
Store a newly created resource in storage.
Store a newly created resource in storage .