--- FILE: app/Filament/Resources/ArtistResource.php --- schema([ TextInput::make('name') ->label('Nome Artista') ->required() ->live(onBlur: true) ->afterStateUpdated(fn (string $operation, $state, $set) => $operation === 'create' ? $set('slug', Str::slug($state)) : null), TextInput::make('slug') ->required() ->unique(Artist::class, 'slug', ignoreRecord: true), RichEditor::make('bio') ->label('Biografia') ->columnSpanFull(), FileUpload::make('photo') ->label('Foto Profilo') ->image() ->directory('artists-photos') ->columnSpanFull(), KeyValue::make('social_links') ->label('Link Social') ->keyLabel('Piattaforma (es. Instagram)') ->valueLabel('URL Profilo') ->columnSpanFull(), ]); } public static function table(Table $table): Table { return $table ->columns([ ImageColumn::make('photo') ->label('Foto') ->circular(), TextColumn::make('name') ->label('Nome') ->searchable() ->sortable(), TextColumn::make('slug') ->color('gray'), TextColumn::make('created_at') ->label('Creato il') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListArtists::route('/'), 'create' => Pages\CreateArtist::route('/create'), 'edit' => Pages\EditArtist::route('/{record}/edit'), ]; } } --- FILE: app/Filament/Resources/ArtistResource/Pages/CreateArtist.php --- schema([ TextInput::make('title') ->label('Titolo News') ->required() ->live(onBlur: true) ->afterStateUpdated(fn ($state, $set) => $set('slug', Str::slug($state))), TextInput::make('slug') ->required() ->unique(Post::class, 'slug', ignoreRecord: true), Select::make('category') ->options([ 'news' => 'News', 'release' => 'Nuova Uscita', 'event' => 'Evento', ]) ->default('news'), FileUpload::make('image') ->label('Immagine di copertina') ->image() ->directory('blog-images') ->columnSpanFull(), RichEditor::make('content') ->label('Contenuto Articolo') ->required() ->columnSpanFull(), ]); } public static function table(Table $table): Table { return $table ->columns([]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getPages(): array { return [ 'index' => Pages\ListPosts::route('/'), 'create' => Pages\CreatePost::route('/create'), 'edit' => Pages\EditPost::route('/{record}/edit'), ]; } } --- FILE: app/Filament/Resources/PostResource/Pages/CreatePost.php --- schema([ Select::make('artist_id') ->label('Artista') ->relationship('artist', 'name') ->searchable() ->preload() ->required(), TextInput::make('title') ->label('Titolo Brano') ->required(), FileUpload::make('audio_path') ->label('File Audio (MP3/WAV)') ->required() ->directory('tracks-audio') ->acceptedFileTypes(['audio/mpeg', 'audio/wav', 'audio/x-wav']) ->maxSize(51200), // Limite a 50MB FileUpload::make('cover_path') ->label('Cover Singolo') ->image() ->directory('tracks-covers'), Toggle::make('is_featured') ->label('Metti in evidenza nel Player') ->default(false), ]); } public static function table(Table $table): Table { return $table ->columns([ ImageColumn::make('cover_path') ->label('Cover') ->square(), TextColumn::make('title') ->label('Titolo') ->searchable() ->sortable(), TextColumn::make('artist.name') ->label('Artista') ->sortable(), IconColumn::make('is_featured') ->label('In evidenza') ->boolean(), TextColumn::make('created_at') ->label('Caricato il') ->dateTime() ->sortable(), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getPages(): array { return [ 'index' => Pages\ListTracks::route('/'), 'create' => Pages\CreateTrack::route('/create'), 'edit' => Pages\EditTrack::route('/{record}/edit'), ]; } } --- FILE: app/Filament/Resources/TrackResource/Pages/CreateTrack.php --- paginate(20); return view('admin.artists.index', compact('artists')); } public function create() { return view('admin.artists.create'); } public function store(Request $request) { $request->validate([ 'name' => 'required|string|max:255', ]); $artist = new Artist(); $this->mapArtistData($artist, $request); // Assegnazione user_id solo in creazione $artist->user_id = $request->user_id; $artist->save(); return redirect()->route('admin.artists.index')->with('success', 'Artista creato con successo!'); } public function edit(Artist $artist) { // Rimosso l'abort(403) manuale: l'autorizzazione è gestita dal middleware delle rotte return view('admin.artists.edit', compact('artist')); } public function update(Request $request, Artist $artist) { $request->validate([ 'name' => 'required|string|max:255', ]); $this->mapArtistData($artist, $request); $artist->save(); return redirect()->route('admin.artists.index')->with('success', 'Profilo aggiornato.'); } /** * Helper per mappare i dati ed evitare ripetizioni (DRY) */ private function mapArtistData(Artist $artist, Request $request) { $artist->name = $request->name; $artist->slug = Str::slug($request->name); $artist->bio = $request->bio; $artist->style = $request->style; $artist->nostr_npub = $request->nostr_npub; $artist->ln_address = $request->ln_address; $artist->apple_music_url = $request->apple_music_url; $artist->spotify_url = $request->spotify_url; $artist->soundcloud_url = $request->soundcloud_url; $artist->instagram_url = $request->instagram_url; $artist->youtube_url = $request->youtube_url; $artist->facebook_url = $request->facebook_url; // Gestione Profile Image if ($request->hasFile('profile_image')) { if ($artist->profile_image) Storage::disk('public')->delete($artist->profile_image); $artist->profile_image = $request->file('profile_image')->store('artists/avatars', 'public'); } // Gestione Photo/Cover if ($request->hasFile('photo')) { if ($artist->photo) Storage::disk('public')->delete($artist->photo); $artist->photo = $request->file('photo')->store('artists/covers', 'public'); } } public function destroy(Artist $artist) { if ($artist->profile_image) Storage::disk('public')->delete($artist->profile_image); if ($artist->photo) Storage::disk('public')->delete($artist->photo); $artist->delete(); return redirect()->route('admin.artists.index')->with('warning', 'Artista rimosso.'); } } --- FILE: app/Http/Controllers/Admin/ContestController.php --- latest()->paginate(10); return view('admin.contests.index', compact('contests')); } public function create() { return view('admin.contests.create'); } public function store(Request $request) { // dd($request->all()); $validated = $request->validate([ 'title' => 'required|max:255', 'description' => 'required', 'legal_disclaimer' => 'required', 'max_tracks_per_artist' => 'required|integer|min:1', 'playlist_url' => 'nullable|url', 'image' => 'nullable|image|mimes:jpg,png,jpeg|max:2048', 'rules_pdf' => 'nullable|mimes:pdf|max:5120', ]); // Creazione istanza e popolamento tramite fillable $contest = new Contest(); $contest->fill($validated); // Campi gestiti manualmente $contest->slug = Str::slug($request->title); $contest->is_active = true; // Di default attivo alla creazione // Gestione Immagine if ($request->hasFile('image')) { $contest->image_path = $request->file('image')->store('contests/images', 'public'); } // Gestione PDF if ($request->hasFile('rules_pdf')) { $contest->rules_pdf = $request->file('rules_pdf')->store('contests/docs', 'public'); } $contest->save(); return redirect()->route('admin.contests.index')->with('success', 'Contest creato con successo.'); } public function edit(Contest $contest) { return view('admin.contests.edit', compact('contest')); } public function update(Request $request, Contest $contest) { $validated = $request->validate([ 'title' => 'required|max:255', 'description' => 'required', 'legal_disclaimer' => 'required', 'max_tracks_per_artist' => 'required|integer|min:1', 'playlist_url' => 'nullable|url', 'image' => 'nullable|image|mimes:jpg,png,jpeg|max:2048', 'rules_pdf' => 'nullable|mimes:pdf|max:5120', ]); // Aggiorna i campi fillable $contest->fill($validated); $contest->slug = Str::slug($request->title); // Gestione checkbox is_active (se non spuntata non arriva nel request) $contest->is_active = $request->has('is_active'); // Aggiornamento Immagine (elimina la vecchia se presente) if ($request->hasFile('image')) { if ($contest->image_path) { Storage::disk('public')->delete($contest->image_path); } $contest->image_path = $request->file('image')->store('contests/images', 'public'); } // Aggiornamento PDF (elimina il vecchio se presente) if ($request->hasFile('rules_pdf')) { if ($contest->rules_pdf) { Storage::disk('public')->delete($contest->rules_pdf); } $contest->rules_pdf = $request->file('rules_pdf')->store('contests/docs', 'public'); } $contest->save(); return redirect()->route('admin.contests.index')->with('success', 'Contest aggiornato con successo.'); } public function destroy(Contest $contest) { // Pulizia file fisici dallo storage dell'RPi 4 if ($contest->image_path) { Storage::disk('public')->delete($contest->image_path); } if ($contest->rules_pdf) { Storage::disk('public')->delete($contest->rules_pdf); } $contest->delete(); return redirect()->route('admin.contests.index')->with('success', 'Contest eliminato definitivamente.'); } } --- FILE: app/Http/Controllers/Admin/NewsController.php --- paginate(15); return view('admin.news.index', compact('news')); } public function create() { return view('admin.news.create'); } public function store(Request $request) { // 1. Validazione (Le regole sono fondamentali per non far crashare Laravel) $request->validate([]); // 2. Creazione news $news = new News(); $news->title = $request->title; $news->slug = Str::slug($request->title); $news->content = $request->content; $news->is_published = $request->has('is_published'); // 3. User ID obbligatorio (Evita l'errore SQL Integrity constraint violation) $news->user_id = auth()->id(); // 4. Gestione Immagine if ($request->hasFile('image')) { $news->image_path = $request->file('image')->store('news', 'public'); } $news->save(); return redirect()->route('admin.news.index')->with('success', 'News pubblicata!'); } public function edit(News $news) { return view('admin.news.edit', compact('news')); } public function update(Request $request, News $news) { // Validazione anche per l'aggiornamento $request->validate([]); $news->title = $request->title; $news->slug = Str::slug($request->title); $news->content = $request->content; $news->is_published = $request->has('is_published'); if ($request->hasFile('image')) { if ($news->image_path) { Storage::disk('public')->delete($news->image_path); } $news->image_path = $request->file('image')->store('news', 'public'); } $news->save(); return redirect()->route('admin.news.index')->with('success', 'News aggiornata correttamente.'); } public function destroy(News $news) { if ($news->image_path) { Storage::disk('public')->delete($news->image_path); } $news->delete(); return redirect()->route('admin.news.index')->with('warning', 'News eliminata.'); } } --- FILE: app/Http/Controllers/Admin/RadioController.php --- latest()->get(); return view('admin.radio.archive', compact('tracks')); } /** * SELEZIONE PLAYLIST OPERATIVA * Mostra solo le tracce che hanno superato la moderazione (is_approved = true). */ public function playlist() { $approvedTracks = Track::where('is_approved', true) ->with('artist') ->orderBy('title', 'asc') ->get(); return view('admin.radio.playlist', compact('approvedTracks')); } /** * SALVATAGGIO PLAYLIST & GENERAZIONE JSON PER RASPBERRY */ public function updatePlaylist(Request $request) { // 1. Reset: Nessuna traccia è in playlist Track::query()->update(['in_playlist' => false]); // 2. Attivazione tracce selezionate if ($request->has('playlist')) { Track::whereIn('id', $request->playlist) ->update(['in_playlist' => true]); } // 3. Sincronizzazione File JSON per il Player MP3 $this->syncRaspberryPlaylist(); return back()->with('success', 'Playlist aggiornata e file JSON generato per il Raspberry!'); } /** * TOGGLE APPROVAZIONE (Moderazione rapida dall'archivio) */ public function toggleApprove(Track $track) { $track->update([ 'is_approved' => !$track->is_approved ]); // Se rimuovo l'approvazione, la tolgo automaticamente anche dalla playlist operativa if (!$track->is_approved) { $track->update(['in_playlist' => false]); $this->syncRaspberryPlaylist(); } $status = $track->is_approved ? 'Approvata' : 'Spostata in Coda'; return back()->with('success', "Traccia $status con successo."); } /** * ELIMINAZIONE TRACCIA */ public function destroy(Track $track) { // Rimuovo il file fisico se necessario prima di eliminare il record // Storage::disk('public')->delete($track->file_path); $track->delete(); // Aggiorno il JSON perché una traccia è sparita $this->syncRaspberryPlaylist(); return back()->with('success', 'Traccia rimossa definitivamente dall\'archivio.'); } /** * FUNZIONE PRIVATA DI SINCRONIZZAZIONE * Crea un file JSON leggibile dal Raspberry Pi 4 */ private function syncRaspberryPlaylist() { $playlistData = Track::where('in_playlist', true) ->with('artist:id,name') ->get() ->map(function ($track) { return [ 'id' => $track->id, 'title' => $track->title, 'artist' => $track->artist->name ?? 'Unknown', 'url' => asset('storage/' . $track->file_path), // URL assoluto per il player ]; }); // Salvataggio in storage/app/public/playlist.json Storage::disk('public')->put('radio/playlist.json', json_encode($playlistData, JSON_PRETTY_PRINT)); } } --- FILE: app/Http/Controllers/ArtistController.php --- firstOrFail(); $tracks = $artist->tracks()->where('is_approved', true)->get(); return view('artists.show', compact('artist', 'tracks')); } public function updateArtist(Request $request) { $artist = Artist::where('user_id', Auth::id())->firstOrFail(); // 1. Salvataggio testi (Bio, Social, Style) $artist->fill($request->except(['_token', 'photo', 'profile_image'])); $statusMessage = "Dati salvati. "; // 2. GESTIONE AVATAR (profile_image) if ($request->hasFile('profile_image')) { // Pulizia vecchia immagine if ($artist->profile_image) { Storage::disk('public')->delete($artist->profile_image); } // Salvataggio fisico $path = $request->file('profile_image')->store('artists/avatars', 'public'); $artist->profile_image = $path; $statusMessage .= "Avatar caricato! "; } // 3. GESTIONE COVER (photo) if ($request->hasFile('photo')) { if ($artist->photo) { Storage::disk('public')->delete($artist->photo); } $path = $request->file('photo')->store('artists/covers', 'public'); $artist->photo = $path; $statusMessage .= "Cover caricata! "; } // 4. SCRITTURA FINALE DB $artist->save(); return back()->with('success', $statusMessage); } } --- FILE: app/Http/Controllers/Auth/AuthenticatedSessionController.php --- authenticate(); $request->session()->regenerate(); return redirect()->intended(route('dashboard', absolute: false)); } /** * Destroy an authenticated session. */ public function destroy(Request $request): RedirectResponse { Auth::guard('web')->logout(); $request->session()->invalidate(); $request->session()->regenerateToken(); return redirect('/'); } } --- FILE: app/Http/Controllers/Auth/ConfirmablePasswordController.php --- validate([ 'email' => $request->user()->email, 'password' => $request->password, ])) { throw ValidationException::withMessages([ 'password' => __('auth.password'), ]); } $request->session()->put('auth.password_confirmed_at', time()); return redirect()->intended(route('dashboard', absolute: false)); } } --- FILE: app/Http/Controllers/Auth/EmailVerificationNotificationController.php --- user()->hasVerifiedEmail()) { return redirect()->intended(route('dashboard', absolute: false)); } $request->user()->sendEmailVerificationNotification(); return back()->with('status', 'verification-link-sent'); } } --- FILE: app/Http/Controllers/Auth/EmailVerificationPromptController.php --- user()->hasVerifiedEmail() ? redirect()->intended(route('dashboard', absolute: false)) : view('auth.verify-email'); } } --- FILE: app/Http/Controllers/Auth/NewPasswordController.php --- $request]); } /** * Handle an incoming new password request. * * @throws ValidationException */ public function store(Request $request): RedirectResponse { $request->validate([ 'token' => ['required'], 'email' => ['required', 'email'], 'password' => ['required', 'confirmed', Rules\Password::defaults()], ]); // Here we will attempt to reset the user's password. If it is successful we // will update the password on an actual user model and persist it to the // database. Otherwise we will parse the error and return the response. $status = Password::reset( $request->only('email', 'password', 'password_confirmation', 'token'), function (User $user) use ($request) { $user->forceFill([ 'password' => Hash::make($request->password), 'remember_token' => Str::random(60), ])->save(); event(new PasswordReset($user)); } ); // If the password was successfully reset, we will redirect the user back to // the application's home authenticated view. If there is an error we can // redirect them back to where they came from with their error message. return $status == Password::PASSWORD_RESET ? redirect()->route('login')->with('status', __($status)) : back()->withInput($request->only('email')) ->withErrors(['email' => __($status)]); } } --- FILE: app/Http/Controllers/Auth/PasswordController.php --- validateWithBag('updatePassword', [ 'current_password' => ['required', 'current_password'], 'password' => ['required', Password::defaults(), 'confirmed'], ]); $request->user()->update([ 'password' => Hash::make($validated['password']), ]); return back()->with('status', 'password-updated'); } } --- FILE: app/Http/Controllers/Auth/PasswordResetLinkController.php --- validate([ 'email' => ['required', 'email'], ]); // We will send the password reset link to this user. Once we have attempted // to send the link, we will examine the response then see the message we // need to show to the user. Finally, we'll send out a proper response. $status = Password::sendResetLink( $request->only('email') ); return $status == Password::RESET_LINK_SENT ? back()->with('status', __($status)) : back()->withInput($request->only('email')) ->withErrors(['email' => __($status)]); } } --- FILE: app/Http/Controllers/Auth/RegisteredUserController.php --- validate([ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class], 'password' => ['required', 'confirmed', Rules\Password::defaults()], ]); $user = User::create([ 'name' => $request->name, 'email' => $request->email, 'password' => Hash::make($request->password), ]); event(new Registered($user)); Auth::login($user); return redirect()->route('user.studio'); } } --- FILE: app/Http/Controllers/Auth/VerifyEmailController.php --- user()->hasVerifiedEmail()) { return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); } if ($request->user()->markEmailAsVerified()) { event(new Verified($request->user())); } return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); } } --- FILE: app/Http/Controllers/ContestController.php --- latest()->get(); return view('contests.index', compact('contests')); } public function show($slug) { $contest = Contest::where('slug', $slug)->firstOrFail(); $userTracks = collect(); if (Auth::check()) { $user = Auth::user(); if ($user->artist) { $userTracks = $user->artist->tracks()->latest()->get(); } } return view('contests.show', compact('contest', 'userTracks')); } /** * GESTIONE ISCRIZIONE (Il metodo mancante) */ public function join(Request $request, Contest $contest) { // 1. Validazione $request->validate([ 'track_id' => 'required|exists:tracks,id', 'legal_consent' => 'accepted', ], [ 'legal_consent.accepted' => 'Devi accettare il regolamento per procedere.', ]); $user = auth()->user(); $trackId = $request->track_id; // 2. Controllo proprietà traccia $track = \App\Models\Track::where('id', $trackId)->where('user_id', $user->id)->first(); if (!$track) { return back()->with('error', 'Traccia non valida o non trovata nel tuo studio.'); } // 3. Controllo se già iscritta if ($contest->tracks()->where('track_id', $trackId)->exists()) { return back()->with('error', 'Questa traccia è già iscritta a questo contest.'); } // 4. Controllo limite massimo tracce per artista $alreadyJoinedCount = $contest->tracks() ->whereHas('artist', function($q) use ($user) { $q->where('user_id', $user->id); })->count(); if ($alreadyJoinedCount >= $contest->max_tracks_per_artist) { return back()->with('error', "Limite raggiunto: max {$contest->max_tracks_per_artist} tracce."); } // 5. Iscrizione (Rimosso joined_at che non esiste nel DB) $contest->tracks()->attach($trackId, [ 'status' => 'pending', 'created_at' => now(), 'updated_at' => now(), ]); return back()->with('success', 'Iscrizione inviata con successo!'); } } --- FILE: app/Http/Controllers/Controller.php --- user(); if (!$user->artist) { $user->artist()->create([ 'name' => $user->name, 'slug' => \Illuminate\Support\Str::slug($user->name), 'style' => 'default', ]); } return view('dashboard'); } } --- FILE: app/Http/Controllers/NewsController.php --- paginate(10); return view('news.index', compact('news')); } /** * Visualizza la singola news tramite Slug */ public function show($slug) { // Cerchiamo la news per slug, se non esiste 404 $news = News::where('slug', $slug)->firstOrFail(); // Prendiamo altre news correlate (le ultime 3 escludendo quella corrente) $relatedNews = News::where('id', '!=', $news->id) ->latest() ->take(3) ->get(); return view('news.show', compact('news', 'relatedNews')); } } --- FILE: app/Http/Controllers/ProfileController.php --- $request->user(), ]); } /** * Update the user's profile information. */ public function update(ProfileUpdateRequest $request): RedirectResponse { $request->user()->fill($request->validated()); if ($request->user()->isDirty('email')) { $request->user()->email_verified_at = null; } $request->user()->save(); return Redirect::route('profile.edit')->with('status', 'profile-updated'); } /** * Delete the user's account. */ public function destroy(Request $request): RedirectResponse { $request->validateWithBag('userDeletion', [ 'password' => ['required', 'current_password'], ]); $user = $request->user(); Auth::logout(); $user->delete(); $request->session()->invalidate(); $request->session()->regenerateToken(); return Redirect::to('/'); } public function editLiberatoria() { return view('profile.liberatoria'); } public function updateLiberatoria(Request $request) { $request->validate([ 'real_name' => 'required|string|max:255', 'tax_code' => 'required|string|max:16', 'accepted_terms' => 'accepted', ]); auth()->user()->update($request->only('real_name', 'tax_code')); return back()->with('status', 'Liberatoria aggiornata con successo!'); } } --- FILE: app/Http/Controllers/PublicContestController.php --- get(); return view('contests.index', compact('contests')); } public function show($slug) { $contest = Contest::where('slug', $slug)->firstOrFail(); return view('contests.show', compact('contest')); } public function join(Request $request, Contest $contest) { // 1. Validazione stretta $validated = $request->validate([ 'track_id' => 'required|exists:tracks,id', 'legal_consent' => 'accepted', // Obbligatorio per la liberatoria ], [ 'legal_consent.accepted' => 'Devi accettare il regolamento per partecipare.', 'track_id.exists' => 'La traccia selezionata non è valida.' ]); $user = auth()->user(); // 2. Recupero traccia con controllo di proprietà (evita che qualcuno iscriva tracce altrui) $track = $user->tracks()->where('id', $validated['track_id'])->first(); if (!$track) { return back()->with('error', 'Non abbiamo trovato questa traccia nel tuo Studio.'); } // 3. Controllo duplicati sulla tabella pivot if ($contest->tracks()->where('track_id', $track->id)->exists()) { return back()->with('info', 'Questa traccia è già iscritta a questo contest.'); } try { // 4. Inserimento nella pivot con timestamp e stato iniziale $contest->tracks()->attach($track->id, [ 'status' => 'pending', 'joined_at' => now(), // Campo utile per cronologia iscrizioni 'created_at' => now(), 'updated_at' => now(), ]); return back()->with('success', 'Richiesta inviata! La tua traccia è ora in fase di moderazione.'); } catch (\Exception $e) { // Log dell'errore per il debug su RPi \Log::error("Errore iscrizione contest {$contest->id}: " . $e->getMessage()); return back()->with('error', 'Si è verificato un problema tecnico. Riprova più tardi.'); } } } --- FILE: app/Http/Controllers/User/TrackUploadController.php --- artist) { return redirect()->route('user.studio')->with('error', 'Devi configurare il tuo profilo prima di gestire le tracce.'); } $tracks = $user->artist->tracks()->latest()->get(); return view('user.tracks.index', compact('tracks')); } /** * Caricamento nuova traccia */ public function store(Request $request) { $request->validate([ 'title' => 'required|string|max:255', 'audio_file' => 'required|mimes:mp3,wav,ogg|max:51200', // 50MB 'genre' => 'required|string', 'version' => 'nullable|string|max:100', 'bpm' => 'nullable|integer', ]); $artist = Auth::user()->artist; if (!$artist) { return back()->with('error', 'Completa prima il tuo profilo artista nello studio!'); } // Salvataggio File Audio $path = $request->file('audio_file')->store('tracks/audio', 'public'); // Generazione Slug unico $slug = Str::slug($request->title . '-' . Str::random(5)); $trackUrl = url('/track/' . $slug); // Generazione QR Code (Verde Acido Rude-Hz) $qrPath = 'tracks/qrcodes/qrcode-' . $slug . '.svg'; $qrCodeContent = QrCode::size(300) ->color(217, 255, 0) // #d9ff00 ->backgroundColor(10, 10, 10) ->format('svg') ->generate($trackUrl); Storage::disk('public')->put($qrPath, $qrCodeContent); // Creazione Record Track::create([ 'user_id' => Auth::id(), 'artist_id' => $artist->id, 'title' => $request->title, 'slug' => $slug, 'version' => $request->version ?? 'Original Mix', 'genre' => $request->genre, 'bpm' => $request->bpm, 'file_path' => $path, 'qr_code_path' => $qrPath, 'is_approved' => false, 'release_year' => date('Y'), ]); return back()->with('success', 'Traccia inviata con successo! In attesa di convalida.'); } /** * Pagina di Modifica (Il metodo che mancava) */ public function edit(Track $track) { // Verifica proprietà (o tramite user_id o tramite artist_id) if ($track->user_id !== Auth::id()) { abort(403, 'Azione non autorizzata.'); } return view('user.tracks.edit', compact('track')); } /** * Aggiornamento Metadati */ public function update(Request $request, Track $track) { if ($track->user_id !== Auth::id()) { abort(403); } $validated = $request->validate([ 'title' => 'required|string|max:255', 'bpm' => 'nullable|integer', 'genre' => 'required|string', 'version' => 'nullable|string|max:100', ]); $track->update($validated); // Se aggiorni il titolo, potresti voler rigenerare lo slug, // ma per ora manteniamo quello esistente per non rompere i QR code già stampati. return redirect()->route('user.tracks.index')->with('success', 'Metadati aggiornati con successo.'); } /** * Eliminazione totale file e record */ public function destroy(Track $track) { if ($track->user_id !== Auth::id()) { abort(403); } // Rimozione file fisici $files = [$track->file_path, $track->qr_code_path]; foreach ($files as $file) { if ($file && Storage::disk('public')->exists($file)) { Storage::disk('public')->delete($file); } } $track->delete(); return back()->with('success', 'Traccia e file rimossi definitivamente.'); } } --- FILE: app/Http/Controllers/WelcomeController.php --- take(4)->get(); $tracks = Track::with('artist')->latest()->take(5)->get(); return view('welcome', compact('artists', 'tracks')); } /** * Visualizza la pagina pubblica della singola traccia (quella del QR) */ public function showTrack($slug) { // Recuperiamo la traccia tramite lo slug caricando anche i dati dell'artista // Usiamo firstOrFail così se lo slug è sbagliato spara una 404 automatica $track = Track::where('slug', $slug)->with('artist')->firstOrFail(); // Mappato sulla tua struttura: resources/views/user/tracks/show.blade.php return view('user.tracks.show', compact('track')); } } --- FILE: app/Http/Requests/Auth/LoginRequest.php --- |string> */ public function rules(): array { return [ 'email' => ['required', 'string', 'email'], 'password' => ['required', 'string'], ]; } /** * Attempt to authenticate the request's credentials. * * @throws ValidationException */ public function authenticate(): void { $this->ensureIsNotRateLimited(); if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { RateLimiter::hit($this->throttleKey()); throw ValidationException::withMessages([ 'email' => trans('auth.failed'), ]); } RateLimiter::clear($this->throttleKey()); } /** * Ensure the login request is not rate limited. * * @throws ValidationException */ public function ensureIsNotRateLimited(): void { if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { return; } event(new Lockout($this)); $seconds = RateLimiter::availableIn($this->throttleKey()); throw ValidationException::withMessages([ 'email' => trans('auth.throttle', [ 'seconds' => $seconds, 'minutes' => ceil($seconds / 60), ]), ]); } /** * Get the rate limiting throttle key for the request. */ public function throttleKey(): string { return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip()); } } --- FILE: app/Http/Requests/ProfileUpdateRequest.php --- |string> */ public function rules(): array { return [ 'name' => ['required', 'string', 'max:255'], 'email' => [ 'required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id), ], ]; } } --- FILE: app/Livewire/Player.php --- tracks = Track::where('is_featured', true)->with('artist')->get(); $this->currentTrack = $this->tracks->first(); } public function render() { return view('livewire.player'); } } --- FILE: app/Models/Artist.php --- slug && $artist->name) { $artist->slug = Str::slug($artist->name); } }); static::updating(function ($artist) { // Opzionale: aggiorna lo slug se il nome cambia (attenzione ai link rotti!) // Se preferisci slug immutabili, commenta queste righe if ($artist->isDirty('name') && !$artist->isDirty('slug')) { $artist->slug = Str::slug($artist->name); } }); } /** * IMPORTANTE: NON aggiungere getRouteKeyName() qui. * La gestione dello slug è fatta direttamente nel file web.php * tramite il binding esplicito {artist:slug}. */ /** * Relazione: L'artista appartiene a un utente registrato. */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Relazione: Un artista può avere molte tracce. */ public function tracks(): HasMany { return $this->hasMany(Track::class); } } --- FILE: app/Models/Contest.php --- belongsToMany(Track::class) ->withPivot('accepted_legal_terms', 'accepted_at', 'status') ->withTimestamps(); } } --- FILE: app/Models/News.php --- belongsTo(\App\Models\User::class); } /** * Ottieni l'artista collegato alla traccia. */ public function artist() { return $this->belongsTo(\App\Models\Artist::class); } public function contests(): BelongsToMany { return $this->belongsToMany(Contest::class) ->withPivot('accepted_legal_terms', 'accepted_at', 'status') ->withTimestamps(); } } --- FILE: app/Models/User.php --- 'datetime', 'password' => 'hashed', 'is_admin' => 'boolean', // FONDAMENTALE: forza Laravel a vederlo come true/false ]; } protected static function boot() { parent::boot(); static::created(function ($user) { $slug = Str::slug($user->name); // Evitiamo duplicati durante la registrazione if (Artist::where('slug', $slug)->exists()) { $slug = $slug . '-' . strtolower(Str::random(4)); } $user->artist()->create([ 'name' => $user->name, 'slug' => $slug, 'style' => 'default', ]); }); } public function artist(): HasOne { return $this->hasOne(Artist::class); } } --- FILE: app/Providers/AppServiceProvider.php --- middleware('can:admin-only') Gate::define('admin-only', function (User $user) { return (bool) $user->is_admin; }); // 2. Definisce il Gate per l'area Artista (User standard) // Utilizzato da ->middleware('can:user-only') Gate::define('user-only', function (User $user) { return !(bool) $user->is_admin; }); /** * 3. LOGICA SUPER-ADMIN (Gate::before) * Se l'utente è un admin, ha accesso a tutto a prescindere dai Gate specifici. * Ritorna true per sbloccare, null per lasciare il controllo ai singoli Gate. */ Gate::before(function ($user, $ability) { if ((bool) $user->is_admin) { return true; } return null; }); } } --- FILE: app/Providers/Filament/AdminPanelProvider.php --- default() ->id('admin') ->path('admin') ->brandName('Rude-Hz') ->login() ->colors([ 'primary' => Color::Amber, ]) ->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources') ->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages') ->pages([ Pages\Dashboard::class, ]) ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets') ->widgets([ Widgets\AccountWidget::class, Widgets\FilamentInfoWidget::class, ]) ->middleware([ EncryptCookies::class, AddQueuedCookiesToResponse::class, StartSession::class, AuthenticateSession::class, ShareErrorsFromSession::class, VerifyCsrfToken::class, SubstituteBindings::class, DisableBladeIconComponents::class, DispatchServingFilamentEvent::class, ]) ->authMiddleware([ Authenticate::class, ]); } } --- FILE: app/View/Components/AdminLayout.php --- withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { $middleware->redirectTo( guests: '/login', users: '/dashboard' // Forza il passaggio dalla rotta bivio in web.php ); }) ->withExceptions(function (Exceptions $exceptions): void { // })->create(); --- FILE: bootstrap/providers.php --- env('APP_NAME', 'Laravel'), /* |-------------------------------------------------------------------------- | Application Environment |-------------------------------------------------------------------------- | | This value determines the "environment" your application is currently | running in. This may determine how you prefer to configure various | services the application utilizes. Set this in your ".env" file. | */ 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- | Application Debug Mode |-------------------------------------------------------------------------- | | When your application is in debug mode, detailed error messages with | stack traces will be shown on every error that occurs within your | application. If disabled, a simple generic error page is shown. | */ 'debug' => (bool) env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- | Application URL |-------------------------------------------------------------------------- | | This URL is used by the console to properly generate URLs when using | the Artisan command line tool. You should set this to the root of | the application so that it's available within Artisan commands. | */ 'url' => env('APP_URL', 'http://localhost'), /* |-------------------------------------------------------------------------- | Application Timezone |-------------------------------------------------------------------------- | | Here you may specify the default timezone for your application, which | will be used by the PHP date and date-time functions. The timezone | is set to "UTC" by default as it is suitable for most use cases. | */ 'timezone' => 'UTC', /* |-------------------------------------------------------------------------- | Application Locale Configuration |-------------------------------------------------------------------------- | | The application locale determines the default locale that will be used | by Laravel's translation / localization methods. This option can be | set to any locale for which you plan to have translation strings. | */ 'locale' => env('APP_LOCALE', 'en'), 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- | | This key is utilized by Laravel's encryption services and should be set | to a random, 32 character string to ensure that all encrypted values | are secure. You should do this prior to deploying the application. | */ 'cipher' => 'AES-256-CBC', 'key' => env('APP_KEY'), 'previous_keys' => [ ...array_filter( explode(',', (string) env('APP_PREVIOUS_KEYS', '')) ), ], /* |-------------------------------------------------------------------------- | Maintenance Mode Driver |-------------------------------------------------------------------------- | | These configuration options determine the driver used to determine and | manage Laravel's "maintenance mode" status. The "cache" driver will | allow maintenance mode to be controlled across multiple machines. | | Supported drivers: "file", "cache" | */ 'maintenance' => [ 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), 'store' => env('APP_MAINTENANCE_STORE', 'database'), ], ]; --- FILE: config/auth.php --- [ 'guard' => env('AUTH_GUARD', 'web'), 'passwords' => env('AUTH_PASSWORD_BROKER', 'users'), ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | which utilizes session storage plus the Eloquent user provider. | | All authentication guards have a user provider, which defines how the | users are actually retrieved out of your database or other storage | system used by the application. Typically, Eloquent is utilized. | | Supported: "session" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All authentication guards have a user provider, which defines how the | users are actually retrieved out of your database or other storage | system used by the application. Typically, Eloquent is utilized. | | If you have multiple user tables or models you may configure multiple | providers to represent the model / table. These providers may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => env('AUTH_MODEL', User::class), ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | These configuration options specify the behavior of Laravel's password | reset functionality, including the table utilized for token storage | and the user provider that is invoked to actually retrieve users. | | The expiry time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | | The throttle setting is the number of seconds a user must wait before | generating more password reset tokens. This prevents the user from | quickly generating a very large amount of password reset tokens. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), 'expire' => 60, 'throttle' => 60, ], ], /* |-------------------------------------------------------------------------- | Password Confirmation Timeout |-------------------------------------------------------------------------- | | Here you may define the number of seconds before a password confirmation | window expires and users are asked to re-enter their password via the | confirmation screen. By default, the timeout lasts for three hours. | */ 'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800), ]; --- FILE: config/cache.php --- env('CACHE_STORE', 'database'), /* |-------------------------------------------------------------------------- | Cache Stores |-------------------------------------------------------------------------- | | Here you may define all of the cache "stores" for your application as | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | | Supported drivers: "array", "database", "file", "memcached", | "redis", "dynamodb", "octane", | "failover", "null" | */ 'stores' => [ 'array' => [ 'driver' => 'array', 'serialize' => false, ], 'database' => [ 'driver' => 'database', 'connection' => env('DB_CACHE_CONNECTION'), 'table' => env('DB_CACHE_TABLE', 'cache'), 'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), 'lock_table' => env('DB_CACHE_LOCK_TABLE'), ], 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), 'lock_path' => storage_path('framework/cache/data'), ], 'memcached' => [ 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ 'driver' => 'redis', 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), ], 'dynamodb' => [ 'driver' => 'dynamodb', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'endpoint' => env('DYNAMODB_ENDPOINT'), ], 'octane' => [ 'driver' => 'octane', ], 'failover' => [ 'driver' => 'failover', 'stores' => [ 'database', 'array', ], ], ], /* |-------------------------------------------------------------------------- | Cache Key Prefix |-------------------------------------------------------------------------- | | When utilizing the APC, database, memcached, Redis, and DynamoDB cache | stores, there might be other applications using the same cache. For | that reason, you may prefix every cache key to avoid collisions. | */ 'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'), /* |-------------------------------------------------------------------------- | Serializable Classes |-------------------------------------------------------------------------- | | This value determines the classes that can be unserialized from cache | storage. By default, no PHP classes will be unserialized from your | cache to prevent gadget chain attacks if your APP_KEY is leaked. | */ 'serializable_classes' => false, ]; --- FILE: config/database.php --- env('DB_CONNECTION', 'sqlite'), /* |-------------------------------------------------------------------------- | Database Connections |-------------------------------------------------------------------------- | | Below are all of the database connections defined for your application. | An example configuration is provided for each database system which | is supported by Laravel. You're free to add / remove connections. | */ 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DB_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 'busy_timeout' => null, 'journal_mode' => null, 'synchronous' => null, 'transaction_mode' => 'DEFERRED', ], 'mysql' => [ 'driver' => 'mysql', 'url' => env('DB_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'laravel'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => env('DB_CHARSET', 'utf8mb4'), 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ (PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'mariadb' => [ 'driver' => 'mariadb', 'url' => env('DB_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'laravel'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => env('DB_CHARSET', 'utf8mb4'), 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ (PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'pgsql' => [ 'driver' => 'pgsql', 'url' => env('DB_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), 'database' => env('DB_DATABASE', 'laravel'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), 'charset' => env('DB_CHARSET', 'utf8'), 'prefix' => '', 'prefix_indexes' => true, 'search_path' => 'public', 'sslmode' => env('DB_SSLMODE', 'prefer'), ], 'sqlsrv' => [ 'driver' => 'sqlsrv', 'url' => env('DB_URL'), 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '1433'), 'database' => env('DB_DATABASE', 'laravel'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), 'charset' => env('DB_CHARSET', 'utf8'), 'prefix' => '', 'prefix_indexes' => true, // 'encrypt' => env('DB_ENCRYPT', 'yes'), // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), ], ], /* |-------------------------------------------------------------------------- | Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of | the migrations on disk haven't actually been run on the database. | */ 'migrations' => [ 'table' => 'migrations', 'update_date_on_publish' => true, ], /* |-------------------------------------------------------------------------- | Redis Databases |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also | provides a richer body of commands than a typical key-value system | such as Memcached. You may define your connection settings here. | */ 'redis' => [ 'client' => env('REDIS_CLIENT', 'phpredis'), 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), 'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'), 'persistent' => env('REDIS_PERSISTENT', false), ], 'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), 'max_retries' => env('REDIS_MAX_RETRIES', 3), 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'), 'backoff_base' => env('REDIS_BACKOFF_BASE', 100), 'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000), ], 'cache' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), 'max_retries' => env('REDIS_MAX_RETRIES', 3), 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'), 'backoff_base' => env('REDIS_BACKOFF_BASE', 100), 'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000), ], ], ]; --- FILE: config/filesystems.php --- env('FILESYSTEM_DISK', 'local'), /* |-------------------------------------------------------------------------- | Filesystem Disks |-------------------------------------------------------------------------- | | Below you may configure as many filesystem disks as necessary, and you | may even configure multiple disks for the same driver. Examples for | most supported storage drivers are configured here for reference. | | Supported drivers: "local", "ftp", "sftp", "s3" | */ 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app/private'), 'serve' => true, 'throw' => false, 'report' => false, ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage', 'visibility' => 'public', 'throw' => false, 'report' => false, ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 'throw' => false, 'report' => false, ], ], /* |-------------------------------------------------------------------------- | Symbolic Links |-------------------------------------------------------------------------- | | Here you may configure the symbolic links that will be created when the | `storage:link` Artisan command is executed. The array keys should be | the locations of the links and the values should be their targets. | */ 'links' => [ public_path('storage') => storage_path('app/public'), ], ]; --- FILE: config/logging.php --- env('LOG_CHANNEL', 'stack'), /* |-------------------------------------------------------------------------- | Deprecations Log Channel |-------------------------------------------------------------------------- | | This option controls the log channel that should be used to log warnings | regarding deprecated PHP and library features. This allows you to get | your application ready for upcoming major versions of dependencies. | */ 'deprecations' => [ 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 'trace' => env('LOG_DEPRECATIONS_TRACE', false), ], /* |-------------------------------------------------------------------------- | Log Channels |-------------------------------------------------------------------------- | | Here you may configure the log channels for your application. Laravel | utilizes the Monolog PHP logging library, which includes a variety | of powerful log handlers and formatters that you're free to use. | | Available drivers: "single", "daily", "slack", "syslog", | "errorlog", "monolog", "custom", "stack" | */ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => explode(',', (string) env('LOG_STACK', 'single')), 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), 'replace_placeholders' => true, ], 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), 'days' => env('LOG_DAILY_DAYS', 14), 'replace_placeholders' => true, ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => env('LOG_SLACK_USERNAME', env('APP_NAME', 'Laravel')), 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), 'level' => env('LOG_LEVEL', 'critical'), 'replace_placeholders' => true, ], 'papertrail' => [ 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), ], 'processors' => [PsrLogMessageProcessor::class], ], 'stderr' => [ 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), 'handler' => StreamHandler::class, 'handler_with' => [ 'stream' => 'php://stderr', ], 'formatter' => env('LOG_STDERR_FORMATTER'), 'processors' => [PsrLogMessageProcessor::class], ], 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER), 'replace_placeholders' => true, ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => env('LOG_LEVEL', 'debug'), 'replace_placeholders' => true, ], 'null' => [ 'driver' => 'monolog', 'handler' => NullHandler::class, ], 'emergency' => [ 'path' => storage_path('logs/laravel.log'), ], ], ]; --- FILE: config/mail.php --- env('MAIL_MAILER', 'log'), /* |-------------------------------------------------------------------------- | Mailer Configurations |-------------------------------------------------------------------------- | | Here you may configure all of the mailers used by your application plus | their respective settings. Several examples have been configured for | you and you are free to add your own as your application requires. | | Laravel supports a variety of mail "transport" drivers that can be used | when delivering an email. You may specify which one you're using for | your mailers below. You may also add additional mailers if needed. | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", | "postmark", "resend", "log", "array", | "failover", "roundrobin" | */ 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', 'scheme' => env('MAIL_SCHEME'), 'url' => env('MAIL_URL'), 'host' => env('MAIL_HOST', '127.0.0.1'), 'port' => env('MAIL_PORT', 2525), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)), ], 'ses' => [ 'transport' => 'ses', ], 'postmark' => [ 'transport' => 'postmark', // 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'), // 'client' => [ // 'timeout' => 5, // ], ], 'resend' => [ 'transport' => 'resend', ], 'sendmail' => [ 'transport' => 'sendmail', 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), ], 'log' => [ 'transport' => 'log', 'channel' => env('MAIL_LOG_CHANNEL'), ], 'array' => [ 'transport' => 'array', ], 'failover' => [ 'transport' => 'failover', 'mailers' => [ 'smtp', 'log', ], 'retry_after' => 60, ], 'roundrobin' => [ 'transport' => 'roundrobin', 'mailers' => [ 'ses', 'postmark', ], 'retry_after' => 60, ], ], /* |-------------------------------------------------------------------------- | Global "From" Address |-------------------------------------------------------------------------- | | You may wish for all emails sent by your application to be sent from | the same address. Here you may specify a name and address that is | used globally for all emails that are sent by your application. | */ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')), ], ]; --- FILE: config/music.php --- [ 'Tekno' => 'Tekno', 'House' => 'House', 'Electronic' => 'Electronic', 'Acid' => 'Acid', 'Hard-Techno' => 'Hard-Techno', 'Industrial' => 'Industrial', ], ]; --- FILE: config/queue.php --- env('QUEUE_CONNECTION', 'database'), /* |-------------------------------------------------------------------------- | Queue Connections |-------------------------------------------------------------------------- | | Here you may configure the connection options for every queue backend | used by your application. An example configuration is provided for | each backend supported by Laravel. You're also free to add more. | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", | "deferred", "background", "failover", "null" | */ 'connections' => [ 'sync' => [ 'driver' => 'sync', ], 'database' => [ 'driver' => 'database', 'connection' => env('DB_QUEUE_CONNECTION'), 'table' => env('DB_QUEUE_TABLE', 'jobs'), 'queue' => env('DB_QUEUE', 'default'), 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), 'after_commit' => false, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), 'queue' => env('BEANSTALKD_QUEUE', 'default'), 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), 'block_for' => 0, 'after_commit' => false, ], 'sqs' => [ 'driver' => 'sqs', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 'queue' => env('SQS_QUEUE', 'default'), 'suffix' => env('SQS_SUFFIX'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'after_commit' => false, ], 'redis' => [ 'driver' => 'redis', 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90), 'block_for' => null, 'after_commit' => false, ], 'deferred' => [ 'driver' => 'deferred', ], 'background' => [ 'driver' => 'background', ], 'failover' => [ 'driver' => 'failover', 'connections' => [ 'database', 'deferred', ], ], ], /* |-------------------------------------------------------------------------- | Job Batching |-------------------------------------------------------------------------- | | The following options configure the database and table that store job | batching information. These options can be updated to any database | connection and table which has been defined by your application. | */ 'batching' => [ 'database' => env('DB_CONNECTION', 'sqlite'), 'table' => 'job_batches', ], /* |-------------------------------------------------------------------------- | Failed Queue Jobs |-------------------------------------------------------------------------- | | These options configure the behavior of failed queue job logging so you | can control how and where failed jobs are stored. Laravel ships with | support for storing failed jobs in a simple file or in a database. | | Supported drivers: "database-uuids", "dynamodb", "file", "null" | */ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'sqlite'), 'table' => 'failed_jobs', ], ]; --- FILE: config/services.php --- [ 'key' => env('POSTMARK_API_KEY'), ], 'resend' => [ 'key' => env('RESEND_API_KEY'), ], 'ses' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'slack' => [ 'notifications' => [ 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), ], ], ]; --- FILE: config/session.php --- env('SESSION_DRIVER', 'database'), /* |-------------------------------------------------------------------------- | Session Lifetime |-------------------------------------------------------------------------- | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them | to expire immediately when the browser is closed then you may | indicate that via the expire_on_close configuration option. | */ 'lifetime' => (int) env('SESSION_LIFETIME', 120), 'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false), /* |-------------------------------------------------------------------------- | Session Encryption |-------------------------------------------------------------------------- | | This option allows you to easily specify that all of your session data | should be encrypted before it's stored. All encryption is performed | automatically by Laravel and you may use the session like normal. | */ 'encrypt' => env('SESSION_ENCRYPT', false), /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- | | When utilizing the "file" session driver, the session files are placed | on disk. The default storage location is defined here; however, you | are free to provide another location where they should be stored. | */ 'files' => storage_path('framework/sessions'), /* |-------------------------------------------------------------------------- | Session Database Connection |-------------------------------------------------------------------------- | | When using the "database" or "redis" session drivers, you may specify a | connection that should be used to manage these sessions. This should | correspond to a connection in your database configuration options. | */ 'connection' => env('SESSION_CONNECTION'), /* |-------------------------------------------------------------------------- | Session Database Table |-------------------------------------------------------------------------- | | When using the "database" session driver, you may specify the table to | be used to store sessions. Of course, a sensible default is defined | for you; however, you're welcome to change this to another table. | */ 'table' => env('SESSION_TABLE', 'sessions'), /* |-------------------------------------------------------------------------- | Session Cache Store |-------------------------------------------------------------------------- | | When using one of the framework's cache driven session backends, you may | define the cache store which should be used to store the session data | between requests. This must match one of your defined cache stores. | | Affects: "dynamodb", "memcached", "redis" | */ 'store' => env('SESSION_STORE'), /* |-------------------------------------------------------------------------- | Session Sweeping Lottery |-------------------------------------------------------------------------- | | Some session drivers must manually sweep their storage location to get | rid of old sessions from storage. Here are the chances that it will | happen on a given request. By default, the odds are 2 out of 100. | */ 'lottery' => [2, 100], /* |-------------------------------------------------------------------------- | Session Cookie Name |-------------------------------------------------------------------------- | | Here you may change the name of the session cookie that is created by | the framework. Typically, you should not need to change this value | since doing so does not grant a meaningful security improvement. | */ 'cookie' => env( 'SESSION_COOKIE', Str::slug((string) env('APP_NAME', 'laravel')).'-session' ), /* |-------------------------------------------------------------------------- | Session Cookie Path |-------------------------------------------------------------------------- | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of | your application, but you're free to change this when necessary. | */ 'path' => env('SESSION_PATH', '/'), /* |-------------------------------------------------------------------------- | Session Cookie Domain |-------------------------------------------------------------------------- | | This value determines the domain and subdomains the session cookie is | available to. By default, the cookie will be available to the root | domain without subdomains. Typically, this shouldn't be changed. | */ 'domain' => env('SESSION_DOMAIN'), /* |-------------------------------------------------------------------------- | HTTPS Only Cookies |-------------------------------------------------------------------------- | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep | the cookie from being sent to you when it can't be done securely. | */ 'secure' => env('SESSION_SECURE_COOKIE'), /* |-------------------------------------------------------------------------- | HTTP Access Only |-------------------------------------------------------------------------- | | Setting this value to true will prevent JavaScript from accessing the | value of the cookie and the cookie will only be accessible through | the HTTP protocol. It's unlikely you should disable this option. | */ 'http_only' => env('SESSION_HTTP_ONLY', true), /* |-------------------------------------------------------------------------- | Same-Site Cookies |-------------------------------------------------------------------------- | | This option determines how your cookies behave when cross-site requests | take place, and can be used to mitigate CSRF attacks. By default, we | will set this value to "lax" to permit secure cross-site requests. | | See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value | | Supported: "lax", "strict", "none", null | */ 'same_site' => env('SESSION_SAME_SITE', 'lax'), /* |-------------------------------------------------------------------------- | Partitioned Cookies |-------------------------------------------------------------------------- | | Setting this value to true will tie the cookie to the top-level site for | a cross-site context. Partitioned cookies are accepted by the browser | when flagged "secure" and the Same-Site attribute is set to "none". | */ 'partitioned' => env('SESSION_PARTITIONED_COOKIE', false), /* |-------------------------------------------------------------------------- | Session Serialization |-------------------------------------------------------------------------- | | This value controls the serialization strategy for session data, which | is JSON by default. Setting this to "php" allows the storage of PHP | objects in the session but can make an application vulnerable to | "gadget chain" serialization attacks if the APP_KEY is leaked. | | Supported: "json", "php" | */ 'serialization' => 'json', ]; --- FILE: database/factories/UserFactory.php --- */ class UserFactory extends Factory { /** * The current password being used by the factory. */ protected static ?string $password; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'name' => fake()->name(), 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), 'password' => static::$password ??= Hash::make('password'), 'remember_token' => Str::random(10), ]; } /** * Indicate that the model's email address should be unverified. */ public function unverified(): static { return $this->state(fn (array $attributes) => [ 'email_verified_at' => null, ]); } } --- FILE: database/migrations/0001_01_01_000000_create_users_table.php --- id(); $table->string('name'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); Schema::create('password_reset_tokens', function (Blueprint $table) { $table->string('email')->primary(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); Schema::create('sessions', function (Blueprint $table) { $table->string('id')->primary(); $table->foreignId('user_id')->nullable()->index(); $table->string('ip_address', 45)->nullable(); $table->text('user_agent')->nullable(); $table->longText('payload'); $table->integer('last_activity')->index(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('users'); Schema::dropIfExists('password_reset_tokens'); Schema::dropIfExists('sessions'); } }; --- FILE: database/migrations/0001_01_01_000001_create_cache_table.php --- string('key')->primary(); $table->mediumText('value'); $table->bigInteger('expiration')->index(); }); Schema::create('cache_locks', function (Blueprint $table) { $table->string('key')->primary(); $table->string('owner'); $table->bigInteger('expiration')->index(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('cache'); Schema::dropIfExists('cache_locks'); } }; --- FILE: database/migrations/0001_01_01_000002_create_jobs_table.php --- id(); $table->string('queue')->index(); $table->longText('payload'); $table->unsignedTinyInteger('attempts'); $table->unsignedInteger('reserved_at')->nullable(); $table->unsignedInteger('available_at'); $table->unsignedInteger('created_at'); }); Schema::create('job_batches', function (Blueprint $table) { $table->string('id')->primary(); $table->string('name'); $table->integer('total_jobs'); $table->integer('pending_jobs'); $table->integer('failed_jobs'); $table->longText('failed_job_ids'); $table->mediumText('options')->nullable(); $table->integer('cancelled_at')->nullable(); $table->integer('created_at'); $table->integer('finished_at')->nullable(); }); Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); $table->string('uuid')->unique(); $table->text('connection'); $table->text('queue'); $table->longText('payload'); $table->longText('exception'); $table->timestamp('failed_at')->useCurrent(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('jobs'); Schema::dropIfExists('job_batches'); Schema::dropIfExists('failed_jobs'); } }; --- FILE: database/migrations/2026_04_02_101320_create_artists_table.php --- id(); $table->string('name'); $table->string('slug')->unique(); $table->text('bio')->nullable(); $table->string('photo')->nullable(); // Path dell'immagine $table->json('social_links')->nullable(); // Per Instagram, Spotify, ecc. $table->boolean('is_active')->default(true); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('artists'); } }; --- FILE: database/migrations/2026_04_02_101321_create_posts_table.php --- id(); $table->string('title'); $table->string('slug')->unique(); $table->text('content'); $table->string('image')->nullable(); // Cover della news $table->string('category')->default('News'); // News, Eventi, Release $table->boolean('is_published')->default(false); $table->timestamp('published_at')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('posts'); } }; --- FILE: database/migrations/2026_04_06_151001_update_artists_table_with_social_and_crypto.php --- string('soundcloud_url')->nullable(); $table->string('facebook_url')->nullable(); $table->string('instagram_url')->nullable(); $table->string('spotify_url')->nullable(); $table->string('youtube_url')->nullable(); $table->string('apple_music_url')->nullable(); // --- Web3 & Lightning Network (Zaps & Tips) --- $table->string('ln_address')->nullable(); // Es: fabio@getalby.com (per la LNURL-pay) $table->string('lightning_wallet')->nullable(); // Indirizzo Wallet / PubKey $table->string('nostr_npub')->nullable(); // Il profilo Nostr (fondamentale per la censura) // --- Media --- $table->string('profile_image')->nullable(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('artists', function (Blueprint $table) { // }); } }; --- FILE: database/migrations/2026_04_06_152844_add_missing_fields_to_artists_table.php --- string('style')->nullable(); if (!Schema::hasColumn('artists', 'soundcloud_url')) $table->string('soundcloud_url')->nullable(); if (!Schema::hasColumn('artists', 'spotify_url')) $table->string('spotify_url')->nullable(); if (!Schema::hasColumn('artists', 'instagram_url')) $table->string('instagram_url')->nullable(); if (!Schema::hasColumn('artists', 'ln_address')) $table->string('ln_address')->nullable(); if (!Schema::hasColumn('artists', 'nostr_npub')) $table->string('nostr_npub')->nullable(); if (!Schema::hasColumn('artists', 'profile_image')) $table->string('profile_image')->nullable(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('artists', function (Blueprint $table) { // }); } }; --- FILE: database/migrations/2026_04_06_153628_add_user_id_to_artists_table.php --- foreignId('user_id')->nullable()->constrained()->onDelete('cascade'); } }); } public function down(): void { Schema::table('artists', function (Blueprint $table) { $table->dropColumn('user_id'); }); } }; --- FILE: database/migrations/2026_04_06_171627_create_news_table.php --- id(); $table->string('title'); $table->string('slug')->unique(); $table->text('content'); $table->string('image_path')->nullable(); $table->boolean('is_published')->default(true); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('news'); } }; --- FILE: database/migrations/2026_04_06_212108_create_news_table.php --- id(); // Autore della news collegato alla tabella users $table->foreignId('user_id')->constrained()->onDelete('cascade'); // Contenuto Editoriale $table->string('title'); $table->string('slug')->unique(); // Per URL SEO-friendly $table->text('content'); $table->string('image_path')->nullable(); // Cover della notizia // --- Integrazione Social/Nostr --- // event_id per tracciare il post corrispondente sul protocollo Nostr $table->string('nostr_event_id')->nullable()->index(); // Stato di pubblicazione $table->boolean('is_published')->default(false); $table->timestamp('published_at')->nullable(); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('news'); } }; --- FILE: database/migrations/2026_04_06_213436_add_is_admin_to_users_table.php --- boolean('is_in_rotation')->default(false)->after('is_approved'); }); } public function down(): void { Schema::table('users', function (Blueprint $table) { $table->dropColumn('is_admin'); }); } }; --- FILE: database/migrations/2026_04_07_155536_add_rotation_to_tracks_table.php --- timestamp('approved_at')->nullable()->after('is_approved'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('tracks', function (Blueprint $table) { $table->dropColumn('approved_at'); }); } }; --- FILE: database/migrations/2026_04_14_132611_create_contests_table.php --- id(); $table->string('title'); $table->string('slug')->unique(); $table->text('description'); // HTML dall'editor $table->text('legal_disclaimer')->nullable(); // La liberatoria $table->string('image_path')->nullable(); $table->string('rules_pdf')->nullable(); $table->string('playlist_url')->nullable(); $table->integer('max_tracks_per_artist')->default(1); $table->dateTime('start_date')->nullable(); $table->dateTime('end_date')->nullable(); $table->boolean('is_active')->default(true); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('contests'); } }; --- FILE: database/migrations/2026_04_14_133003_create_contest_track_table.php --- id(); $table->foreignId('contest_id')->constrained()->onDelete('cascade'); $table->foreignId('track_id')->constrained()->onDelete('cascade'); // Logica di consenso legale // Registriamo che l'artista ha accettato la liberatoria specifica di questo contest $table->boolean('accepted_legal_terms')->default(false); $table->timestamp('accepted_at')->nullable(); $table->string('status')->default('pending'); // pending, approved, finalist, winner $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('contest_track'); } }; --- FILE: database/migrations/2026_04_15_115738_add_radio_flags_to_tracks_table.php --- boolean('is_approved')->default(false)->after('id'); } if (!Schema::hasColumn('tracks', 'in_playlist')) { $table->boolean('in_playlist')->default(false)->after('is_approved'); } }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('tracks', function (Blueprint $table) { // }); } }; --- FILE: database/migrations/create_traks_table.php --- id(); // --- DATI IDENTIFICATIVI --- $table->string('title'); // Titolo della traccia $table->string('slug')->unique(); // Per URL puliti e QR Code (es: rude-hz.it/track/acid-rain) $table->string('version')->default('Original Mix'); // Remix, Edit, etc. // --- DATI TECNICI --- $table->integer('bpm')->nullable(); $table->string('key')->nullable(); // Tonalità (es: 4A, Am) $table->string('genre')->default('Techno'); $table->year('release_year')->nullable(); // --- DISTRIBUZIONE & COPYRIGHT --- $table->string('label')->nullable(); // Etichetta discografica $table->string('isrc_code')->nullable()->unique(); // Codice standard internazionale $table->boolean('is_published')->default(false); // Se è già uscita ufficialmente $table->string('buy_link')->nullable(); // Link a Beatport/Bandcamp // --- FILE & MEDIA --- $table->string('file_path'); // Percorso del file audio .mp3/.wav $table->string('cover_path')->nullable(); // Immagine di copertina della traccia $table->string('qr_code_path')->nullable(); // Percorso dell'immagine QR generata // --- RELAZIONI & MODERAZIONE --- $table->foreignId('user_id')->constrained()->onDelete('cascade'); // Chi l'ha caricata (User) $table->foreignId('artist_id')->constrained()->onDelete('cascade'); // L'artista associato // Il tuo "bottoncino" di validazione $table->boolean('is_approved')->default(false); $table->boolean('is_featured')->default(false); // Per la sezione "In evidenza" nella Home $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('tracks'); } }; --- FILE: database/seeders/DatabaseSeeder.php --- call([ UserSeeder::class, ]); } } --- FILE: database/seeders/UserSeeder.php --- 'Fabio Admin', 'email' => 'frigeriwki@gmail.com', 'password' => Hash::make('techno'), // Metti la password che preferisci ]); // Profilo Artista di Test (se vuoi un secondo account) User::create([ 'name' => 'Fabio Artist', 'email' => 'artist@rude-hz.it', 'password' => Hash::make('techno'), ]); } } --- FILE: package.json --- { "$schema": "https://www.schemastore.org/package.json", "private": true, "type": "module", "scripts": { "build": "vite build", "dev": "vite" }, "devDependencies": { "@tailwindcss/forms": "^0.5.2", "@tailwindcss/vite": "^4.0.0", "alpinejs": "^3.4.2", "autoprefixer": "^10.4.2", "axios": ">=1.11.0 <=1.14.0", "concurrently": "^9.0.1", "laravel-vite-plugin": "^3.0.0", "postcss": "^8.4.31", "tailwindcss": "^3.1.0", "vite": "^8.0.0" } } --- FILE: public/index.php --- handleRequest(Request::capture()); --- FILE: resources/views/admin/artists/create.blade.php ---

{{ __('Nuovo Artista Rude-Hz') }}

@csrf

Identità Artistica

Presenza Web

⚡ Protocolli & Mance

Annulla
--- FILE: resources/views/admin/artists/edit.blade.php ---

{{ __('Modifica Artista: ') }} {{ $artist->name }}

← Torna alla lista
@csrf @method('PUT')

Identità Artistica

@if($artist->profile_image) @endif

⚡ Protocolli & Mance

Social & Web

@foreach(['soundcloud', 'spotify', 'instagram', 'facebook', 'youtube'] as $social) @php $field = $social . '_url'; @endphp
@endforeach
{{ __('Annulla') }} {{ __('Salva Modifiche') }}
--- FILE: resources/views/admin/artists/index.blade.php ---

Anagrafica Artisti Rude-Hz

@foreach($artists as $artist) @endforeach
Artista Social Connect Tech Stack (Nostr/LN) Console
{{ $artist->name }}
{{ $artist->style ?? 'DEFAULT' }}
☁️
N {{ Str::limit($artist->nostr_pubkey, 15) }}
Tips Offline
Edit ✍️
--- FILE: resources/views/admin/artists/show.blade.php ---
@if($artist->photo) @endif
@if($artist->ln_address)
>
@endif

{{ $artist->name }}

{{ $artist->style ?? 'Electronic Artist' }}

@if($artist->spotify_url) Spotify @endif @if($artist->soundcloud_url) SoundCloud @endif @if($artist->instagram_url) Instagram @endif @if($artist->apple_music_url) Apple Music @endif
{{ $artist->bio }}

Approved Tracks

@foreach($tracks as $track)
{{ $track->genre }}

{{ $track->title }}

@endforeach
--- FILE: resources/views/admin/contests/create.blade.php ---

Crea Nuovo Contest

@csrf

Puoi usare tag HTML per la formattazione (es: <b>testo</b>).

PUBBLICA CONTEST
--- FILE: resources/views/admin/contests/edit.blade.php ---

Modifica Contest: {{ $contest->title }}

← Torna alla lista
@if ($errors->any())
Attenzione! Ci sono degli errori:
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
@csrf @method('PATCH')
@if($contest->image_path)
Immagine attuale
@endif
@if($contest->rules_pdf) @endif
is_active) ? 'checked' : '' }} class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500">
SALVA MODIFICHE
--- FILE: resources/views/admin/contests/index.blade.php ---

