What causes the error 'Not Found SoftDeletingTrait Class'?

Just call this by type 'use Illuminate\Database\Eloquent\SoftDeletingTrait;'

use Illuminate\Database\Eloquent\SoftDeletingTrait;

class User extends Eloquent {

    use SoftDeletingTrait;

    protected $dates = ['deleted_at'];

}

=> OR <=

Go to config/app.php & add Alias

For laravel 4

'SoftDeletingTrait'     => 'Illuminate\Database\Eloquent\SoftDeletingTrait',

For Laravel 5

'SoftDeletes' => 'Illuminate\Database\Eloquent\SoftDeletes::class';

or use on model or controller file

use Illuminate\Database\Eloquent\SoftDeletes;

if you are using laravel 5.1 you have to use the following,

use Illuminate\Database\Eloquent\SoftDeletes;

not

use Illuminate\Database\Eloquent\SoftDeletingTrait;


Remove:

use Illuminate\Database\Eloquent\SoftDeletingTrait;
use SoftDeletingTrait;
protected $dates = ['deleted_at'];

Add:

protected $softDelete = true;

Tags:

Php

Laravel 4