This is the error that I get:
Non-static method Tester\Test::echoString() should not be called statically, assuming $this from incompatible context
Here is what I have added to app.php:
ServiceProvider:
"Tester\TestServiceProvider"
And Alias:
"Test" => "Tester\Test"
Here is my main class. named: test.library.php:
namespace Tester;
class Test
{
function echoString()
{
echo "This is a text string";
}
function printer($input)
{
$this->echoString();
echo " $input";
}
}
Here is my test.facade.php file:
class Test extends \Illuminate\Support\Facades\Facade
{
protected static function getFacadeAccessor() { return 'Test'; }
}
And here is the test.serviceprovider.php class:
use Illuminate\Support\ServiceProvider;
class TestServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bind('Test', function()
{
return new \Tester\Test(); // Name of your class, be sure to include the namespace if you are using one.
});
}
}
I think it's because you have a class named Test and also a Facade named Test. And it's a collision on the namespace.
.. probably rename Test (the facade) to TestFacade, then set the alias as "Test" => "Tester\TestFacade"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With