{{ __('Gestione Contest') }}

+ Nuovo Contest
@if(session('success'))
{{ session('success') }}
@endif
@forelse($contests as $contest) @empty @endforelse
Immagine Titolo / Slug Iscritti Stato Azioni
@if($contest->image_path) @else
NO IMG
@endif
{{ $contest->title }}
{{ $contest->slug }}
{{ $contest->tracks_count }} tracce @if($contest->is_active) ● Attivo @else ○ Off @endif
Modifica
@csrf @method('DELETE')
Nessun contest creato. Crea il primo ora.
--- FILE: resources/views/admin/dashboard.blade.php ---

Amministrazione

Dashboard Generale

Stato Sistema: Operativo
@php $stats = [ ['label' => 'Da Moderare', 'value' => \App\Models\Track::where('is_approved', 0)->count(), 'link' => route('admin.radio.archive'), 'color' => 'orange'], ['label' => 'Artisti Iscritti', 'value' => \App\Models\Artist::count(), 'link' => route('admin.artists.index'), 'color' => 'black'], ['label' => 'Contest Attivi', 'value' => \App\Models\Contest::count(), 'link' => route('admin.contests.index'), 'color' => 'black'] ]; @endphp @foreach($stats as $stat)

{{ $stat['label'] }}

{{ $stat['value'] }}

