Skip to content

Commit

Permalink
Add Employee Policy
Browse files Browse the repository at this point in the history
  • Loading branch information
AlpetGexha committed Jun 25, 2023
1 parent b22a453 commit c068c3e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/Filament/Resources/CompanyResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Contracts\Database\Query\Builder;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;

class CompanyResource extends Resource
{
Expand Down Expand Up @@ -80,4 +82,11 @@ public static function getPages(): array
// 'edit' => Pages\EditCompany::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): EloquentBuilder
{
if (!auth()->user()->isSuperAdmin())
return parent::getEloquentQuery()->where('id', auth()->user()->current_company_id);

return parent::getEloquentQuery();
}
}
7 changes: 7 additions & 0 deletions app/Policies/CompanyInvitationPolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Policies;

class CompanyInvitationPolicy
{
}
7 changes: 7 additions & 0 deletions app/Policies/EmployeeshipPolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Policies;

class EmployeeshipPolicy
{
}

0 comments on commit c068c3e

Please sign in to comment.