I want to add a Facade to my model named Content. But I always get the error Cannot redeclare class Content. Is that because the model is already loaded via the autoload? How can I fix this?
I appreciate you help, thanks.
This is how my composer file looks like
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/Serviceproviders"
]
},
And this is how my Serviceprovider looks like.
<?php namespace App\Serviceproviders;
use Illuminate\Support\ServiceProvider;
class FormandsystemServiceProvider extends ServiceProvider {
public function register()
{
$this->app->bind('content', function()
{
return new \App\models\Content;
});
$this->app->booting(function()
{
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Content', '\App\Facades\Content');
});
}
}
My Facade looks like this.
<? namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class Content extends Facade {
protected static function getFacadeAccessor() { return 'content'; }
}