Dettagli →
@endforeach

Ultime Tracce in Revisione

Gestisci Archivio
@foreach(\App\Models\Track::with('artist')->latest()->take(5)->get() as $track) @endforeach
Titolo / Artista Stato Azioni
{{ $track->title }}
{{ $track->artist->name ?? 'Indipendente' }}
Pending Modifica
--- FILE: resources/views/admin/news/create.blade.php ---

{{ __('Crea Nuova News') }}

@csrf
@error('title')

{{ $message }}

@enderror
@error('image')

{{ $message }}

@enderror
@error('content')

{{ $message }}

@enderror
--- FILE: resources/views/admin/news/edit.blade.php ---

{{ __('Modifica News:') }} {{ $news->title }}

← Torna alla lista
@csrf @method('PATCH')
@error('title')

{{ $message }}

@enderror

Carica una nuova foto solo se vuoi cambiarla.

is_published ? 'checked' : '' }} class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">

Creato il: {{ $news->created_at->format('d/m/Y H:i') }}

--- FILE: resources/views/admin/news/index.blade.php ---

Redazione News

+ Nuova News
@foreach($news as $article) @endforeach
Titolo Stato Data Azioni
{{ $article->title }} {{ $article->is_published ? 'Pubblicato' : 'Bozza' }} {{ $article->created_at->format('d/m/y') }} Modifica
{{ $news->links() }}
--- FILE: resources/views/admin/news/show.blade.php ---
News & Culture

