Section::make()->columns(1)
->schema([
RichEditor::make('notes')->label('Bilješke')
->fileAttachmentsDisk('private')
->fileAttachmentsDirectory('form-attachments')
->fileAttachmentsVisibility('private')
])]);'private' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'url' => env('APP_URL').'/private',
'visibility' => 'private',
], public function getAttachedMedia($team_id, $file_name) {
$team = Team::where('slug', $team_id)->first();
if(Auth::id() && Auth::user()->canAccessTenant($team)) {
$file = Storage::disk('notes_attachments')->get($team_id . '/' . $file_name);
return (new \Illuminate\Http\Response($file))->header('Content-Type', 'application/png');
}
else {
abort(404);
}
} 'notes_attachments' => [
'driver' => 'local',
'root' => storage_path('app/notes_attachments'),
'url' => env('APP_URL').'/notes_attachments',
'visibility' => 'private',
'throw' => true,
],Route::get('/notes_attachments/{team_slug}/{file_name}', [AttachmentsMediaController::class, 'getAttachedMedia'])->middleware(['auth']);
Route::redirect('//login', '/app/login')->name('login');public function teams(): BelongsToMany
{
return $this->belongsToMany(Team::class)->withTimestamps()->wherePivot('status', 'A');
}
public function team() {
return Filament::getTenant();
}
public function canAccessTenant(Model $tenant): bool
{
return $this->teams->contains($tenant);
}