Skip to content

Commit 3693b31

Browse files
committed
update README.md
1 parent 8f7240e commit 3693b31

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ composer require isaeken/laravel-theme-system
2323
You can publish the config file with:
2424

2525
```bash
26-
php artisan vendor:publish --provider="IsaEken\ThemeSystem\ThemeSystemServiceProvider" --tag="theme-system-config"
26+
php artisan vendor:publish --provider="IsaEken\ThemeSystem\ThemeSystemServiceProvider" --tag="theme-system-config" --tag="theme-system-migrations"
27+
php artisan migrate
2728
```
2829

2930
Run the following command in the terminal for initializing:
@@ -46,6 +47,26 @@ theme_system()->setTheme('your-theme-name');
4647
theme_system()->getCurrentTheme();
4748
````
4849

50+
### Set theme per user
51+
52+
````php
53+
// \App\Models\User.php
54+
class User extends Authenticatable
55+
{
56+
use \IsaEken\ThemeSystem\Traits\CanChooseTheme; // Add this
57+
58+
// ...
59+
}
60+
````
61+
62+
````php
63+
// In your controller or middleware
64+
auth()->user()->theme; // theme for user.
65+
auth()->user()->theme = 'default'; // theme is saved to db.
66+
67+
auth()->user()->themeApply(); // changed current theme to user theme.
68+
````
69+
4970
### Creating theme
5071

5172
Run the following command in the terminal.

0 commit comments

Comments
 (0)