Laravel 7.x View-related exception after config:cache - laravel

I am a junior php developer and very new to laravel. I have the following problem. I cached my config with php artisan config:cache, the programm broke with error 500 and in the log i saw the exception shown bellow :
local.ERROR: Method Illuminate\View\View::__toString() must not throw an exception, caught Facade\Ignition\Exceptions\ViewException: Route [homepage.get] not defined.
(View: /var/www/vhosts/sotiris.upgrade/httpdocs/command-center/resources/views/static/includes/header.blade.php) {"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Method Illuminate\View\View::__toString() must not throw an exception, caught Facade\Ignition\Exceptions\ViewException: Route [homepage.get] not defined.
(View: /var/www/vhosts/sotiris.upgrade/httpdocs/command-center/resources/views/static/includes/header.blade.php) at /var/www/vhosts/sotiris.upgrade/httpdocs/command-center/vendor/symfony/http-foundation/Response.php:0).
I cleared everything in cache and it worked. Can anyone please help me ? Any steps?? Files to look for ? Anything

Related

Laravel custom artisan command cannot access model

I'm trying to create a artisan command to dump data from database table in my existing Laravel 6 project.
I'm following the web to create the command, it works and prints out.
https://codeinphp.github.io/post/creating-your-own-artisan-in-php/
However I could not access the model in the existing project.
I've tried using
MyModel::all()
but it returns error about connection
PHP Fatal error: Uncaught Error: Call to a member function
connection() on null
I also tried do the data dump using existing getCsv() from controller, like
app('App\Http\Controllers\MyController')->getCsv();
Then it complains
Class request does not exist
I also tired doing
$table = DB::table('my_table');
But error returns as
A facade root has not been set

Laravel 5.2 testing always returning 404

guys,
I'm having this issue to create my firsts tests on my project. I already try almost everything, search in forums, but I can't resolve this problem. Every page that I try to access using get in my test is always returning 404.
public function testExample()
{
$user = factory(User::class)->make();
$this->actingAs($user)->get('/book-original');
$this->assertResponseOk();
}
There was 1 failure:
1) FileTest::testExample Expected status code 200, got 404.
I'm using a separeted .env.testing file, but try to setup my .env file same as the testing, in case the Laravel is ignoring the testing and reading the main one, but the result is the same.
I try to use the $baseUrl and .env's APP_URL with http://localhost and my IP and try to use the return value from php artisan serve command, in my case, http://localhost:8000, but in both cases the error persists.
Important: I used php artisan config:cache every time I changed the configs.
I'm already lost. Has someone a hint to help here?
Thanks so much.

PHP Warning throws ErrorException

A unit test is failing because an ErrorException about an undefined property is thrown. However, this happens in a connected shop system's core files which i cannot change.
My controller has a try ... catch block that catches the generic Exception object. But i don't want that catch to fire because of an undefined property.
I figured out the error is converted to an ErrorException in HandleExceptions.php in method handleError
How can i make phpunit ignore notices and warnings coming from code pieces i can't touch?
What i've already tried
In phpunit.xml
convertErrorsToExceptions="false"
convertNoticesToExceptions="false"
convertWarningsToExceptions="false"
Set APP_DEBUG=false as well as API_DEBUG=false for dingo.
I am using Dingo 1.0.x with Laravel 5.4 and phpunit 5.7.26.

Laravel Route:list not working throwing run time exception

when i tried to display all routes
by using php artisan route:list
it showing some runtime exception like this
[RuntimeException]
Session store not set on request.
how can i get my list of routes

How to Log Laravel 404 Error With Details

Just as in the title, I am getting a 404 error in my Log but don't know where/why this error is happening cause my App is working fine without a problem.
Is there a way for me to log the error in details (the referral link) e.g
Error
[2014-11-30 05:44:13] production.ERROR: exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in /home/domain/laravel/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:146
Details
Detail: User tried to access route http://domain.com/users
Thanks, any help will be appreciated.
App::missing(function($exception)
{
Log::error( Request::url() );
return Response::view('errors.missing', array(), 404);
});
or use Request::fullUrl() this includes query strings in the URL
You need to make the view.

Resources