Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 committed Oct 31, 2024
1 parent be4a382 commit 194f7ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 32 deletions.
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "foxws/wireuse",
"description": "Collection of essential Livewire utilities",
"description": "Collection of useful Livewire utilities",
"keywords": [
"foxws",
"wireuse",
"laravel",
"livewire",
"wireuse"
"utilities",
"helpers"
],
"homepage": "https://github.com/foxws/wireuse",
"license": "MIT",
Expand All @@ -18,13 +20,14 @@
],
"require": {
"php": "^8.2",
"illuminate/cache": "^10.0|^11.0",
"illuminate/contracts": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0",
"illuminate/view": "^10.0|^11.0",
"laravel/scout": "^10.0|^11.0",
"livewire/livewire": "^3.4",
"spatie/laravel-package-tools": "^1.16.5",
"artesaos/seotools": "^1.3"
"artesaos/seotools": "^1.3",
"spatie/laravel-package-tools": "^1.16.5"
},
"require-dev": {
"larastan/larastan": "^2.9",
Expand Down
13 changes: 7 additions & 6 deletions src/Auth/Concerns/WithAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,37 @@
namespace Foxws\WireUse\Auth\Concerns;

use Illuminate\Foundation\Auth\User;
use Illuminate\Support\Facades\Auth;

trait WithAuthentication
{
protected function isAuthenticated(): bool
{
return auth()->check();
return Auth::check();
}

protected function getAuthId(): int|string|null
{
return auth()->id();
return Auth::id();
}

protected function getAuthModel(): ?User
{
return auth()->user();
return Auth::getUser();
}

protected function getAuthKey(): int|string|null
{
return $this->getAuthModel()?->getRouteKey();
return $this->getAuthUser()?->getRouteKey();
}

protected function can(string $ability, mixed $arguments = []): bool
{
return $this->getAuthModel()?->can($ability, $arguments);
return Auth::user()->can($ability, $arguments);
}

protected function cannot(string $ability, mixed $arguments = []): bool
{
return $this->getAuthModel()?->cannot($ability, $arguments);
return Auth::user()->cannot($ability, $arguments);
}
}
22 changes: 0 additions & 22 deletions testbench.yaml

This file was deleted.

0 comments on commit 194f7ab

Please sign in to comment.