Skip to content

Commit 64ffe85

Browse files
authored
Merge pull request #57 from lara-zeus/fix-user-id
set user when creating a new layout
2 parents a2fc94f + 1c46b34 commit 64ffe85

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

docs/upgrade.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,5 @@ title: Upgrade
33
weight: 6
44
---
55

6-
to upgrade to v3, the name and the name space changed from `Rain` to `DynamicDashboard`
6+
to upgrade to v4, the name and the name space changed from `Rain` to `DynamicDashboard`
77

8-
1- so first publish the config:
9-
10-
```bash
11-
php artisna vendor:publish --tag=zeus-dynamic-dashboard-config
12-
```
13-
14-
this will crate the new config file `zeus-dynamic-dashboard.php`, and you can move your configuration from the old file `zeus-rain`
15-
16-
2- change the call in the `plugins` array in your panel provider
17-
18-
```php
19-
DynamicDashboardPlugin::make()
20-
```
21-
22-
3- run the update script, since the namespace has changed, you need to run this command in the production to update the class names
23-
24-
>make sure to backup your database
25-
26-
```bash
27-
php artisan dynamic-dashboard:update-class
28-
```
29-
30-
this will change `LaraZeus\Rain` to `LaraZeus\DynamicDashboard`

src/Filament/Resources/LayoutResource/Pages/CreateLayout.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@
88
class CreateLayout extends CreateRecord
99
{
1010
protected static string $resource = LayoutResource::class;
11+
12+
protected function mutateFormDataBeforeCreate(array $data): array
13+
{
14+
$data['user_id'] = auth()->user()->id;
15+
16+
return parent::mutateFormDataBeforeCreate($data);
17+
}
1118
}

0 commit comments

Comments
 (0)