JakubMisek
// Laravel Facade
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class Example extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor(): string
{
return 'example';
}
}
// Example class for Example Facade
namespace App;
class Example
{
use App\WithSpecial;
public function normal()
{}
}
// Laravel Facades
namespace App;
trait WithSpecial
{
public function powers()
{}
}
I remembered sharing the above in another discussion before, but could not find it.
Not sure what you mean by "register", but if I create the files and code above, Laravel will call powers(); when we write App\Facades\Example::powers();
Today, if I write App\Facades\Example::normal();, PHP tools is able to link to App\Example's normal() method.
But if I write App\Facades\Example::powers();, PHP tools says "Call to unknown method"