Skip to content

Commit

Permalink
Updates from octo core (#17)
Browse files Browse the repository at this point in the history
* Updates from octo core

* Add upgrades from octo-core
  • Loading branch information
a21ns1g4ts authored Oct 22, 2023
1 parent 47fdbd5 commit e8b7461
Show file tree
Hide file tree
Showing 15 changed files with 718 additions and 346 deletions.
10 changes: 8 additions & 2 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
use Octo\User\Settings;
use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable implements BannableContract, FilamentUser, HasAvatar, MustVerifyEmail
class User extends Authenticatable implements BannableContract, FilamentUser, HasAvatar
// TODO: Waiting for filament breezy implementation
// MustVerifyEmail
{
use Bannable, HasApiTokens, HasFactory, HasRoles, Notifiable, SoftDeletes, TwoFactorAuthenticatable;

Expand All @@ -30,6 +32,8 @@ class User extends Authenticatable implements BannableContract, FilamentUser, Ha
protected $fillable = [
'name',
'email',
'phone',
'username',
'avatar_url',
'password',
];
Expand Down Expand Up @@ -57,7 +61,9 @@ public function canAccessPanel(Panel $panel): bool
{
$settings = app(\Octo\Settings\Settings::class);

return ! in_array($this->id, $settings->restrict_users) && $this->hasVerifiedEmail();
return ! in_array($this->id, $settings->restrict_users);
// TODO: Waiting for filament breezy implementation
// $this->hasVerifiedEmail() && ;
}

public function getFilamentAvatarUrl(): ?string
Expand Down
48 changes: 24 additions & 24 deletions app/Policies/ActivityPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class ActivityPolicy
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function viewAny(User $user)
public function viewAny(User $user): bool
{
return $user->can('view_any_activity');
}
Expand All @@ -26,9 +26,9 @@ public function viewAny(User $user)
*
* @param \App\Models\User $user
* @param \Spatie\Activitylog\Models\Activity $activity
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function view(User $user, Activity $activity)
public function view(User $user, Activity $activity): bool
{
return $user->can('view_activity');
}
Expand All @@ -37,9 +37,9 @@ public function view(User $user, Activity $activity)
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function create(User $user)
public function create(User $user): bool
{
return $user->can('create_activity');
}
Expand All @@ -49,9 +49,9 @@ public function create(User $user)
*
* @param \App\Models\User $user
* @param \Spatie\Activitylog\Models\Activity $activity
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function update(User $user, Activity $activity)
public function update(User $user, Activity $activity): bool
{
return $user->can('update_activity');
}
Expand All @@ -61,9 +61,9 @@ public function update(User $user, Activity $activity)
*
* @param \App\Models\User $user
* @param \Spatie\Activitylog\Models\Activity $activity
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function delete(User $user, Activity $activity)
public function delete(User $user, Activity $activity): bool
{
return $user->can('delete_activity');
}
Expand All @@ -72,9 +72,9 @@ public function delete(User $user, Activity $activity)
* Determine whether the user can bulk delete.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function deleteAny(User $user)
public function deleteAny(User $user): bool
{
return $user->can('delete_any_activity');
}
Expand All @@ -84,9 +84,9 @@ public function deleteAny(User $user)
*
* @param \App\Models\User $user
* @param \Spatie\Activitylog\Models\Activity $activity
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function forceDelete(User $user, Activity $activity)
public function forceDelete(User $user, Activity $activity): bool
{
return $user->can('force_delete_activity');
}
Expand All @@ -95,9 +95,9 @@ public function forceDelete(User $user, Activity $activity)
* Determine whether the user can permanently bulk delete.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function forceDeleteAny(User $user)
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_activity');
}
Expand All @@ -107,9 +107,9 @@ public function forceDeleteAny(User $user)
*
* @param \App\Models\User $user
* @param \Spatie\Activitylog\Models\Activity $activity
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function restore(User $user, Activity $activity)
public function restore(User $user, Activity $activity): bool
{
return $user->can('restore_activity');
}
Expand All @@ -118,9 +118,9 @@ public function restore(User $user, Activity $activity)
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function restoreAny(User $user)
public function restoreAny(User $user): bool
{
return $user->can('restore_any_activity');
}
Expand All @@ -130,9 +130,9 @@ public function restoreAny(User $user)
*
* @param \App\Models\User $user
* @param \Spatie\Activitylog\Models\Activity $activity
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function replicate(User $user, Activity $activity)
public function replicate(User $user, Activity $activity): bool
{
return $user->can('replicate_activity');
}
Expand All @@ -141,9 +141,9 @@ public function replicate(User $user, Activity $activity)
* Determine whether the user can reorder.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function reorder(User $user)
public function reorder(User $user): bool
{
return $user->can('reorder_activity');
}
Expand Down
48 changes: 24 additions & 24 deletions app/Policies/ExceptionPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class ExceptionPolicy
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function viewAny(User $user)
public function viewAny(User $user): bool
{
return $user->can('view_any_exception');
}
Expand All @@ -26,9 +26,9 @@ public function viewAny(User $user)
*
* @param \App\Models\User $user
* @param \BezhanSalleh\FilamentExceptions\Models\Exception $exception
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function view(User $user, Exception $exception)
public function view(User $user, Exception $exception): bool
{
return $user->can('view_exception');
}
Expand All @@ -37,9 +37,9 @@ public function view(User $user, Exception $exception)
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function create(User $user)
public function create(User $user): bool
{
return $user->can('create_exception');
}
Expand All @@ -49,9 +49,9 @@ public function create(User $user)
*
* @param \App\Models\User $user
* @param \BezhanSalleh\FilamentExceptions\Models\Exception $exception
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function update(User $user, Exception $exception)
public function update(User $user, Exception $exception): bool
{
return $user->can('update_exception');
}
Expand All @@ -61,9 +61,9 @@ public function update(User $user, Exception $exception)
*
* @param \App\Models\User $user
* @param \BezhanSalleh\FilamentExceptions\Models\Exception $exception
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function delete(User $user, Exception $exception)
public function delete(User $user, Exception $exception): bool
{
return $user->can('delete_exception');
}
Expand All @@ -72,9 +72,9 @@ public function delete(User $user, Exception $exception)
* Determine whether the user can bulk delete.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function deleteAny(User $user)
public function deleteAny(User $user): bool
{
return $user->can('delete_any_exception');
}
Expand All @@ -84,9 +84,9 @@ public function deleteAny(User $user)
*
* @param \App\Models\User $user
* @param \BezhanSalleh\FilamentExceptions\Models\Exception $exception
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function forceDelete(User $user, Exception $exception)
public function forceDelete(User $user, Exception $exception): bool
{
return $user->can('force_delete_exception');
}
Expand All @@ -95,9 +95,9 @@ public function forceDelete(User $user, Exception $exception)
* Determine whether the user can permanently bulk delete.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function forceDeleteAny(User $user)
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_exception');
}
Expand All @@ -107,9 +107,9 @@ public function forceDeleteAny(User $user)
*
* @param \App\Models\User $user
* @param \BezhanSalleh\FilamentExceptions\Models\Exception $exception
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function restore(User $user, Exception $exception)
public function restore(User $user, Exception $exception): bool
{
return $user->can('restore_exception');
}
Expand All @@ -118,9 +118,9 @@ public function restore(User $user, Exception $exception)
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function restoreAny(User $user)
public function restoreAny(User $user): bool
{
return $user->can('restore_any_exception');
}
Expand All @@ -130,9 +130,9 @@ public function restoreAny(User $user)
*
* @param \App\Models\User $user
* @param \BezhanSalleh\FilamentExceptions\Models\Exception $exception
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function replicate(User $user, Exception $exception)
public function replicate(User $user, Exception $exception): bool
{
return $user->can('replicate_exception');
}
Expand All @@ -141,9 +141,9 @@ public function replicate(User $user, Exception $exception)
* Determine whether the user can reorder.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
* @return bool
*/
public function reorder(User $user)
public function reorder(User $user): bool
{
return $user->can('reorder_exception');
}
Expand Down
Loading

0 comments on commit e8b7461

Please sign in to comment.