I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged user role, I need to limit the results only to 3 for security reasons and at the moment this is not working:
public static function indexQuery(NovaRequest $request, $query)
{
if(auth()->user()->role != 'admin') return $query->limit(3);
return $query;
}
The result:
Looks like the condition is not taken into consideration.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2YTqD1J
via IFTTT
Aucun commentaire:
Enregistrer un commentaire