{{ $news->title }}

{{ $news->created_at->format('d F Y') }} — Rude-Hz Staff
@if($news->image)
@endif
{!! nl2br(e($news->content)) !!}
--- FILE: resources/views/admin/radio/archive.blade.php ---

Gestione Tracce

@foreach($tracks as $track) @endforeach
Immagine Titolo / Slug Artista Stato Azioni
{{ $track->title }}
{{ $track->slug }}
{{ $track->artist->name ?? 'Indipendente' }} @if($track->is_approved) ATTIVO @else PENDING @endif
@csrf @method('PATCH')
@csrf @method('DELETE')
--- FILE: resources/views/admin/radio/index.blade.php ---

{{ __('Dashboard Amministrazione') }}

Brani in attesa
{{ $pendingTracksCount }}
Totale Archivio
{{ $totalTracks }}
Artisti Registrati
{{ \App\Models\Artist::count() }}

Azioni Rapide

{{ __('Nuova News') }} {{ __('Nuovo Artista') }}
--- FILE: resources/views/admin/radio/moderation.blade.php ---

{{ __('Moderazione Tracce') }}

@if(session('success'))
{{ session('success') }}
@endif
@forelse($pendingTracks as $track) @empty @endforelse
Titolo / Versione Info Artista Azioni
{{ $track->title }}
{{ $track->version ?? 'Standard' }}
{{ $track->artist_name }}
@csrf @method('PATCH') {{ __('Approva') }}
@csrf @method('DELETE') {{ __('Elimina') }}
Nessun master in attesa. Il Raspberry sta riposando.
{{ $pendingTracks->links() }}
--- FILE: resources/views/admin/radio/playlist.blade.php ---

