I have a custom module (Quiz) where all the records of all users appear in the index module page, but I want to show only the respective records per user who created them (created_by).
Hello You can check MyInvoicesTransformer as an example for your requests, basically, the query function should be changed to add the scope filter you need
* Get query source of dataTable.
* @param Invoice $model
* @return \Illuminate\Database\Eloquent\Builder|static
public function query(Invoice $model)
and in the model you add
public function scopeMyInvoices($query)
return $query->where('user_id', user()->id);
Please login or Register to submit your answer