Level 1
You can do this with a local scope: https://laravel.com/docs/5.4/eloquent#local-scopes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Does any of you know if it is possible to use dynamic getAttribute function?
I have two tables; Main object table and a details table. The details table has three columns: id to object, property name and property value. The property name I want to incorporate into the getAttribute function. To give you an example; property name can be Animal and property value is Dog. So something like this:
$model->get('animal'); // return "dog";
Is something like this possible?
Please or to participate in this conversation.