Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Eloquent\Scope - Laravel 5.1 compatibility issue #19

Open
jgardezi opened this issue Mar 2, 2017 · 2 comments
Open

Issue with Eloquent\Scope - Laravel 5.1 compatibility issue #19

jgardezi opened this issue Mar 2, 2017 · 2 comments
Labels

Comments

@jgardezi
Copy link

jgardezi commented Mar 2, 2017

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

@jgardezi
Copy link
Author

jgardezi commented Mar 2, 2017

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.

@jgardezi jgardezi changed the title Issue with Eloquent\Scope Issue with Eloquent\Scope - Laravel 5.1 compatibility issue Mar 23, 2017
@stephane-monnot
Copy link
Contributor

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');
}

@hootlex hootlex added the bug label May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants