mardi 11 décembre 2018

Laravel Nova not loading any resources, blade error

Nova was working for me before. I started working on the front-end, and when coming back to Nova it suddenly doesn't work anymore. I can log in, but then it shows the loading animation for all resources and it's not loading data.

I get this error:

Trying to get property of non-object (View: longpath/location.blade.php)

In location.blade.php

@extends('app')

@section('title')
    
@endsection

@section('content')

@endsection

The weird thing is that on the front-end, location.blade.php loads perfectly fine, as I pass the $location variable in the LocationController. No errors and nothing in the error log. In LocationController:

$location = Location::
  where('id', $this->location_id)
  ->first();

return view('location', [
  'location' => $location
]);

So it shows the error, and this error is in the logs as well. If I comment out , it doesn't show the error anymore, but it's still not loading any data, and nothing shows up in the error log. So I have no clue why it's not loading any data. It's also a mystery to me why a (front-end) Blade template would generate an error in Nova, while it works perfectly fine on the front-end.

Update:

If I comment out this specific route in routes/web, Nova works again. Not sure why this route impacts Nova?

Route::get('/{location_id}/{location_title}', 'LocationController@viewLocation');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire