app/Http/Controllers/UseCRUDController.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)
    {
        $this->validate($request,array(
            'username' => 'required|string|max:255',
            'firstname' => 'required|string|max:255',
            'lastname' => 'required|string|max:255',
            'email' => 'required|string|email|max:255|unique:users,email',
            'password' => 'required|string|min:6|confirmed',
            ));
        User::create([
            'username' => $request['username'],
            'firstname' => $request['firstname'],
            'lastname' => $request['lastname'],
            'email' => $request['email'],
            'password' => bcrypt($request['password']),
            ]);
         Session::flash('flash_message', 'Create new user successfully!');
        return redirect()->route('admin.home')->with('status', 'User added!');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , array ( 'username' => 'required|string|max:255' , 'firstname' => 'required|string|max:255' , 'lastname' => 'required|string|max:255' , 'email' => 'required|string|email|max:255|unique:users,email' , 'password' => 'required|string|min:6|confirmed' , ) ) ; User :: create ( [ 'username' => $ request [ 'username' ] , 'firstname' => $ request [ 'firstname' ] , 'lastname' => $ request [ 'lastname' ] , 'email' => $ request [ 'email' ] , 'password' => bcrypt ( $ request [ 'password' ] ) , ] ) ; Session :: flash ( 'flash_message' , 'Create new user successfully!' ) ; return redirect ( ) -> route ( 'admin.home' ) -> with ( 'status' , 'User added!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//save //redirect