#is there something like input auto casting in laravel?
20 messages · Page 1 of 1 (latest)
@serene bramble this is in Product model. is there something wrong with it?
the create function i mean
The create function is already provided by the Eloquent Model.. no need to add it yourself. That's why I would suggest to read the docs again on how to add/save/create models. Laravel makes things so much easier then you'd tink..
Also check out the Storage facade and Form Requests. Good stuff 🚀
The error message is telling you what’s wrong. The create method expects an array; not a Request instance like you’re passing.
I know but in custom create method that I made in Product model that was not what I requested.
Why are you making “custom” methods that overload Eloquent methods?
nead it to change a table with custom input that i get from the form
that is not the Product table
No, you don’t need to override Eloquent methods at all.
so Eloquent methods are impossible to override? im even using parent method in child method.
It just doesn’t make sense to use a framework, and then start undoing everything that framework does for you.
If you start overriding core methods, then you’re just opening yourself up to bugs and undesirable behaviour.
can check the code pic that is sent? u will know what im trying to do
Maybe write your own framework. 👋🏽
haha I laughed. and pls open pics before answering.
Maybe start reading before asking anymore questions. I did open the pics and responded to them. If you don't like the answers, that's fine as well.
I did. Overriding core Eloquent methods isn’t the solution.
can u tell me what can i do for it?
Familiarise yourself with the framework and its conventions. For example, your product_image method should be named using StudlyCase, i.e. ProductImage instead.