#4410 category edit bug

This commit is contained in:
Muammer Top 2021-08-11 15:26:53 +03:00
parent fcf23887a2
commit 7c0fc98abd

View File

@ -141,7 +141,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
$query = $this::withTrashed();
}
if ($id != null) {
if ($id !== null) {
if ($nullable_ad) {
return $query->find($id);
} else {
@ -157,6 +157,10 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
public function userAdv($nullable_ad = false, $checkRole = true)
{
if ($user = Auth::user() and $user->hasRole('admin') && $checkRole) {
return $this->getAdv(null, $nullable_ad);
}
return $this->getAdv(null, $nullable_ad)
->where('advs_advs.created_by_id', Auth::id());
}