Selezione Playlist Raspberry

@csrf
@foreach($approvedTracks as $track) @endforeach
--- FILE: resources/views/artist/show.blade.php ---

{{ $artist->name }}

@if($artist->soundcloud_url)SoundCloud@endif @if($artist->spotify_url)Spotify@endif @if($artist->instagram_url)Instagram@endif

Bio

{{ $artist->bio }}

@if($artist->nostr_npub)

Nostr Discovery

{{ $artist->nostr_npub }}
@endif

Lightning Support ⚡

Supporta {{ $artist->name }} con i Satoshi

@if($artist->ln_address)

LN Address

{{ $artist->ln_address }}

@endif

Lightning Network Support ⚡

Supporta {{ $artist->name }} con i Satoshi

Invia mance istantanee senza intermediari.

QR Code Lightning

Scan to Zap ⚡

Official Tracks

@forelse($tracks as $track)

{{ $track->title }}

{{ $track->genre }} | {{ $track->bpm }} BPM | {{ $track->version }}

@empty

Nessun master approvato per questo artista.

@endforelse
--- FILE: resources/views/auth/confirm-password.blade.php ---
{{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
@csrf
{{ __('Confirm') }}
--- FILE: resources/views/auth/forgot-password.blade.php ---
{{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }}
@csrf
{{ __('Email Password Reset Link') }}
--- FILE: resources/views/auth/login.blade.php ---
@csrf
@if (Route::has('password.request')) {{ __('Forgot your password?') }} @endif {{ __('Log in') }}
--- FILE: resources/views/auth/register.blade.php ---
@csrf
{{ __('Already Registered?') }}
--- FILE: resources/views/auth/reset-password.blade.php ---
@csrf
{{ __('Reset Password') }}
--- FILE: resources/views/auth/verify-email.blade.php ---
{{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }}
@if (session('status') == 'verification-link-sent')
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
@endif
@csrf
{{ __('Resend Verification Email') }}
@csrf
--- FILE: resources/views/components/admin-layout.blade.php --- RUDE-HZ // CONSOLE @vite(['resources/css/app.css', 'resources/js/app.js'])
{{ $slot }}
--- FILE: resources/views/components/admin-sidebar.blade.php --- --- FILE: resources/views/components/application-logo.blade.php --- --- FILE: resources/views/components/auth-session-status.blade.php --- @props(['status']) @if ($status)
merge(['class' => 'font-medium text-sm text-green-600']) }}> {{ $status }}
@endif --- FILE: resources/views/components/danger-button.blade.php --- --- FILE: resources/views/components/dropdown-link.blade.php --- merge(['class' => 'block w-full px-4 py-2 text-start text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out']) }}>{{ $slot }} --- FILE: resources/views/components/dropdown.blade.php --- @props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white']) @php $alignmentClasses = match ($align) { 'left' => 'ltr:origin-top-left rtl:origin-top-right start-0', 'top' => 'origin-top', default => 'ltr:origin-top-right rtl:origin-top-left end-0', }; $width = match ($width) { '48' => 'w-48', default => $width, }; @endphp
{{ $trigger }}
--- FILE: resources/views/components/input-error.blade.php --- @props(['messages']) @if ($messages)
    merge(['class' => 'text-sm text-red-600 space-y-1']) }}> @foreach ((array) $messages as $message)
  • {{ $message }}
  • @endforeach
