Model does not have "restored" event?!

I am trying to use MyModel::restored event inside MyModel::boot method but Laravel says restored function does not exist!

I have checked docs, for my version 4.2 and updated just now, that it should have restored and restoring events.

I tried checking sources for Eloquent, but I can't seem to find these events there.

Is there any bug for this? I googled but nothing interesting shows up.

araceus2000 replied 4 years ago

I have this example

public static function boot()
        // make the parent (Eloquent) boot method run

        // cause a soft delete of a product to cascade to children so they are also soft deleted
       		catch(Exception $e)
       			throw new Exception("Error Processing Request", 1);

jarektkaczyk replied 4 years ago Solution

restored is a method on SoftDeletingTrait, so just make sure you use SoftDeletingTrait.

thelastblack replied 4 years ago


But I think this has to be mentioned in documents. It gave me headache for some hours :))

jarektkaczyk replied 4 years ago

It is:

And btw should you have a headache again, just use your IDE or editor's feature called find in project/ find in files etc and simply search for the method you need ;)

thelastblack replied 4 years ago

Yes, the docs mention the soft delete trait, but it doesn't mention that those events are defined in that trait!

Normally, you would look at to find events related to your model (as a reference I mean).

The search thing is good too, but it doesn't replace the docs not mentioning this!

It seems I am counting on docs more than I should :)

Steve-45 replied 3 years ago

I can suggest you with one software and that is "Ahsay backup" as i am using this software for my business use , So try it out. Many new softwares i have tries like acronis etc but i guess according to the speed i would 9/10 marks to this software. Use it.

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us