Closed codercms closed 6 years ago
Have you bootstrapped Lumen with eloquent?
On Tuesday, 19 April 2016, Dmitry notifications@github.com wrote:
Hey, i'm using latest Lumen. And created model:
<?phpnamespace App\Models;use Devio\Eavquent\Eavquent;use Illuminate\Database\Eloquent\Model;class Books extends Model{ use Eavquent; // Eager loading all the registered attributes protected $with = ['eav'];}
And added the following route:
$app->get('/books', function() { return \App\Models\Books::all();});
And when i trying to access /books i've got - Whoops, looks like something went wrong. FatalErrorException in EagerLoadScope.php line 10: Interface 'Illuminate\Database\Eloquent\Scope' not found
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/IsraelOrtuno/Eavquent/issues/36
Un saludo Israel Ortuño
@IsraelOrtuno yes,the code is below:
require_once __DIR__.'/../vendor/autoload.php';
Dotenv::load(__DIR__.'/../');
$app = new Laravel\Lumen\Application(
realpath(__DIR__.'/../')
);
$app->withFacades();
$app->withEloquent();
@codercms I have set up it with a fresh lumen app and it works pretty well, just have to focus more on the config stuff but apart of that, model worked perfect. What version of Lumen are you using?
@IsraelOrtuno
php artisan --version
Laravel Framework version Lumen (5.1.6) (Laravel Components 5.1.*)
Maybe i need to execute some additional commands to enable Eloquent's scope interface?
@IsraelOrtuno here is ScopeInterface
Yep... I am using Scope
which is for 5.2 I think and in Lumen 5.1 you have ScopeInterface
, that's the problem...
Will dig into this and get back to you.
Why don't you just update to latest lumen? ^o^
@rockymontana I already did it ;)
Awesome! Did it help?
@rockymontana sure, that helped :+1:
I think this is will be one of the reasons to stick into 5.1 or 5.2 😓
So we should set minimum version to 5.2 and be over with it? :-)
@rockymontana sounds like a good solution
I wanted to use 5.1 because of LTS but looks like 5.2 is going to be easier to maintain.
On Friday, 22 April 2016, Dmitry notifications@github.com wrote:
@rockymontana https://github.com/rockymontana sounds like a good solution
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/IsraelOrtuno/Eavquent/issues/36#issuecomment-213471072
Un saludo Israel Ortuño
I would that that the solution here would be to branch out and create a realease / tag for the LTS version.
Hey, i'm using the latest Lumen. And created model:
And added the following route:
And when i trying to access
/books
i've got -Whoops, looks like something went wrong. FatalErrorException in EagerLoadScope.php line 10: Interface 'Illuminate\Database\Eloquent\Scope' not found
Is there any way to fix this problem?