parent
e09351b964
commit
bab2a7bdcc
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Artist;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
public function get_artists(Request $request)
|
||||
{
|
||||
|
||||
$artists = Artist::all();
|
||||
$data = array();
|
||||
|
||||
foreach ($artists as $artist) {
|
||||
$data[] = [
|
||||
'id' => $artist->id,
|
||||
'name' => $artist->name,
|
||||
'url_remote' => $artist->url_remote,
|
||||
'state' => $artist->state,
|
||||
'thumbnail' => $artist->thumbnail,
|
||||
];
|
||||
}
|
||||
|
||||
\Log::info('=======================');
|
||||
$response = json_encode( array('data' => $data));
|
||||
\Log::info($response);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ArtistQueue extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
<?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::create('artist_queues', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->foreignId('artist_id')->constrained('artists');
|
||||
$table->foreignId('album_id')->nullable()->constrained('albums');
|
||||
$table->enum('state', [
|
||||
'pending',
|
||||
'in_progress',
|
||||
'done',
|
||||
])->default('pending');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('artist_queues');
|
||||
}
|
||||
};
|
||||
Loading…
Reference in new issue