-
{{ config('app.name') }} Dashboard
+
+
+ {{ config('app.name') }} Dashboard
\ No newline at end of file
diff --git a/resources/views/livewire/profile.blade.php b/resources/views/livewire/profile.blade.php
index a8822708d5..e664fe69ec 100644
--- a/resources/views/livewire/profile.blade.php
+++ b/resources/views/livewire/profile.blade.php
@@ -1,3 +1,20 @@
-
- User profile
-
\ No newline at end of file
+
+
+
+ {{ __('Account') }}
+
+ @if (Filament\Features::hasPermissions())
+
+ {{ __('Permissions') }}
+
+ @endif
+
+
+
+
+ @if (Filament\Features::hasPermissions())
+
+ Permissions...
+
+ @endif
+
\ No newline at end of file
diff --git a/src/Features.php b/src/Features.php
index f3b10835ed..c5e4e1d336 100644
--- a/src/Features.php
+++ b/src/Features.php
@@ -45,6 +45,16 @@ class Features
return static::enabled(static::resources());
}
+ /**
+ * Determine if the application has user permissions.
+ *
+ * @return bool
+ */
+ public static function hasPermissions()
+ {
+ return static::enabled(static::permissions());
+ }
+
/**
* Enable the user registration feature.
*
@@ -65,6 +75,16 @@ class Features
return 'profile';
}
+ /**
+ * Enable the user permissions feature.
+ *
+ * @return string
+ */
+ public static function permissions()
+ {
+ return 'permissions';
+ }
+
/**
* Enable the resources feature.
*
diff --git a/src/Http/Livewire/Account.php b/src/Http/Livewire/Account.php
new file mode 100644
index 0000000000..8db65e248a
--- /dev/null
+++ b/src/Http/Livewire/Account.php
@@ -0,0 +1,58 @@
+ 'nullable|image',
+ 'user.name' => 'required|min:2',
+ 'user.email' => [
+ 'required',
+ 'email',
+ ],
+ 'password' => 'nullable',
+ ];
+
+ public function updated($user)
+ {
+ $this->validateOnly($user, [
+ 'user.email' => [
+ 'required',
+ 'email',
+ Rule::unique('users', 'email')->ignore($this->user->id),
+ ],
+ 'password' => 'nullable|required_with:password_confirmation|min:8',
+ 'password_confirmation' => 'nullable|same:password',
+ ]);
+ }
+
+ public function update()
+ {
+ $this->validate();
+
+ if ($this->password) {
+ $this->user->password = Hash::make($this->password);
+ }
+
+ $this->user->save();
+
+ $this->reset(['password', 'password_confirmation']);
+ }
+
+ public function render()
+ {
+ return view('filament::livewire.account');
+ }
+}
\ No newline at end of file
diff --git a/src/Resource.php b/src/Resource.php
index 1b66d99eeb..463c9bfea1 100644
--- a/src/Resource.php
+++ b/src/Resource.php
@@ -8,7 +8,7 @@ use Filament\Contracts\Resource as ResourceContract;
abstract class Resource implements ResourceContract
{
public $group = null;
- public $icon = 'heroicon-o-document-text';
+ public $icon = 'heroicon-o-database';
public $sort = 0;
/** @return string */
diff --git a/src/Traits/FilamentUser.php b/src/Traits/FilamentUser.php
index 33330550d1..6ebb794632 100644
--- a/src/Traits/FilamentUser.php
+++ b/src/Traits/FilamentUser.php
@@ -3,7 +3,6 @@
namespace Filament\Traits;
use Illuminate\Auth\Notifications\ResetPassword;
-use Thomaswelton\LaravelGravatar\Facades\Gravatar;
use Filament;
trait FilamentUser {
@@ -19,17 +18,4 @@ trait FilamentUser {
$this->notify($notification);
}
-
- public function avatar(int $size = 48): string
- {
- if (!$this->avatar) {
- return Gravatar::src($this->email, $size);
- }
-
- return Filament::image($this->avatar, [
- 'w' => $size,
- 'h' => $size,
- 'fit' => 'crop',
- ]);
- }
}
diff --git a/src/View/Components/Avatar.php b/src/View/Components/Avatar.php
new file mode 100644
index 0000000000..4f43bfb98a
--- /dev/null
+++ b/src/View/Components/Avatar.php
@@ -0,0 +1,63 @@
+user = $user;
+ $this->size = $size;
+ $this->dprs = $dprs;
+ }
+
+ /**
+ * Get the view / contents that represent the component.
+ *
+ * @return \Illuminate\View\View|\Closure|string
+ */
+ public function render()
+ {
+ return view('filament::components.avatar');
+ }
+
+ public function srcSet(): string
+ {
+ $srcSet = [];
+ foreach($this->dprs as $dpr) {
+ $srcSet[] = $this->src($dpr).' '.$dpr.'x';
+ }
+
+ return implode(', ', $srcSet);
+ }
+
+ public function src(int $dpr = 1): string
+ {
+ if (!$this->user->avatar) {
+ return Gravatar::src($this->user->email, $this->size * $dpr);
+ }
+
+ return Filament::image($this->user->avatar, [
+ 'w' => $this->size,
+ 'h' => $this->size,
+ 'fit' => 'crop',
+ 'dpr' => $dpr,
+ ]);
+ }
+}
\ No newline at end of file
diff --git a/tailwind.config.js b/tailwind.config.js
index b3198a6632..3002796d75 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -1,3 +1,4 @@
+// const defaultTheme = require('tailwindcss/defaultTheme')
const colors = require('tailwindcss/colors')
module.exports = {