laravel-moderation
laravel-moderation copied to clipboard
Issue with Eloquent\Scope - Laravel 5.1 compatibility issue
Hi All,
I am using Laravel 5.1 and getting the following issue with this package.
"Interface 'Illuminate\\Database\\Eloquent\\Scope' not found",
// error details
"file": "/home/vagrant/projects/laravel/MyApp/vendor/hootlex/laravel-moderation/src/ModerationScope.php",
"class": "Symfony\\Component\\Debug\\Exception\\FatalErrorException",
In my Model I am including it as
use Hootlex\Moderation\Moderatable;
class Collection extends Model
{
use Moderatable;
}
Please let me know whats wrong with this?
Kind regards, Javed Gardezi
Hi,
I have found the problem... its lvl 5.1 compatibility issue.
Laravel 5.1 does not have Illuminate\Database\Eloquent\Scope
Interface.
In ModerationScope.php
I have changed it to use Illuminate\Database\Eloquent\ScopeInterface
and it started working.
Is there a way to add compatibility for Laravel 5.1.* in the offical repository.
Hi Jgardezi, Maybe you can use a class alias in your application (haven't tested it) :
if (!class_exists('\Illuminate\Database\Eloquent\Scope')) {
class_alias('\Illuminate\Database\Eloquent\ScopeInterface', '\Illuminate\Database\Eloquent\Scope');
}