app/Http/Controllers/ApprovedController.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)
    {
        $user = User::where('email', '=', $request->get('email'))->first();
        if ($user == null) {
            $user = new User;
            $user->email = $request->email;
            $user->password = bcrypt($request->password);
            $user->fullname = $request->fullname;
            $user->dob = $request->dob;
            $user->sex = $request->sex;
            $user->status = 0;
            $user->isAdmin = 0;
            $user->save();
            $request->session()->flash('alert-success', 'Đã tạo tài khoản thành công');
            return redirect('notapproved');
        }
        $request->session()->flash('alert-danger', 'Tài khoản đã tồn tại');
        return redirect()->back();
    }
public function store ( Request $ request ) { $ user = User :: where ( 'email' , '=' , $ request -> get ( 'email' ) ) -> first ( ) ; if ( $ user == null ) { $ user = new User ; $ user -> email = $ request -> email ; $ user -> password = bcrypt ( $ request -> password ) ; $ user -> fullname = $ request -> fullname ; $ user -> dob = $ request -> dob ; $ user -> sex = $ request -> sex ; $ user -> status = 0 ; $ user -> isAdmin = 0 ; $ user -> save ( ) ; $ request -> session ( ) -> flash ( 'alert-success' , 'Đã tạo tài khoản thành công'); return redirect ( 'notapproved' ) ; } $ request -> session ( ) -> flash ( 'alert-danger' , 'Tài khoản đã tồn tại'); return redirect ( ) -> back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .