A year now from the question date, with Laravel 6, the chosen answer will not suffice.
2 steps are needed to solve the issue:
1- as @Yuvraj mentioned change the extended model in Laravel\Telescope\Storage\EntryModel
:
//use Illuminate\Database\Eloquent\Model;
use Moloquent as Model;
class EntryModel extends Model
2- in the same class is a function that scopes the query by the oprtions sent in the request:
public function scopeWithTelescopeOptions($query, $type, EntryQueryOptions $options)
{
$this->whereType($query, $type)
->whereBatchId($query, $options)
->whereTag($query, $options)
->whereFamilyHash($query, $options)
->whereBeforeSequence($query, $options)
->filter($query, $options);
return $query;
}
the filter
function checks if the record has the property should_display_on_index
set to true, which is set as default in the migration:
$table->boolean('should_display_on_index')->default(true);
But since a mongoDB is used, the default paramater is not respected and hence, is not added to the record.
To resolve this you have two options:
a) comment out the call to filter in the previously mentioned function:
public function scopeWithTelescopeOptions($query, $type, EntryQueryOptions $options)
{
$this->whereType($query, $type)
->whereBatchId($query, $options)
->whereTag($query, $options)
->whereFamilyHash($query, $options)
->whereBeforeSequence($query, $options)
/*->filter($query, $options)*/;
return $query;
}
However, if you are going to use the filter later by setting the should_display_on_index
to false, you'll need to modify the filter function instead:
protected function filter($query, EntryQueryOptions $options)
{
if ($options->familyHash || $options->tag || $options->batchId) {
return $this;
}
// $query->where('should_display_on_index', true);
$query->where('should_display_on_index', '!=', false);
return $this;
}