feat: integrate Spotify API for syncing music productions with new command and UI components

This commit is contained in:
Ümit Tunç
2026-05-20 22:31:41 +03:00
parent f35632ee0d
commit 751b9339f0
15 changed files with 666 additions and 9 deletions
+7
View File
@@ -63,3 +63,10 @@ AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"
# Spotify Web API (Müzik Prodüksiyonları senkronizasyonu)
# NOT: Developer Dashboard'da uygulamayı oluşturan Spotify hesabında Premium abonelik gerekir.
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=
SPOTIFY_ARTIST_ID=
SPOTIFY_MARKET=TR
@@ -0,0 +1,191 @@
<?php
namespace App\Console\Commands;
use App\Models\MusicProduction;
use App\Services\SpotifyService;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class SyncSpotifyMusicProductions extends Command
{
protected $signature = 'spotify:sync-music-productions
{--artist= : Override Spotify artist ID}
{--dry-run : Show changes without writing to database}';
protected $description = 'Spotify sanatçı hesabından albüm ve single verilerini müzik prodüksiyonlarına senkronize eder';
public function handle(SpotifyService $spotifyService): int
{
if ($this->option('artist')) {
$spotifyService = new SpotifyService(
artistId: $this->option('artist'),
);
}
if (! $spotifyService->isConfigured()) {
$this->error(__('music_productions.spotify_not_configured'));
return Command::FAILURE;
}
$this->info(__('music_productions.spotify_sync_started'));
try {
$albumSummaries = $spotifyService->getArtistAlbums();
} catch (\Throwable $exception) {
$this->error($exception->getMessage());
return Command::FAILURE;
}
if (empty($albumSummaries)) {
$this->warn(__('music_productions.spotify_no_albums'));
return Command::SUCCESS;
}
$created = 0;
$updated = 0;
$dryRun = (bool) $this->option('dry-run');
foreach ($albumSummaries as $index => $albumSummary) {
$albumId = $albumSummary['id'] ?? null;
if (blank($albumId)) {
continue;
}
$album = $spotifyService->getAlbum($albumId) ?? $albumSummary;
$title = $album['name'] ?? __('music_productions.spotify_untitled_album');
$artistName = collect($album['artists'] ?? [])->pluck('name')->first();
$releaseDate = $this->parseReleaseDate($album['release_date'] ?? null, $album['release_date_precision'] ?? 'day');
$spotifyUrl = $album['external_urls']['spotify'] ?? null;
$coverUrl = collect($album['images'] ?? [])->first()['url'] ?? null;
$albumType = $album['album_type'] ?? 'album';
$production = $this->findMatchingProduction($albumId, $title);
$action = $production ? 'update' : 'create';
$this->line(sprintf(
'[%d/%d] %s: %s (%s)',
$index + 1,
count($albumSummaries),
$action === 'create' ? 'Yeni' : 'Güncelle',
$title,
$releaseDate?->format('Y-m-d') ?? '-'
));
if ($dryRun) {
continue;
}
$attributes = [
'spotify_album_id' => $albumId,
'spotify_url' => $spotifyUrl,
'spotify_cover_url' => $coverUrl,
'spotify_type' => $albumType,
'spotify_synced_at' => now(),
];
if (! $production) {
$attributes['title'] = $title;
$attributes['slug'] = SpotifyService::uniqueSlug($title);
$attributes['client_name'] = $artistName;
$attributes['production_date'] = $releaseDate;
$attributes['content'] = $spotifyService->buildDefaultContent($album);
$attributes['is_active'] = true;
$attributes['sort_order'] = 0;
$coverPath = $spotifyService->downloadCoverImage($coverUrl, $albumId);
if ($coverPath) {
$attributes['cover_image'] = $coverPath;
}
MusicProduction::create($attributes);
$created++;
continue;
}
if (blank($production->title)) {
$attributes['title'] = $title;
}
if (blank($production->client_name) && filled($artistName)) {
$attributes['client_name'] = $artistName;
}
if (blank($production->production_date) && $releaseDate) {
$attributes['production_date'] = $releaseDate;
}
if (blank($production->content)) {
$attributes['content'] = $spotifyService->buildDefaultContent($album);
}
if (blank($production->cover_image) && filled($coverUrl)) {
$coverPath = $spotifyService->downloadCoverImage($coverUrl, $albumId);
if ($coverPath) {
$attributes['cover_image'] = $coverPath;
}
}
$production->update($attributes);
$updated++;
usleep(150000);
}
$message = __('music_productions.spotify_sync_completed', [
'created' => $created,
'updated' => $updated,
'total' => count($albumSummaries),
]);
$this->info($message);
Log::info('Spotify music productions sync completed', [
'created' => $created,
'updated' => $updated,
'total' => count($albumSummaries),
'dry_run' => $dryRun,
]);
return Command::SUCCESS;
}
protected function findMatchingProduction(string $albumId, string $title): ?MusicProduction
{
$bySpotifyId = MusicProduction::withTrashed()
->where('spotify_album_id', $albumId)
->first();
if ($bySpotifyId) {
return $bySpotifyId->trashed() ? null : $bySpotifyId;
}
$slug = Str::slug($title);
$bySlug = MusicProduction::where('slug', '=', $slug, 'and')->first();
if ($bySlug) {
return $bySlug;
}
return MusicProduction::whereRaw('LOWER(title) = ?', [Str::lower($title)], 'and')->first();
}
protected function parseReleaseDate(?string $date, string $precision = 'day'): ?Carbon
{
if (blank($date)) {
return null;
}
return match ($precision) {
'year' => Carbon::createFromFormat('Y', $date)->startOfYear(),
'month' => Carbon::createFromFormat('Y-m', $date)->startOfMonth(),
default => Carbon::parse($date),
};
}
}
@@ -2,9 +2,14 @@
namespace App\Filament\Admin\Resources\MusicProductions\Pages;
use App\Console\Commands\SyncSpotifyMusicProductions;
use App\Filament\Admin\Resources\MusicProductions\MusicProductionResource;
use App\Services\SpotifyService;
use Filament\Actions\Action;
use Filament\Actions\CreateAction;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Support\Facades\Artisan;
class ListMusicProductions extends ListRecords
{
@@ -18,6 +23,31 @@ class ListMusicProductions extends ListRecords
protected function getHeaderActions(): array
{
return [
Action::make('syncSpotify')
->label(__('music_productions.sync_spotify'))
->icon('heroicon-o-arrow-path')
->color('success')
->requiresConfirmation()
->modalHeading(__('music_productions.sync_spotify_heading'))
->modalDescription(__('music_productions.sync_spotify_description'))
->visible(fn (): bool => app(SpotifyService::class)->isConfigured())
->action(function (): void {
$exitCode = Artisan::call(SyncSpotifyMusicProductions::class);
if ($exitCode !== 0) {
Notification::make()
->title(__('music_productions.spotify_sync_failed'))
->danger()
->send();
return;
}
Notification::make()
->title(__('music_productions.spotify_sync_success'))
->success()
->send();
}),
CreateAction::make()
->label(__('music_productions.create')),
];
@@ -3,13 +3,16 @@
namespace App\Filament\Admin\Resources\MusicProductions\Schemas;
use App\Filament\Admin\Resources\Components\TranslationTabs;
use App\Models\MusicProduction;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Placeholder;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Illuminate\Support\Str;
class MusicProductionForm
{
@@ -30,7 +33,7 @@ class MusicProductionForm
if ($operation !== 'create') {
return;
}
$set('slug', \Str::slug($state));
$set('slug', Str::slug($state));
}),
TextInput::make('slug')
@@ -93,6 +96,33 @@ class MusicProductionForm
])
->columnSpan(1)
->collapsible(false),
Section::make(__('music_productions.spotify_section'))
->schema([
Placeholder::make('spotify_album_id_display')
->label(__('music_productions.spotify_album_id_field'))
->content(fn (?MusicProduction $record): string => $record?->spotify_album_id ?? '-'),
Placeholder::make('spotify_type_display')
->label(__('music_productions.spotify_type_field'))
->content(fn (?MusicProduction $record): string => $record?->spotify_type
? __('music_productions.spotify_type_' . $record->spotify_type, [], $record->spotify_type)
: '-'),
Placeholder::make('spotify_url_display')
->label(__('music_productions.spotify_url_field'))
->content(fn (?MusicProduction $record): string => $record?->spotify_url ?? '-'),
Placeholder::make('spotify_synced_at_display')
->label(__('music_productions.spotify_synced_at_field'))
->content(fn (?MusicProduction $record): string => $record?->spotify_synced_at
?->timezone(config('app.timezone'))
->format('d.m.Y H:i') ?? '-'),
])
->columnSpanFull()
->collapsible(true)
->collapsed(true)
->visible(fn (?MusicProduction $record): bool => filled($record?->spotify_album_id)),
// Alt Kısım - Galeri Görselleri
Section::make(__('music_productions.gallery_field'))
@@ -2,6 +2,7 @@
namespace App\Filament\Admin\Resources\MusicProductions\Tables;
use App\Models\MusicProduction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
@@ -21,7 +22,7 @@ class MusicProductionsTable
->columns([
ImageColumn::make('cover_image')
->label(__('music_productions.cover_image_field'))
->disk('public')
->getStateUsing(fn (MusicProduction $record): ?string => $record->cover_image_url)
->square()
->size(60),
@@ -47,6 +48,19 @@ class MusicProductionsTable
->label(__('music_productions.table_production_date'))
->date('d.m.Y')
->sortable(),
TextColumn::make('spotify_type')
->label(__('music_productions.spotify_type_field'))
->badge()
->formatStateUsing(fn (?string $state): string => filled($state)
? __('music_productions.spotify_type_' . $state, [], $state)
: '-')
->color(fn (?string $state): string => match ($state) {
'single' => 'info',
'album' => 'success',
default => 'gray',
})
->toggleable(),
ToggleColumn::make('is_active')
->label(__('music_productions.table_is_active'))
@@ -15,7 +15,7 @@ class MusicProductionController extends Controller
{
// Get Settings
$settings = new \stdClass();
$allSettings = Setting::where('is_active', true)->get();
$allSettings = Setting::where('is_active', '=', true, 'and')->get();
foreach ($allSettings as $setting) {
$settings->{$setting->key} = $setting->value;
}
@@ -78,7 +78,7 @@ class MusicProductionController extends Controller
// Get Settings
$settings = new \stdClass();
$allSettings = Setting::where('is_active', true)->get();
$allSettings = Setting::where('is_active', '=', true, 'and')->get();
foreach ($allSettings as $setting) {
$settings->{$setting->key} = $setting->value;
}
@@ -147,7 +147,7 @@ class MusicProductionController extends Controller
$meta = [
'title' => $production->translate('title'),
'description' => \Str::limit(strip_tags($production->translate('content')), 160),
'image' => $production->cover_image ? asset('storage/' . $production->cover_image) : null,
'image' => $production->cover_image_url,
];
return view('front.music-productions.show', compact('production', 'prev', 'next', 'settings', 'renderedHeader', 'renderedFooter', 'meta'));
+19
View File
@@ -16,6 +16,11 @@ class MusicProduction extends Model
protected $fillable = [
'title',
'slug',
'spotify_album_id',
'spotify_url',
'spotify_cover_url',
'spotify_type',
'spotify_synced_at',
'cover_image',
'content',
'client_name',
@@ -36,6 +41,7 @@ class MusicProduction extends Model
protected $casts = [
'production_date' => 'date',
'spotify_synced_at' => 'datetime',
'gallery' => 'array',
'is_active' => 'boolean',
'sort_order' => 'integer',
@@ -51,10 +57,23 @@ class MusicProduction extends Model
if ($this->cover_image) {
return asset('storage/' . $this->cover_image);
}
if ($this->spotify_cover_url) {
return $this->spotify_cover_url;
}
return null;
}
public function getDisplayCoverImageAttribute(): ?string
{
if ($this->cover_image) {
return $this->cover_image;
}
return null;
}
public function scopeActive($query)
{
return $query->where('is_active', true);
+252
View File
@@ -0,0 +1,252 @@
<?php
namespace App\Services;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class SpotifyService
{
protected ?string $accessToken = null;
public function __construct(
protected ?string $clientId = null,
protected ?string $clientSecret = null,
protected ?string $artistId = null,
) {
$this->clientId = $clientId ?? config('services.spotify.client_id');
$this->clientSecret = $clientSecret ?? config('services.spotify.client_secret');
$this->artistId = $artistId ?? config('services.spotify.artist_id');
}
public function isConfigured(): bool
{
return filled($this->clientId)
&& filled($this->clientSecret)
&& filled($this->artistId);
}
public function getArtistId(): ?string
{
return $this->artistId;
}
/**
* @return array<int, array<string, mixed>>
*/
public function getArtistAlbums(string $includeGroups = 'album,single'): array
{
$this->authenticate();
$albums = [];
$url = "https://api.spotify.com/v1/artists/{$this->artistId}/albums";
$params = [
'include_groups' => $includeGroups,
'limit' => 50,
'market' => config('services.spotify.market', 'TR'),
];
do {
$response = $this->client()->get($url, $params);
if ($response->failed()) {
Log::error('Spotify artist albums fetch failed', [
'status' => $response->status(),
'body' => $response->body(),
]);
throw new \RuntimeException($this->formatApiError(
__('music_productions.spotify_albums_fetch_failed'),
$response
));
}
$data = $response->json();
$items = $data['items'] ?? [];
foreach ($items as $item) {
$albums[$item['id']] = $item;
}
$url = $data['next'] ?? null;
$params = [];
} while ($url);
return array_values($albums);
}
/**
* @return array<string, mixed>|null
*/
public function getAlbum(string $albumId): ?array
{
$this->authenticate();
$response = $this->client()->get("https://api.spotify.com/v1/albums/{$albumId}", [
'market' => config('services.spotify.market', 'TR'),
]);
if ($response->failed()) {
Log::warning('Spotify album fetch failed', [
'album_id' => $albumId,
'status' => $response->status(),
'body' => $response->body(),
]);
return null;
}
return $response->json();
}
public function downloadCoverImage(?string $imageUrl, string $albumId): ?string
{
if (blank($imageUrl)) {
return null;
}
try {
$response = Http::timeout(30)->get($imageUrl);
if ($response->failed()) {
return null;
}
$extension = $this->guessImageExtension($response->header('Content-Type'));
$path = 'music-productions/covers/spotify-' . $albumId . '.' . $extension;
Storage::disk('public')->put($path, $response->body());
return $path;
} catch (\Throwable $exception) {
Log::warning('Spotify cover download failed', [
'album_id' => $albumId,
'message' => $exception->getMessage(),
]);
return null;
}
}
public function buildDefaultContent(array $album): string
{
$title = e($album['name'] ?? '');
$spotifyUrl = e($album['external_urls']['spotify'] ?? '');
$artistNames = collect($album['artists'] ?? [])
->pluck('name')
->filter()
->implode(', ');
$artistNames = e($artistNames);
$albumType = e($album['album_type'] ?? 'album');
$totalTracks = (int) ($album['total_tracks'] ?? 0);
$listenLabel = e(__('music_productions.spotify_listen_on_spotify'));
return <<<HTML
<p><strong>{$title}</strong> {$artistNames}</p>
<p>{$albumType} · {$totalTracks} {$this->trackLabel($totalTracks)}</p>
<p><a href="{$spotifyUrl}" target="_blank" rel="noopener noreferrer">{$listenLabel}</a></p>
HTML;
}
protected function trackLabel(int $count): string
{
return $count === 1
? __('music_productions.spotify_track_singular')
: __('music_productions.spotify_track_plural');
}
protected function authenticate(): void
{
if ($this->accessToken) {
return;
}
if (! $this->isConfigured()) {
throw new \RuntimeException(__('music_productions.spotify_not_configured'));
}
$response = Http::asForm()
->withHeaders([
'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret),
])
->post('https://accounts.spotify.com/api/token', [
'grant_type' => 'client_credentials',
]);
if ($response->failed()) {
Log::error('Spotify access token request failed', [
'status' => $response->status(),
'body' => $response->body(),
]);
throw new \RuntimeException($this->formatApiError(
__('music_productions.spotify_token_failed'),
$response
));
}
$this->accessToken = $response->json('access_token');
}
protected function client(): PendingRequest
{
return Http::withToken($this->accessToken)
->acceptJson()
->timeout(30);
}
protected function formatApiError(string $fallback, \Illuminate\Http\Client\Response $response): string
{
$body = trim($response->body());
$message = $body;
if (str_starts_with($body, '{')) {
$message = $response->json('error.message')
?? $response->json('error_description')
?? $body;
}
if (blank($message)) {
return $fallback;
}
if ($response->status() === 403 && str_contains(strtolower($message), 'premium')) {
return __('music_productions.spotify_premium_required', ['detail' => $message]);
}
return $fallback . ' (HTTP ' . $response->status() . ': ' . $message . ')';
}
protected function guessImageExtension(?string $contentType): string
{
return match ($contentType) {
'image/png' => 'png',
'image/webp' => 'webp',
'image/gif' => 'gif',
default => 'jpg',
};
}
public static function uniqueSlug(string $title, ?int $ignoreId = null): string
{
$baseSlug = Str::slug($title) ?: 'spotify-album';
$slug = $baseSlug;
$counter = 1;
while (
\App\Models\MusicProduction::withTrashed()
->when($ignoreId, fn ($query) => $query->where('id', '!=', $ignoreId))
->where('slug', $slug)
->exists()
) {
$slug = $baseSlug . '-' . $counter;
$counter++;
}
return $slug;
}
}
+7
View File
@@ -43,4 +43,11 @@ return [
'access_key' => env('UNSPLASH_ACCESS_KEY'),
],
'spotify' => [
'client_id' => env('SPOTIFY_CLIENT_ID'),
'client_secret' => env('SPOTIFY_CLIENT_SECRET'),
'artist_id' => env('SPOTIFY_ARTIST_ID'),
'market' => env('SPOTIFY_MARKET', 'TR'),
],
];
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('music_productions', function (Blueprint $table) {
$table->string('spotify_album_id')->nullable()->unique()->after('slug');
$table->string('spotify_url')->nullable()->after('spotify_album_id');
$table->string('spotify_cover_url')->nullable()->after('spotify_url');
$table->string('spotify_type')->nullable()->after('spotify_cover_url');
$table->timestamp('spotify_synced_at')->nullable()->after('spotify_type');
$table->index('spotify_album_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('music_productions', function (Blueprint $table) {
$table->dropIndex(['spotify_album_id']);
$table->dropColumn([
'spotify_album_id',
'spotify_url',
'spotify_cover_url',
'spotify_type',
'spotify_synced_at',
]);
});
}
};
+26
View File
@@ -75,4 +75,30 @@ return [
'title_required' => 'Title field is required.',
'slug_required' => 'URL slug field is required.',
'slug_unique' => 'This URL slug is already in use.',
// Spotify
'spotify_section' => 'Spotify Information',
'spotify_album_id_field' => 'Spotify Album ID',
'spotify_url_field' => 'Spotify URL',
'spotify_type_field' => 'Spotify Type',
'spotify_synced_at_field' => 'Last Spotify Sync',
'spotify_type_album' => 'Album',
'spotify_type_single' => 'Single',
'spotify_type_compilation' => 'Compilation',
'spotify_listen_on_spotify' => 'Listen on Spotify',
'spotify_track_singular' => 'track',
'spotify_track_plural' => 'tracks',
'sync_spotify' => 'Sync from Spotify',
'sync_spotify_heading' => 'Spotify Sync',
'sync_spotify_description' => 'Albums and singles from your artist account will be synced to music productions. Existing records are updated by title match, new records are created.',
'spotify_sync_started' => 'Starting Spotify sync...',
'spotify_sync_completed' => 'Sync completed. :created created, :updated updated (:total total).',
'spotify_sync_success' => 'Spotify sync completed successfully.',
'spotify_sync_failed' => 'Spotify sync failed. Check the logs.',
'spotify_not_configured' => 'Spotify API credentials are missing. Set SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET and SPOTIFY_ARTIST_ID in your .env file.',
'spotify_token_failed' => 'Failed to obtain Spotify access token.',
'spotify_albums_fetch_failed' => 'Failed to fetch Spotify album list.',
'spotify_premium_required' => 'The Spotify account that owns the Developer app needs an active Premium subscription. Sign in to Spotify Developer Dashboard with that account, upgrade to Premium, and wait a few hours. Detail: :detail',
'spotify_no_albums' => 'No albums or singles found on the Spotify artist account.',
'spotify_untitled_album' => 'Untitled Album',
];
+26
View File
@@ -75,4 +75,30 @@ return [
'title_required' => 'Başlık alanı zorunludur.',
'slug_required' => 'URL yolu alanı zorunludur.',
'slug_unique' => 'Bu URL yolu zaten kullanılıyor.',
// Spotify
'spotify_section' => 'Spotify Bilgileri',
'spotify_album_id_field' => 'Spotify Albüm ID',
'spotify_url_field' => 'Spotify URL',
'spotify_type_field' => 'Spotify Türü',
'spotify_synced_at_field' => 'Son Spotify Senkronizasyonu',
'spotify_type_album' => 'Albüm',
'spotify_type_single' => 'Single',
'spotify_type_compilation' => 'Derleme',
'spotify_listen_on_spotify' => 'Spotify\'da Dinle',
'spotify_track_singular' => 'parça',
'spotify_track_plural' => 'parça',
'sync_spotify' => 'Spotify\'dan Senkronize Et',
'sync_spotify_heading' => 'Spotify Senkronizasyonu',
'sync_spotify_description' => 'Sanatçı hesabınızdaki albüm ve single kayıtları müzik prodüksiyonlarına aktarılacak. Mevcut kayıtlar başlık eşleşmesine göre güncellenir, yeni kayıtlar oluşturulur.',
'spotify_sync_started' => 'Spotify senkronizasyonu başlıyor...',
'spotify_sync_completed' => 'Senkronizasyon tamamlandı. :created yeni, :updated güncellendi (toplam :total).',
'spotify_sync_success' => 'Spotify senkronizasyonu başarıyla tamamlandı.',
'spotify_sync_failed' => 'Spotify senkronizasyonu başarısız oldu. Logları kontrol edin.',
'spotify_not_configured' => 'Spotify API bilgileri eksik. .env dosyasında SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET ve SPOTIFY_ARTIST_ID değerlerini tanımlayın.',
'spotify_token_failed' => 'Spotify access token alınamadı.',
'spotify_albums_fetch_failed' => 'Spotify albüm listesi alınamadı.',
'spotify_premium_required' => 'Spotify Developer uygulamasını oluşturan hesapta aktif Premium abonelik gerekli. Spotify Developer Dashboard\'da uygulamayı oluşturan hesapla giriş yapın, Premium\'a geçin ve birkaç saat bekleyin. Detay: :detail',
'spotify_no_albums' => 'Spotify sanatçı hesabında albüm veya single bulunamadı.',
'spotify_untitled_album' => 'İsimsiz Albüm',
];
@@ -38,8 +38,8 @@
<div class="card !shadow-[0_0.25rem_1.75rem_rgba(30,34,40,0.07)] transition-all duration-300 hover:!shadow-[0_0.5rem_2.5rem_rgba(30,34,40,0.12)] hover:translate-y-[-0.15rem]">
<figure class="card-img-top overflow-hidden rounded-t group {{ $color['tooltip'] }}" title='<h5 class="!mb-0">{!! t("Detayları Görüntüle") !!}</h5>'>
<a href="{{ route('music-productions.show', $production->slug) }}">
@if($production->cover_image)
<img class="transition-all duration-[0.35s] ease-in-out group-hover:scale-105" src="{{ asset('storage/' . $production->cover_image) }}" alt="{{ $production->translate('title') }}">
@if($production->cover_image_url)
<img class="transition-all duration-[0.35s] ease-in-out group-hover:scale-105" src="{{ $production->cover_image_url }}" alt="{{ $production->translate('title') }}">
@else
<div class="bg-gradient-to-br from-gray-200 to-gray-300 flex items-center justify-center" style="height: 250px;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-16 h-16 text-gray-400">
@@ -30,9 +30,9 @@
<div class="w-full flex-[0_0_auto] !px-[15px] max-w-full">
<article class="!mt-[-12.5rem]">
{{-- Cover Image --}}
@if($production->cover_image)
@if($production->cover_image_url)
<figure class="!rounded-[.4rem] !mb-8 xl:!mb-[3.5rem] lg:!mb-[3.5rem] md:!mb-[3.5rem] overflow-hidden shadow-lg">
<img class="!rounded-[.4rem] w-full" src="{{ asset('storage/' . $production->cover_image) }}" alt="{{ $production->translate('title') }}">
<img class="!rounded-[.4rem] w-full" src="{{ $production->cover_image_url }}" alt="{{ $production->translate('title') }}">
</figure>
@endif
@@ -63,6 +63,16 @@
<p>{{ $production->translate('client_name') }}</p>
</li>
@endif
@if($production->spotify_url)
<li>
<h5 class="!mb-1">Spotify</h5>
<p>
<a href="{{ $production->spotify_url }}" target="_blank" rel="noopener noreferrer" class="btn btn-sm btn-soft-primary !rounded-[50rem]">
{{ __('music_productions.spotify_listen_on_spotify') }}
</a>
</p>
</li>
@endif
</ul>
<a href="{{ route('music-productions.index') }}" class="more hover">
<i class="uil uil-arrow-left before:content-['\e949'] !mr-1"></i>
+4
View File
@@ -4,6 +4,7 @@ use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
use App\Console\Commands\GenerateBlogAssistant;
use App\Console\Commands\SyncSpotifyMusicProductions;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
@@ -12,3 +13,6 @@ Artisan::command('inspire', function () {
// Schedule the AI Blog Assistant
// Run daily at 09:00 AM
Schedule::command(GenerateBlogAssistant::class)->dailyAt('09:00');
// Spotify müzik prodüksiyonlarını her gece senkronize et
Schedule::command(SyncSpotifyMusicProductions::class)->dailyAt('03:00');