Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

You can try commenting them out.

Last updated 2 years ago.
0

You should do what's right for your code, even if it inconveniences you within your editor. Perhaps try a new editor.

Last updated 2 years ago.
0

Exposing public properties of your model is not a good idea and should be avoided at all cost. Using public properties basically make guarded and fillable properties useless.

If you feel like you're repeating a lot that you need a help of your editor..you might have code smell. How do you use your models?

Don't misunderstand me. It's very convenient if your IDE/editor can do the job for you, but I usually find myself using the models a few places.

Last updated 2 years ago.
0

By "makes your coding easier" I believe you are referring to autocomplete.

This can work perfectly fine by using docblocks.

/**
 * @property int           $id
 * @property Carbon/Carbon $date
 * @property string        $title
 * @property string        $description
 */
class Property extends Eloquent
{
    public $id;
    public $date;
public $title;
public $description;
.
.
.
}

And your IDE will pick up on that (assuming you have a decent IDE). Ofcourse maintaining the docblocks can be quite cumbersome but it doesn't have to be. There is an automated package that can do this for you.

https://github.com/barryvdh/laravel-ide-helper

Last updated 2 years ago.
0

@hailwood // That's really great! Thank you for the information.

Last updated 2 years ago.
0

@hailwood's solution is the right one, thanks!

Using the public properties on Eloquent, as I already mentioned, is not the solution, as it makes NULL all the values. And it's not an IDE problem. Using DocBlocks is what I was looking for.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

andrejmk andrejmk Joined 28 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.