public function getAdminEntitiesIDs($entity_name) { if (\Auth::check()) { return array_flatten(\Access::where('user_id', \Auth::user()->id)->where('entity_name', $entity_name)->get(['entity_id'])->toArray()); } return []; }
function checkPass($chave) { session::delete('id_user'); if (!Access::where('accesskey', $chave)->exists()) { return true; } else { $a = Access::where('accesskey', $chave)->get(); session::set('id_user', $a[0]->id_user); return false; } }