@endif --- FILE: resources/views/components/input-label.blade.php --- @props(['value']) --- FILE: resources/views/components/modal.blade.php --- @props([ 'name', 'show' => false, 'maxWidth' => '2xl' ]) @php $maxWidth = [ 'sm' => 'sm:max-w-sm', 'md' => 'sm:max-w-md', 'lg' => 'sm:max-w-lg', 'xl' => 'sm:max-w-xl', '2xl' => 'sm:max-w-2xl', ][$maxWidth]; @endphp
{{ $slot }}
--- FILE: resources/views/components/nav-link.blade.php --- @props(['active']) @php $classes = ($active ?? false) ? 'inline-flex items-center px-1 pt-1 border-b-2 border-indigo-400 text-sm font-medium leading-5 text-gray-900 focus:outline-none focus:border-indigo-700 transition duration-150 ease-in-out' : 'inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out'; @endphp merge(['class' => $classes]) }}> {{ $slot }} --- FILE: resources/views/components/primary-button.blade.php --- --- FILE: resources/views/components/responsive-nav-link.blade.php --- @props(['active']) @php $classes = ($active ?? false) ? 'block w-full ps-3 pe-4 py-2 border-l-4 border-indigo-400 text-start text-base font-medium text-indigo-700 bg-indigo-50 focus:outline-none focus:text-indigo-800 focus:bg-indigo-100 focus:border-indigo-700 transition duration-150 ease-in-out' : 'block w-full ps-3 pe-4 py-2 border-l-4 border-transparent text-start text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition duration-150 ease-in-out'; @endphp merge(['class' => $classes]) }}> {{ $slot }} --- FILE: resources/views/components/secondary-button.blade.php --- --- FILE: resources/views/components/text-input.blade.php --- @props(['disabled' => false]) merge(['class' => 'bg-[#0a0a0a] border-gray-800 text-white font-bold placeholder-gray-500 focus:border-[#d9ff00] focus:ring-[#d9ff00] rounded-md shadow-sm w-full py-3']) !!}> --- FILE: resources/views/contests/index.blade.php --- @extends('layouts.frontend') @section('content')

