Common problems when setting up Laravel Nova

Franz
2 min readAug 22, 2018

--

Source: nova.laravel.com

Not all beginnings are easy. This is specially true when using a brand new technology like, in my case, Laravel Nova. Following problems occurred during my first installation.

Problem 1: Can’t install Nova:

Your requirements could not be resolved to an installable set of packages. The requested package laravel/nova could not be found in any version, there may be a typo in the package name.

Solution: Add following options at the end of your composer.json-File

"minimum-stability": "dev",
"prefer-stable": true,

and run composer update.

Problem 2: 403 status code when visiting /nova

Solution: Looks like Nova is thinking that you are on an non-local environment. Please update the gate() Method in NovaServiceProvider.php. I’m using entrust for Role management and changed it like so:

Gate::define('viewNova', function ($user) {    return $user->hasRole('admin');});

Problem 3: Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: Class ‘App\User’ not found

Solution: Seems like your User-Model is not in the /app directory (in my case under /app/Models). Open app/Nova/User.php and change the public static $modelproperty to the correct path.

Problem 4: Global search is returning sql-error. Column not found

Solution: Open app/Nova/User.php and change public static $searchproperty to only include available fields from your users table. In my case the user table is missing a name column. Also update thepublic static $titleproperty if necessary.

Problem 5: Deployment via envoyer fails on php artisan package:discover

Solution: Easy one, just change following line in your composer.json

"laravel/nova": "*@dev"

Still liking Nova?!?

Sure! Setting up the first resource was super easy. The only thing I’m sad regarding Nova is that it wasn’t released earlier. I would have saved me three months of work to code our own backend solution in the last year.

Great great work Taylor and team!

--

--