1 month ago

How can I generate access error and error message, leaving user on the page?

Posted 1 month ago by PetroGromovo

Hello, In laravel / jquery apps if I need to make checks if user is logged I make in controller:

  $loggedUser = Auth::user();
     if ( empty($loggedUser->id) ) {
         return response()->json(['error_code'=> 1, 'message'=> "You must be logged!"],HTTP_RESPONSE_INTERNAL_SERVER_ERROR);

as I do not need to leave the user from the page, but only restrict some functionality I show error message above using bootstrapGrowl library. Now with laravel 7 /livewire 1.3 / turbolinks:5 / [email protected] I search how can I generate error and show similar error message, leaving user on the page ?


Please sign in or create an account to participate in this conversation.