app/Http/Controllers/Api/v1/AdminController.php
/**
     * Registration for new User
     * @param Request $request
     * @return JsonResponse
     */
Registration for new User
@param Request $request
@return JsonResponse
Registration for new User @param Request $request @return JsonResponse
public function register(Request $request)
    {
        $request->validate([
            'name' => 'required|max:255',
            'email' => "required|email|max:255|unique:users,email",
            'mobile' => "nullable|unique:Users,mobile",
            'password' => 'required|min:6',
            'image' => 'nullable|image|max:1999'
        ]);
        $User = new User();
        $User->name = request('name');
        $User->email = request('email');
        $User->mobile = request('mobile');
        $User->role = request('role');
        $User->password = bcrypt(request('password'));
        if ($User->save()) {
            return \response()->json(array('error' => false, 'success' => "New User Created"), 200);
        }
        return \response()->json(array('error' => "Something went wrong !!"), 400);
    }
public function register ( Request $ request ) { $ request -> validate ( [ 'name' => 'required|max:255' , 'email' => " required|email|max:255|unique:users,email " , 'mobile' => " nullable|unique:Users,mobile " , 'password' => 'required|min:6' , 'image' => 'nullable|image|max:1999' ] ) ; $ User = new User ( ) ; $ User -> name = request ( 'name' ) ; $ User -> email = request ( 'email' ) ; $ User -> mobile = request ( 'mobile' ) ; $ User -> role = request ( 'role' ) ; $ User -> password = bcrypt ( request ( 'password' ) ) ; if ( $ User -> save ( ) ) { return \ response ( ) -> json ( array ( 'error' => false , 'success' => " New User Created " ) , 200 ) ; } return \ response ( ) -> json ( array ( 'error' => " Something went wrong !! " ) , 400 ) ; }
Registration for new User
 @param Request $request
 @return JsonResponse
Registration for new User @param Request $request @return JsonResponse
//$User->active = 1;