Laravel version that I am using is 5.3. And I am already using the trait SoftDeletes and it was imported correctly too.
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
class Reference extends Model {
use SoftDeletes;
protected $fillable = [
'client_id',
'email'
];
}
When I use the methods onlyTrashed() or withTrashed() I get the error.
$reference = Reference::withTrashed()->get();
or
$reference = Reference::onlyTrashed()->get();
Error:
BadMethodCallException in Builder.php line 2450:
Call to undefined method Illuminate\Database\Query\Builder::withTrashed()
Some methods like that are working:
Reference::find(1)->delete();
Reference::find(1)->restore();
Reference::find(1)->trashed();
What can be the problem?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2Ig2oOD
via IFTTT
Aucun commentaire:
Enregistrer un commentaire