Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes the error 'Not Found SoftDeletingTrait Class'?

Tags:

php

laravel-4

I just updated from Laravel 4.1 to 4.2.7. I am trying to delete with Soft Delete using:

use SoftDeletingTrait;
protected $dates = ['deleted_at'];

But this gives the error 'Not Found SoftDeletingTrait Class'. What is the cause of this error?

like image 786
Nishchit Avatar asked Jul 25 '14 06:07

Nishchit


1 Answers

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;
like image 104
Nishchit Avatar answered Sep 20 '22 01:09

Nishchit