Contest Attivi

@forelse($contests as $contest)
@if($contest->image_path) @endif

{{ $contest->title }}

{{ strip_tags($contest->description) }}
Entry Open Leggi Tutto
@empty

Nessun contest attivo al momento.

@endforelse
@endsection --- FILE: resources/views/contests/show.blade.php --- @extends('layouts.frontend') @section('content')
{{-- Navigazione Back --}} ← Indietro ai Contest
{{-- Titolo Contest --}}

{{ $contest->title }}

{{-- Immagine Cover --}} @if($contest->image_path)
{{ $contest->title }} {{-- Overlay leggero per profondità --}}
@endif {{-- Descrizione --}}
{!! nl2br(e($contest->description)) !!}
{{-- AREA PARTECIPAZIONE --}} @auth @if(!auth()->user()->is_admin) {{-- Contenitore Arrotondato con Glow --}}

Invia la tua traccia

@csrf
{{-- Select Arrotondata --}}
{{-- Icona freccia custom per la select --}}
{{-- Checkbox stilizzata --}}
@if($userTracks->count() > 0) @else Vai allo studio per caricare musica @endif
@endif @else {{-- Box Invito Login Arrotondato --}}

Vuoi partecipare?

Accedi per caricare le tue tracce e sfidare gli altri.

Login / Register
@endauth
@endsection --- FILE: resources/views/dashboard.blade.php ---

Console di Comando

SYSTEM_LOG: Monitoring active on Raspberry Pi 4

Tracce in Coda
{{ \App\Models\Track::where('is_approved', false)->count() }}
Artisti Totali
{{ \App\Models\Artist::count() }}
News Pubblicate
{{ \App\Models\News::count() }}

Ultimi Upload da Moderare

Nessuna traccia in coda al momento.

Accedi alla Moderazione →
--- FILE: resources/views/layouts/admin.blade.php --- Rude-Hz ADMIN @vite(['resources/css/app.css', 'resources/js/app.js'])
{{ $slot }}
--- FILE: resources/views/layouts/app.blade.php --- {{ config('app.name', 'Laravel') }} @vite(['resources/css/app.css', 'resources/js/app.js'])
@include('layouts.navigation') @isset($header)
{{ $header }}
@endisset
{{ $slot }}
--- FILE: resources/views/layouts/frontend.blade.php --- Rude-Hz.it @vite(['resources/css/app.css', 'resources/js/app.js'])
@yield('content')
--- FILE: resources/views/layouts/guest.blade.php --- {{ config('app.name', 'Rude-Hz') }} @vite(['resources/css/app.css', 'resources/js/app.js'])
{{ $slot }}
© {{ date('Y') }} RUDE-HZ COMMUNITY
--- FILE: resources/views/layouts/navigation.blade.php ---
@if(auth()->check() && auth()->user()->is_admin) @else @endif
--- FILE: resources/views/livewire/player.blade.php ---
@if($currentTrack)

{{ $currentTrack->title }}

{{ $currentTrack->artist->name }}

@else

Nessun brano in onda...

@endif
--- FILE: resources/views/news/index.blade.php --- @extends('layouts.frontend') @section('content')
{{-- Container con padding proporzionale (px-8 su mobile, px-24 su desktop) --}}
{{-- Header: Spazi calcolati in multipli di 4 --}}

News & Factory

{{-- Griglia: Gap proporzionale (gap-12 = 3rem) --}}
@forelse($news as $article)
{{-- Image Wrapper: Altezza fissa tramite Aspect Ratio --}}
{{-- Overlay di profondità --}}
@if($article->image_path) {{ $article->title }} @else
RUDE-HZ
@endif {{-- Data posizionata in modo millimetrico --}}
{{ $article->created_at->format('d.m.y') }}
{{-- Text Content: Allineamento e distanze fisse --}}

{{ $article->title }}

{{ Str::limit(strip_tags($article->content), 140) }}

@empty

// Archivio News Non Rilevato //

@endforelse
{{-- Paginazione Pulita --}}
{{ $news->links() }}
@endsection --- FILE: resources/views/news/show.blade.php --- @extends('layouts.frontend') @section('content')
{{-- Torna alla lista con freccia neon --}} ← Archivio News
{{-- Header: Data e Titolo --}}
// PUBBLICATO IL {{ $news->created_at->format('d.m.Y') }}

{{ $news->title }}

{{-- Immagine di Copertina con bordo neon soffuso --}} @if($news->image_path)
@endif {{-- Contenuto della News --}}
{!! nl2br(e($news->content)) !!}

@endsection --- FILE: resources/views/profile/edit.blade.php ---

{{ __('Profile') }}

@include('profile.partials.update-profile-information-form')
@include('profile.partials.update-password-form')
@include('profile.partials.delete-user-form')
--- FILE: resources/views/profile/liberatoria.blade.php --- @extends('layouts.frontend') @section('content')

Liberatoria Legale

Per poter partecipare ai contest e pubblicare le tue tracce su Rude-Hz, è necessario completare i dati della liberatoria per la gestione dei diritti.

@csrf
{{-- Nome Reale --}}
{{-- Codice Fiscale --}}
{{-- Testo Liberatoria --}}

Termini e Condizioni

L'artista dichiara di essere l'unico autore e titolare dei diritti delle tracce caricate... [Inserisci qui il testo legale della tua liberatoria]
{{-- Check di Accettazione --}}
user()->accepted_terms ? 'checked' : '' }}>
@endsection --- FILE: resources/views/profile/partials/delete-user-form.blade.php ---

{{ __('Delete Account') }}

