laravel-auditing icon indicating copy to clipboard operation
laravel-auditing copied to clipboard

auditable_type does not reflect the correct path of the model

Open ramonpego opened this issue 4 years ago • 2 comments

Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 7.30.3
Package version v10.0.0
PHP version 7.4.3

Actual Behaviour

on OwenIt\Auditing\Models\Audit the auditable_type is returning "App\Model\Foo" and I can't change

Expected Behaviour

Describe the behaviour you're expecting. You should be returning App\Models\Foo as all models are in the "Models" folder within the app

Steps to Reproduce

I looked in the code, something about configuring the default models folder, but I didn't find anything like that.

image

ramonpego avatar Jan 25 '21 12:01 ramonpego

up

ramonpego avatar Mar 03 '21 20:03 ramonpego

Can't say for sure if this will resolve your particular issues, but I'd recommend using Laravel's MorphMap instead of letting the _type field default to the namespaced class name. It'll save you a lot of trouble if you ever reorganize/rename any of your models.

DevBodin avatar Jun 25 '21 20:06 DevBodin

auditable_type shows the model namespace, not the path of folders

erikn69 avatar Mar 07 '23 20:03 erikn69