Call to undefined method Illuminate\View\Compilers\BladeCompiler::component()/ - laravel

I have tried to create a Blade component in laravel 5.6. I have added this code segment Blade::component('front.components.filter','filter'); in AppServiceProvider.php and add this in my blade file
#filter #endfilter
when I try to run the program I have got this error
Call to undefined method Illuminate\View\Compilers\BladeCompiler::component()/
How can I fix this?

Related

Method App\\Http\\Controllers\\Controller::show does not exist

I just have upgraded one of my project from laravel version 5.2 to 7.1 But now I have started getting following error
Method App\\Http\\Controllers\\Controller::show does not exist.
I know there is not a function named show in my controller class. But if there is any way to trigger custom named method instead of show() while declaring resource attribute in web.php file.
Here is my resource declaration in web.php
Route::resources([
'first', 'FirstController',
'second','SecondController'
]);
Can I make some customization to tackle this situation.

show Call to undefined function setActive() error in laravel 6.3

URL or Route setActive() method is not working in laravel 6.3. It shows the following error :
Call to undefined function setActive()

Datattables Laravel 5.4 - FatalThrowableError Call to undefined function App\Http\Controllers\Datatables()

I'm using datatables with laravel 5.4, but when I use the datatables()->query():
in providers: Yajra\Datatables\DatatablesServiceProvider::class,
in aliases: 'Datatables' => Yajra\Datatables\Facades\Datatables::class,
My code:
return Datatables()->query( /**query**/ )
return this error in my console:
FatalThrowableError
App\Http\Controllers\Datatables()
I've tried datatables() and Datatables()
Someone with the same problem?
This error happens because Laravel cannot find your package Datatables.
Laravel in controllers, if you are not mapping your classes correctly will always seek the called classes at this point App\Http\Controllers.
Just put use DataTables; or use \Yajra\Datatables\Datatables; at the start of your controller and it shall be fixed. documentation
When you install any package through composer, composer uses namespace to find the package and route functions and classes to it.
you can read more about the namespaces from php.
and you can check this tutorial for namespaces.
Also, Laravel follows the PSR 4 when it comes to autoloading, you can check it from here

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.

Call to undefined method Modules\User\Services\web\facade\WebAuth::loginUsername()

I am using laravel ThrottlesLogins in my custom facade class as trait. I am using
if($this->hasTooManyLoginAttempts($request))
return $this->ThrottleActions($request);
in my login method, but why I am facing the subject error
Call to undefined method Modules\User\Services\web\facade\WebAuth::loginUsername()
However on local its working fine. But when I update code online server. I am facing this error.
This method loginUsername() already exist in ThrottlesLogins trait.

Resources