{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.') }}

{{ __('Delete Account') }}
@csrf @method('delete')

{{ __('Are you sure you want to delete your account?') }}

{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.') }}

{{ __('Cancel') }} {{ __('Delete Account') }}
--- FILE: resources/views/profile/partials/update-password-form.blade.php ---

{{ __('Update Password') }}

{{ __('Ensure your account is using a long, random password to stay secure.') }}

@csrf @method('put')
{{ __('Save') }} @if (session('status') === 'password-updated')

{{ __('Saved.') }}

@endif
--- FILE: resources/views/profile/partials/update-profile-information-form.blade.php ---

{{ __('Profile Information') }}

{{ __("Update your account's profile information and email address.") }}

@csrf
@csrf @method('patch')
@if ($user instanceof \Illuminate\Contracts\Auth\MustVerifyEmail && ! $user->hasVerifiedEmail())

{{ __('Your email address is unverified.') }}

@if (session('status') === 'verification-link-sent')

{{ __('A new verification link has been sent to your email address.') }}

@endif
@endif
{{ __('Save') }} @if (session('status') === 'profile-updated')

{{ __('Saved.') }}

@endif
--- FILE: resources/views/user/studio.blade.php ---

{{ __('Artista') }}

@if(session('success'))
{{ session('success') }}
@endif
@csrf

Artist Identity

Visual Branding

No Cover
No Avatar

About

Protocols & Payments

Social & Streaming

--- FILE: resources/views/user/tracks/edit.blade.php ---

{{ __('Modifica Traccia') }}

← Torna al Catalogo
@if(session('success'))
{{ session('success') }}
@endif
Preview Audio
@csrf @method('PATCH')

Metadati Traccia

Stato Approvazione {{ $track->is_approved ? 'Approved & Live' : 'Pending Review' }}
Slug Sistema {{ $track->slug }}

Promozione & QR Link

Share on channels:
WhatsApp Facebook @if(auth()->user()->artist->instagram_url) Instagram @endif
Direct Link: {{ url('/track/'.$track->slug) }}
--- FILE: resources/views/user/tracks/index.blade.php ---

{{ __('Tracce') }}

@if(session('success'))
{{ session('success') }}
@endif
@forelse($tracks as $track) @empty @endforelse
{{ $track->title }} {{ $track->version ?? 'Original Mix' }} — {{ $track->genre }}
@csrf @method('DELETE')
Il catalogo è vuoto
@csrf
--- FILE: resources/views/user/tracks/show.blade.php ---
Rude-Hz Drop

{{ $track->title }}

{{ $track->artist->name }}

Genre {{ $track->genre }}
BPM {{ $track->bpm ?? '160' }}
Version {{ $track->version ?? 'Original' }}
--- FILE: resources/views/welcome.blade.php --- @extends('layouts.frontend') @section('content')

The Harder
Side of Sound

La community tekno nata dai social.

@php $latestTrack = $tracks->first(); @endphp

Top Artists

I talenti della community

@foreach($artists as $artist)
{{-- FIX QUI: Parentesi e concatenazione sistemata --}} {{ $artist->name }}

{{ $artist->name }}

{{ $artist->style ?? 'Techno' }}

@endforeach

Latest Drops

@endsection @push('scripts') @endpush --- FILE: routes/auth.php --- group(function () { Route::get('register', [RegisteredUserController::class, 'create']) ->name('register'); Route::post('register', [RegisteredUserController::class, 'store']); Route::get('login', [AuthenticatedSessionController::class, 'create']) ->name('login'); Route::post('login', [AuthenticatedSessionController::class, 'store']); Route::get('forgot-password', [PasswordResetLinkController::class, 'create']) ->name('password.request'); Route::post('forgot-password', [PasswordResetLinkController::class, 'store']) ->name('password.email'); Route::get('reset-password/{token}', [NewPasswordController::class, 'create']) ->name('password.reset'); Route::post('reset-password', [NewPasswordController::class, 'store']) ->name('password.store'); }); Route::middleware('auth')->group(function () { Route::get('verify-email', EmailVerificationPromptController::class) ->name('verification.notice'); Route::get('verify-email/{id}/{hash}', VerifyEmailController::class) ->middleware(['signed', 'throttle:6,1']) ->name('verification.verify'); Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store']) ->middleware('throttle:6,1') ->name('verification.send'); Route::get('confirm-password', [ConfirmablePasswordController::class, 'show']) ->name('password.confirm'); Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']); Route::put('password', [PasswordController::class, 'update'])->name('password.update'); Route::post('logout', [AuthenticatedSessionController::class, 'destroy']) ->name('logout'); }); --- FILE: routes/console.php --- comment(Inspiring::quote()); })->purpose('Display an inspiring quote'); --- FILE: routes/web.php --- name('track.public.show'); Route::get('/', function () { $tracks = Track::where('is_approved', true)->with('artist')->latest()->get(); $artists = Artist::latest()->get(); $latestNews = News::latest()->first(); $otherNews = News::latest()->skip(1)->take(5)->get(); return view('welcome', compact('tracks', 'artists', 'latestNews', 'otherNews')); })->name('home'); Route::get('/news', [\App\Http\Controllers\NewsController::class, 'index'])->name('news.index'); Route::get('/news/{slug}', [\App\Http\Controllers\NewsController::class, 'show'])->name('news.show'); Route::get('/artists/{artist:slug}', [\App\Http\Controllers\ArtistController::class, 'show'])->name('artists.show'); Route::get('/contests', [\App\Http\Controllers\ContestController::class, 'index'])->name('contests.index'); Route::get('/contests/{slug}', [\App\Http\Controllers\ContestController::class, 'show'])->name('contests.show'); /* --- 2. AREA PRIVATA --- */ Route::middleware(['auth'])->group(function () { // Switcher Dashboard Route::get('/dashboard', function () { return auth()->user()->is_admin ? redirect()->route('admin.dashboard') : redirect()->route('user.studio'); })->name('dashboard'); // Logout Route::get('/exit', function (Request $request) { Auth::logout(); $request->session()->invalidate(); $request->session()->regenerateToken(); return redirect('/'); })->name('logout.get'); // Profilo Breeze Route::prefix('profile')->name('profile.')->group(function () { Route::get('/', [ProfileController::class, 'edit'])->name('edit'); Route::patch('/', [ProfileController::class, 'update'])->name('update'); Route::delete('/', [ProfileController::class, 'destroy'])->name('destroy'); }); /* --- MY STUDIO (ARTISTA) --- */ Route::middleware(['can:user-only'])->prefix('my-studio')->group(function () { Route::get('/', function () { $user = auth()->user(); $artist = Artist::firstOrCreate( ['user_id' => $user->id], ['name' => $user->name, 'slug' => Str::slug($user->name . '-' . $user->id), 'style' => 'default'] ); $tracks = Track::where('user_id', $user->id)->latest()->get(); return view('user.studio', compact('tracks', 'artist', 'user')); })->name('user.studio'); Route::get('/tracks', [\App\Http\Controllers\User\TrackUploadController::class, 'index'])->name('user.tracks.index'); Route::post('/upload-track', [\App\Http\Controllers\User\TrackUploadController::class, 'store'])->name('track.store'); Route::patch('/tracks/{track}', [\App\Http\Controllers\User\TrackUploadController::class, 'update'])->name('user.track.update'); Route::delete('/tracks/{track}', [\App\Http\Controllers\User\TrackUploadController::class, 'destroy'])->name('user.track.destroy'); Route::get('/tracks/{track}/edit', [App\Http\Controllers\User\TrackUploadController::class, 'edit'])->name('user.track.edit'); Route::post('/update-artist', [\App\Http\Controllers\ArtistController::class, 'updateArtist'])->name('user.update.artist'); Route::post('/contests/{contest}/join', [\App\Http\Controllers\ContestController::class, 'join'])->name('contests.join'); }); // LIBERATORIA Route::middleware(['auth'])->group(function () { Route::get('/liberatoria', [ProfileController::class, 'editLiberatoria'])->name('profile.liberatoria'); Route::post('/liberatoria', [ProfileController::class, 'updateLiberatoria'])->name('profile.liberatoria.update'); }); /* --- CONSOLE ADMIN --- */ Route::middleware(['can:admin-only'])->prefix('admin')->name('admin.')->group(function () { Route::get('/', [\App\Http\Controllers\Admin\RadioController::class, 'index'])->name('dashboard'); // GESTIONE RADIO (CENTRALE) Route::prefix('radio')->name('radio.')->group(function () { // Archivio Unificato (Include la logica di Moderazione) Route::get('/archive', [\App\Http\Controllers\Admin\RadioController::class, 'archive'])->name('archive'); Route::patch('/approve/{track}', [\App\Http\Controllers\Admin\RadioController::class, 'toggleApprove'])->name('approve'); Route::delete('/destroy/{track}', [\App\Http\Controllers\Admin\RadioController::class, 'destroy'])->name('destroy'); // Nuova Sezione Playlist per Player MP3 Route::get('/playlist', [\App\Http\Controllers\Admin\RadioController::class, 'playlist'])->name('playlist'); Route::post('/playlist/update', [\App\Http\Controllers\Admin\RadioController::class, 'updatePlaylist'])->name('playlist.update'); }); // Risorse Admin Route::resource('news', \App\Http\Controllers\Admin\NewsController::class); Route::resource('contests', \App\Http\Controllers\Admin\ContestController::class); Route::resource('artists', \App\Http\Controllers\Admin\ArtistController::class)->parameters(['artists' => 'artist']); // Moderazione Contest Route::get('/contests/{contest}/participants', [\App\Http\Controllers\Admin\ContestController::class, 'participants'])->name('contests.participants'); Route::patch('/contests/{contest}/tracks/{track}/status', [\App\Http\Controllers\Admin\ContestController::class, 'updateTrackStatus'])->name('contests.update-status'); }); }); require __DIR__.'/auth.php'; --- FILE: tests/Feature/Auth/AuthenticationTest.php --- get('/login'); $response->assertStatus(200); } public function test_users_can_authenticate_using_the_login_screen(): void { $user = User::factory()->create(); $response = $this->post('/login', [ 'email' => $user->email, 'password' => 'password', ]); $this->assertAuthenticated(); $response->assertRedirect(route('dashboard', absolute: false)); } public function test_users_can_not_authenticate_with_invalid_password(): void { $user = User::factory()->create(); $this->post('/login', [ 'email' => $user->email, 'password' => 'wrong-password', ]); $this->assertGuest(); } public function test_users_can_logout(): void { $user = User::factory()->create(); $response = $this->actingAs($user)->post('/logout'); $this->assertGuest(); $response->assertRedirect('/'); } } --- FILE: tests/Feature/Auth/EmailVerificationTest.php --- unverified()->create(); $response = $this->actingAs($user)->get('/verify-email'); $response->assertStatus(200); } public function test_email_can_be_verified(): void { $user = User::factory()->unverified()->create(); Event::fake(); $verificationUrl = URL::temporarySignedRoute( 'verification.verify', now()->addMinutes(60), ['id' => $user->id, 'hash' => sha1($user->email)] ); $response = $this->actingAs($user)->get($verificationUrl); Event::assertDispatched(Verified::class); $this->assertTrue($user->fresh()->hasVerifiedEmail()); $response->assertRedirect(route('dashboard', absolute: false).'?verified=1'); } public function test_email_is_not_verified_with_invalid_hash(): void { $user = User::factory()->unverified()->create(); $verificationUrl = URL::temporarySignedRoute( 'verification.verify', now()->addMinutes(60), ['id' => $user->id, 'hash' => sha1('wrong-email')] ); $this->actingAs($user)->get($verificationUrl); $this->assertFalse($user->fresh()->hasVerifiedEmail()); } } --- FILE: tests/Feature/Auth/PasswordConfirmationTest.php --- create(); $response = $this->actingAs($user)->get('/confirm-password'); $response->assertStatus(200); } public function test_password_can_be_confirmed(): void { $user = User::factory()->create(); $response = $this->actingAs($user)->post('/confirm-password', [ 'password' => 'password', ]); $response->assertRedirect(); $response->assertSessionHasNoErrors(); } public function test_password_is_not_confirmed_with_invalid_password(): void { $user = User::factory()->create(); $response = $this->actingAs($user)->post('/confirm-password', [ 'password' => 'wrong-password', ]); $response->assertSessionHasErrors(); } } --- FILE: tests/Feature/Auth/PasswordResetTest.php --- get('/forgot-password'); $response->assertStatus(200); } public function test_reset_password_link_can_be_requested(): void { Notification::fake(); $user = User::factory()->create(); $this->post('/forgot-password', ['email' => $user->email]); Notification::assertSentTo($user, ResetPassword::class); } public function test_reset_password_screen_can_be_rendered(): void { Notification::fake(); $user = User::factory()->create(); $this->post('/forgot-password', ['email' => $user->email]); Notification::assertSentTo($user, ResetPassword::class, function ($notification) { $response = $this->get('/reset-password/'.$notification->token); $response->assertStatus(200); return true; }); } public function test_password_can_be_reset_with_valid_token(): void { Notification::fake(); $user = User::factory()->create(); $this->post('/forgot-password', ['email' => $user->email]); Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) { $response = $this->post('/reset-password', [ 'token' => $notification->token, 'email' => $user->email, 'password' => 'password', 'password_confirmation' => 'password', ]); $response ->assertSessionHasNoErrors() ->assertRedirect(route('login')); return true; }); } } --- FILE: tests/Feature/Auth/PasswordUpdateTest.php --- create(); $response = $this ->actingAs($user) ->from('/profile') ->put('/password', [ 'current_password' => 'password', 'password' => 'new-password', 'password_confirmation' => 'new-password', ]); $response ->assertSessionHasNoErrors() ->assertRedirect('/profile'); $this->assertTrue(Hash::check('new-password', $user->refresh()->password)); } public function test_correct_password_must_be_provided_to_update_password(): void { $user = User::factory()->create(); $response = $this ->actingAs($user) ->from('/profile') ->put('/password', [ 'current_password' => 'wrong-password', 'password' => 'new-password', 'password_confirmation' => 'new-password', ]); $response ->assertSessionHasErrorsIn('updatePassword', 'current_password') ->assertRedirect('/profile'); } } --- FILE: tests/Feature/Auth/RegistrationTest.php --- get('/register'); $response->assertStatus(200); } public function test_new_users_can_register(): void { $response = $this->post('/register', [ 'name' => 'Test User', 'email' => 'test@example.com', 'password' => 'password', 'password_confirmation' => 'password', ]); $this->assertAuthenticated(); $response->assertRedirect(route('dashboard', absolute: false)); } } --- FILE: tests/Feature/ExampleTest.php --- get('/'); $response->assertStatus(200); } } --- FILE: tests/Feature/ProfileTest.php --- create(); $response = $this ->actingAs($user) ->get('/profile'); $response->assertOk(); } public function test_profile_information_can_be_updated(): void { $user = User::factory()->create(); $response = $this ->actingAs($user) ->patch('/profile', [ 'name' => 'Test User', 'email' => 'test@example.com', ]); $response ->assertSessionHasNoErrors() ->assertRedirect('/profile'); $user->refresh(); $this->assertSame('Test User', $user->name); $this->assertSame('test@example.com', $user->email); $this->assertNull($user->email_verified_at); } public function test_email_verification_status_is_unchanged_when_the_email_address_is_unchanged(): void { $user = User::factory()->create(); $response = $this ->actingAs($user) ->patch('/profile', [ 'name' => 'Test User', 'email' => $user->email, ]); $response ->assertSessionHasNoErrors() ->assertRedirect('/profile'); $this->assertNotNull($user->refresh()->email_verified_at); } public function test_user_can_delete_their_account(): void { $user = User::factory()->create(); $response = $this ->actingAs($user) ->delete('/profile', [ 'password' => 'password', ]); $response ->assertSessionHasNoErrors() ->assertRedirect('/'); $this->assertGuest(); $this->assertNull($user->fresh()); } public function test_correct_password_must_be_provided_to_delete_account(): void { $user = User::factory()->create(); $response = $this ->actingAs($user) ->from('/profile') ->delete('/profile', [ 'password' => 'wrong-password', ]); $response ->assertSessionHasErrorsIn('userDeletion', 'password') ->assertRedirect('/profile'); $this->assertNotNull($user->fresh()); } } --- FILE: tests/TestCase.php --- assertTrue(true); } }