app/Http/Controllers/Api/Admin/UserController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  CreateRequest  $request
     * @return JsonResponse
     * @throws Throwable
     */
Store a newly created resource in storage.
@param  CreateRequest  $request
@return JsonResponse
@throws Throwable
Store a newly created resource in storage . @param CreateRequest $request @return JsonResponse @throws Throwable
public function store(CreateRequest $request): JsonResponse
    {
        $user = new User;
        DB::transaction(function () use ($user, $request) {
            $user
                ->setUuid(Uuid::uuid4())
                ->setName($request->get('name'))
                ->setEmail($request->get('email'))
                ->setPassword(bin2hex(openssl_random_pseudo_bytes(32)))
                ->save();
        });
        activity('admin')
            ->performedOn($user)
            ->causedBy(auth()->user())
            ->withProperties($request->all())
            ->log('created user');
        return response()->json([
            'message' => __('User has been created.'),
        ], HttpResponse::HTTP_OK);
    }
public function store ( CreateRequest $ request ) : JsonResponse { $ user = new User ; DB :: transaction ( function ( ) use ( $ user , $ request ) { $ user -> setUuid ( Uuid :: uuid4 ( ) ) -> setName ( $ request -> get ( 'name' ) ) -> setEmail ( $ request -> get ( 'email' ) ) -> setPassword ( bin2hex ( openssl_random_pseudo_bytes ( 32 ) ) ) -> save ( ) ; } ) ; activity ( 'admin' ) -> performedOn ( $ user ) -> causedBy ( auth ( ) -> user ( ) ) -> withProperties ( $ request -> all ( ) ) -> log ( 'created user' ) ; return response ( ) -> json ( [ 'message' => __ ( 'User has been created.' ) , ] , HttpResponse :: HTTP_OK ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .