Laravel 5.3.6 custom exception - laravel-5

I'm busy learning laravel from a book for laravel 5.2.
I need to change some things because I'm using laravel 5.3.6 and I'm failing with errors.
I'm trying to create a custom exception when an admin user is trying to go to mysite/admin but the user is not active.
My code and errors: http://laravel.io/bin/PX5oP
Can someone please help?

Ok, changed my code in the admin middleware to this:
throw new NoActiveAccountException;
That solved the problem.

Related

ErrorException - Trying to access array offset on value of type null in ServiceProvider.php line 84 in Lumen

I am new to Lumen so I just downloaded and installed a fresh lumen setup but unfortunately as soon as I hit postman it sends me above error. I have read many posts all says to use isset() i did so but still error persists therefore i request to help me.
Composer update also does not work.
Thanks!
It seems to be an issue between your version of PHP and Lumen 5.*
I found something here https://github.com/DarkaOnLine/SwaggerLume/issues/82
This worked for me
// in bootstrap/app.php
$app->configure('view');

Laravel 6 change back to the old 5.8 exception screen

I really don't like the new exception screen in laravel 6. Is there a way to switch it back to the one from 5.8?
Whoops is the old error handler, try to install it and register a new handler, there is one example here: How can I register custom error handler in laravel 5?
Find instructions how to install and use whoops here https://github.com/filp/whoops
PS: just be careful, this handler should be executes only on development environment

Laravel returning random Carbon Method Illuminate\\Support\\Carbon::getTimestamp does not exist error on ajax call

New installation of Laravel - tried to reinstall and run composer update - same issue.
Laravel api project is returning randomly "Method Illuminate\Support\Carbon::getTimestamp does not exist." after ajax call from axios in separate vue.js client side project. This does not happen for every request. I will greatly appreciate any help.
I am experiencing the same problem, and simple "composer update" after some time should fix this, as Carbon breaks Laravel compatibility.

Laravel 5.2 view in register a provider

i have installed the chat package:
https://github.com/dazzz1er/confer
Unfortunately i get an error when i try to publish it. Here is the error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Support\Facades\View::composer()
Thanks !
As correctly pointed out by #curious_coder confer is not compatible with Laravel 5.2 yet. Please keep an on the open Laravel 5.2 issue on Github and/or ask the author of this package for updates.

Entrust permission in Laravel

I am using laravel 5.0. I am using Entrust for user permissions.
When I try to do the following function
Entrust::can('customers-views')
I am getting error like this. What is the reason for this. How can I solve this?
Class 'App\Http\Controllers\Entrust' not found
Can I use Entrust:can function in controller?
Can you try doing
\Entrust::can('customers-views')
or add the use path\to\Entrust line at the top of your file.

Resources