Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Impossible to extends a Model ?

Hi.

I'd like to make a "baseModel" with some property like 'createdAt', 'id' and 'updatedAt'. But on function 'beforeValidationOnCreate' of my Users model, when i call the parent::beforeValidationOnCreate to update my date fields I got an error 'The method 'getCreatedAt' doesn't exist on model 'App\Models\Users'.

Is it even possible to do a baseModel ?

If not I'll change my baseModel to make a trait instead.



1.5k
Accepted
answer

Sorry I'm an idiot ... the getter/setter didn't work because I change the property name but not the function name ... >.> bad idea to code when exhausted, sorry.