I have a small question, when you retrieve objects from a database , is it possible to check which properties are on that object ? I've generated phpDocs with Laravel ide helper (https://github.com/barryvdh/laravel-ide-helper) but I don't see any properties..
This is my code :
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* App\Planning
*
* @mixin \Eloquent
* @property int $id
* @property string $name
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @method static \Illuminate\Database\Query\Builder|\App\Planning whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Planning whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Planning whereName($value)
* @method static \Illuminate\Database\Query\Builder|\App\Planning whereUpdatedAt($value)
*/
class Planning extends Model
{
function test()
{
$planningItems = App\Planning::all();
foreach ($planningItems as $item) {
echo $item->?;
}
}
}
Do you get autocomplete when you instantiate the model, and use it straight away?
$planning = new App\Planning();
$planning->??
That works for me. If it also works for you, but the example in the OP does not, then it could be down to needing to hint the method, something like this:
@method static \App\Planning[] all()
Or :
function test()
{
/** @var App\Planning[] $planningItems */
$planningItems = App\Planning::all();
foreach ($planningItems as $item) {
echo $item->?;
}
}
If those don't work, then it's probably time to raise an issue with the makers of the IDE.