app/Http/Controllers/dashboard/admin/UsersController.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)
    {
        if ($this->protectSuperUser($request->post('role_id'))) return $this->status('error', 'access denied');
        $this->rules['password'] = ["required", "min:8", "confirmed"];
        $request->validate($this->rules);
        $data = [
            "username" => strtolower($request->post('username')),
            "password" => bcrypt($request->post('password')),
            "email" => strtolower($request->post('email')),
            "role_id" => $request->post('role_id')
        ];
        $response = new User($data);
        if (!$response->save()) return $this->status();
        return $this->status('success', "success add new user");
    }
public function store ( Request $ request ) { if ( $ this -> protectSuperUser ( $ request -> post ( 'role_id' ) ) ) return $ this -> status ( 'error' , 'access denied' ) ; $ this -> rules [ 'password' ] = [ " required " , " min:8 " , " confirmed " ] ; $ request -> validate ( $ this -> rules ) ; $ data = [ " username " => strtolower ( $ request -> post ( 'username' ) ) , " password " => bcrypt ( $ request -> post ( 'password' ) ) , " email " => strtolower ( $ request -> post ( 'email' ) ) , " role_id " => $ request -> post ( 'role_id' ) ] ; $ response = new User ( $ data ) ; if ( ! $ response -> save ( ) ) return $ this -> status ( ) ; return $ this -> status ( 'success' , " success add new user " ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .