Skip to content

Commit c24f7a0

Browse files
Create CreateResearchSpace.php
1 parent 188b5fa commit c24f7a0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace App\Filament\Resources\ResearchSpaceResource\Pages;
4+
5+
use Filament\Resources\Pages\CreateRecord;
6+
use App\Filament\Resources\ResearchSpaceResource;
7+
8+
class CreateResearchSpace extends CreateRecord
9+
{
10+
protected static string $resource = ResearchSpaceResource::class;
11+
12+
protected function beforeCreate(): void
13+
{
14+
// Automatically set owner/created_by to currently authenticated user
15+
$user = auth()->user();
16+
$this->data['owner_id'] = $user->id;
17+
$this->data['created_by'] = $user->id;
18+
}
19+
}

0 commit comments

Comments
 (0)