File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ composer require isaeken/laravel-theme-system
23
23
You can publish the config file with:
24
24
25
25
``` 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
27
28
```
28
29
29
30
Run the following command in the terminal for initializing:
@@ -46,6 +47,26 @@ theme_system()->setTheme('your-theme-name');
46
47
theme_system()->getCurrentTheme();
47
48
````
48
49
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
+
49
70
### Creating theme
50
71
51
72
Run the following command in the terminal.
You can’t perform that action at this time.
0 commit comments