Hello,
Filtering owner of particular records during show in index, what in particular class can I filter the User ID owner of a particular records to show before arriving in the Index portion of a controller that is based on your module template, because it shows all of the records that does not belong to the user, for an admin user its ok.
Hello,
This can be done in the DataTable class for that object
for example
/** * Get query source of dataTable.
* @param Product $model
* @return \Illuminate\Database\Eloquent\Builder|static
*/
public function query(Product $model)
{
if (isSuperUser()) {
return $model->newQuery();
} else {
return user()->[User relation with the objects you need]->newQuery();
}
}
Please login or Register to submit your answer