Hi guys, We all know that Laravel's Eloquent is using PHP's magic methods (__get & __set) for the columns, accessors, relationships,... and much more. When the development happens, it hards for us to know which "properties" that we can use for a particular Eloquent models. We have to remember the columns' names, the relationship names,...

An alternative that we got - is using the phpDoc block and add the properties, eg: /** * @property-read int $id // column * @property string $name // column * @property-read Country|null $country // relationship *... */ class User extends Model {

Laravel auto-discovery will automatically do the magic 😉 #usage Usage #view-properties-of-your-model View properties of your model php artisan eloquent:phpdoc App\Models\User
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners