lundi 28 décembre 2015

Method ::find not found in Laravel 5.2 / Eloquent

In Laravel 5.2 I made a folder app/Models. This is one of my models: app/Models/Pin.php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Pin extends Model {
    protected $table = 'pins';
}

In my composer.json I added to "classmap": app/Models. Then I runned composer dump-autoload

In my PinController, I have:

use App\Models\Pin as Pin;

When I do: Pin::all(); it returns a collection.

But when I try: Pin::find(1); I get:

Method find not found in class \App\Models\Pin

Is their a way I can get all methods from Eloquent?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire