mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
podcasts added
This commit is contained in:
31
database/factories/EpisodeFactory.php
Normal file
31
database/factories/EpisodeFactory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Episode;
|
||||
use App\Models\Podcast;
|
||||
|
||||
class EpisodeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Episode::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'podcast_id' => Podcast::factory(),
|
||||
'data' => '{}',
|
||||
];
|
||||
}
|
||||
}
|
||||
31
database/factories/PodcastFactory.php
Normal file
31
database/factories/PodcastFactory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Podcast;
|
||||
|
||||
class PodcastFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Podcast::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->faker->sentence(4),
|
||||
'link' => $this->faker->word,
|
||||
'data' => '{}',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePodcastsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('podcasts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('guid')
|
||||
->unique();
|
||||
$table->string('title');
|
||||
$table->string('link');
|
||||
$table->string('language_code');
|
||||
$table->json('data');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('podcasts');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateEpisodesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::create('episodes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('guid')
|
||||
->unique();
|
||||
$table->foreignId('podcast_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete()
|
||||
->cascadeOnUpdate();
|
||||
$table->json('data');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('episodes');
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class CreateLibrariesTable extends Migration
|
||||
{
|
||||
Schema::create('libraries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name')->unique();
|
||||
$table->boolean('is_public')
|
||||
->default(true);
|
||||
$table->json('language_codes')
|
||||
|
||||
@@ -20,6 +20,11 @@ class CreateLibraryItemsTable extends Migration
|
||||
->constrained()
|
||||
->cascadeOnDelete()
|
||||
->cascadeOnUpdate();
|
||||
$table->foreignId('episode_id')
|
||||
->nullable()
|
||||
->constrained()
|
||||
->cascadeOnDelete()
|
||||
->cascadeOnUpdate();
|
||||
$table->unsignedInteger('order_column');
|
||||
$table->string('name');
|
||||
$table->string('type');
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Console\Commands\Database\CreateTags;
|
||||
use App\Console\Commands\Feed\ReadAndSyncEinundzwanzigPodcastFeed;
|
||||
use App\Models\Category;
|
||||
use App\Models\City;
|
||||
use App\Models\Country;
|
||||
@@ -277,5 +278,6 @@ class DatabaseSeeder extends Seeder
|
||||
$libraryItem->syncTagsWithType(['Präsentationen'], 'library_item');
|
||||
$nonPublicLibrary->libraryItems()
|
||||
->attach($libraryItem);
|
||||
Artisan::call(ReadAndSyncEinundzwanzigPodcastFeed::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user