feat: initial laravel install, models, seeders

This commit is contained in:
2023-06-21 08:53:21 -05:00
parent 86d989b51c
commit 1c81ca91d1
178 changed files with 20002 additions and 1 deletions

1
site/database/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.sqlite*

View File

@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class ArtistFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class ArtworkFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class EpisodeFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class OverlayFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class PodcastFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => fake()->name(),
'description' => fake()->paragraphs(rand(1,3), true),
'website' => 'https://' . fake()->domainName(),
'feed' => fake()->url(),
'slug' => fake()->slug(),
'published' => fake()->boolean(),
'added_at' => fake()->dateTimeThisDecade(),
];
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class WalletFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class WalletTypeFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@@ -0,0 +1,32 @@
<?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('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

View File

@@ -0,0 +1,28 @@
<?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('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');
}
};

View File

@@ -0,0 +1,32 @@
<?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('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('failed_jobs');
}
};

View File

@@ -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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@@ -0,0 +1,39 @@
<?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()
{
Schema::create('podcasts', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->longText('description')->default('');
$table->string('website')->nullable();
$table->string('slug');
$table->string('feed');
$table->boolean('published')->default(false);
$table->dateTime('added_at')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('podcasts');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateArtistsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('artists', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained();
$table->string('name')->unique();
$table->string('avatar')->nullable();
$table->string('header')->nullable();
$table->string('location');
$table->string('website')->nullable();
$table->text('bio')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('artists');
}
}

View File

@@ -0,0 +1,38 @@
<?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()
{
Schema::create('episodes', function (Blueprint $table) {
$table->id();
$table->foreignId('podcast_id')->constrained('podcasts')->onDelete('cascade');
$table->boolean('published')->default(false);
$table->string('title');
$table->string('mp3');
$table->date('episode_date')->nullable();
$table->string('slug');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('episodes');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateOverlaysTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('overlays', function (Blueprint $table) {
$table->id();
$table->foreignId('artist_id')->constrained();
$table->foreignId('podcast_id')->constrained();
$table->boolean('available')->default(false);
$table->string('name');
$table->string('filename');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('overlays');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateArtworksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('artworks', function (Blueprint $table) {
$table->id();
$table->foreignId('podcast_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('artist_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('episode_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('overlay_id')->nullable()->constrained()->nullOnDelete();
$table->string('title');
$table->text('description')->nullable();
$table->string('filename')->unique();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('artworks');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddArtworkIdToEpisodes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('episodes', function (Blueprint $table) {
$table->foreignId('artwork_id')->after('podcast_id')->nullable()->constrained();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('episodes', function (Blueprint $table) {
$table->dropForeign(['artwork_id']);
$table->dropColumn('artwork_id');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWalletTypesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('wallet_types', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('abbreviation');
$table->boolean('available')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('wallet_types');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWalletsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('wallets', function (Blueprint $table) {
$table->id();
$table->foreignId('wallet_type_id')->constrained();
$table->string('address');
$table->string('qr_code')->nullable();
$table->string('display_name');
$table->foreignId('artist_id')->constrained()->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('wallets');
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// \App\Models\User::factory(10)->create();
// \App\Models\User::factory()->create([
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
}
}

View File

@@ -0,0 +1,149 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Podcast;
class PodcastSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$name = 'No Agenda';
$description = 'No Agenda, a show where former VJ Adam Curry and columnist John C. Dvorak,
two experts from the media industry, have a conversation about politics. Twice a week they
deconstruct the news cycle and give insights into the narrative of the mainstream media,
political campaigns and the government.';
$website = 'https://noagendashow.net';
$slug = 'no-agenda';
$feed = 'http://feed.nashownotes.com/rss.xml';
$added = '2007-10-26 15:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'Nick the Rat';
$description = 'A paranoid cartoon rat that plays music on a paranormal podcast. Also takes calls!
+19177195923';
$website = 'http://nicktherat.com';
$slug = 'nick-the-rat';
$feed = 'http://nicktherat.com/radio/rss.xml';
$added = '2017-01-31 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'Podcasting 2.0';
$description = 'The Podcast Index presents Podcasting 2.0 - Upgrading Podcasting';
$website = 'http://podcastindex.org';
$slug = 'podcasting-2-point-0';
$feed = 'https://feeds.podcastindex.org/pc20.xml';
$added = '2021-12-31 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'Curry and the Keeper';
$description = 'Tina and Adam Curry embarked on this podcast to talk about wine. Living in the heart of the
Hill Country, they set out to visit all the wineries and discuss their experiences. As life would have it,
the podcast evolved and now includes much more. Every show begins with opening a bottle of wine (it
usually has to “open up”) and then navigates to stories of their marriage, lives, faith and of course,
their dog, Phoebe. Join them on this journey as they laugh, live and love life.';
$website = 'https://www.curryandthekeeper.com';
$slug = 'curry-and-the-keeper';
$feed = 'http://feed.nashownotes.com/catkrss.xml';
$added = '2021-12-02 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'That Larry Show';
$description = 'Truth lives at That LARRY SHOW, a weekly sojourn at the crossroads of madness and enlightenment.
With LARRY in your life, you\'ll Take No Sh*t, and laugh your way to victory.';
$website = 'http://thatlarryshow.com/';
$slug = 'that-larry-show';
$feed = 'http://thatlarryshow.com/feed/podcast/';
$added = '2016-12-13 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'DH Unplugged';
$description = 'DH Unplugged is a weekly discussion of news in the financial markets featuring columnist
John C. Dvorak and money manager Andrew Horowitz.';
$website = 'https://www.dhunplugged.com/';
$slug = 'dh-unplugged';
$feed = 'http://feeds2.feedburner.com/dhunplugged';
$added = '2008-09-16 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'Bowl After Bowl';
$description = 'Bowl After Bowl is Sir Spencer and Dame DuhLaurien\'s weekly clothing-optional
potcast with a focus on drug law reform and community disorganizing.';
$website = 'https://bowlafterbowl.com/';
$slug = 'bowl-after-bowl';
$feed = 'https://feed.podbean.com/bowlafterbowl/feed.xml';
$added = '2014-12-20 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'Randumb Thoughts';
$description = 'Randumb Thoughts is an essay podcast by No Agenda producer Darren ONeill.
Life is a lot like taking candy from a gorilla';
$website = 'http://randumbthoughts.com/';
$slug = 'randumb-thoughts';
$feed = 'http://randumbthoughts.com/index.php/feed/podcast/';
$added = '2017-05-30 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'Planet Rage';
$description = 'Planet Rage is a podcast hosted by Larry Bleidner and Darren ONeill.';
$website = 'https://planetrage.show/';
$slug = 'planet-rage';
$feed = 'https://planetrage.show/feed/podcast/';
$added = '2021-08-30 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'OO Show';
$description = 'The "Double O" hosted by RynoTheBearded playing the greatest Creative Commons hits.';
$website = 'http://ryno.cc/';
$slug = 'oo-show';
$feed = 'http://rynothebearded.com/feed/podcast/';
$added = '2012-11-11 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
$name = 'Hog Story';
$description = 'Hog Story is simply a conversation between Carolyn Blaney and John Fletcher.
No topic is off limits.';
$website = 'http://hogstory.net';
$slug = 'hog-story';
$feed = 'https://hogstory.net/feed/podcast';
$added = '2019-02-22 20:00:00';
$this->createPodcast($name, $description, $website, $slug, $feed, $added);
}
private function createPodcast($name, $description, $website, $slug, $feed, $added) {
$podcast = Podcast::where('name', $name)->first();
if (!$podcast) {
$podcast = Podcast::factory()->state([
'name' => $name,
'description' => preg_replace('/[ \t]+/', ' ', preg_replace('/\s*$^\s*/m', "\n", $description)),
'slug' => $slug,
'website' => $website,
'feed' => $feed,
'published' => true,
'added_at' => $added,
])->create();
$this->command->info('Podcast: ' . $podcast->name
. ' added with the slug "'
. $podcast->slug
. '" and the id '
. $podcast->id . '.');
} else {
$this->command->comment('Podcast: '
. $podcast->name
. ' already exists with the slug "'
. $podcast->slug
. '" and the id '
. $podcast->id . '.');
}
}
}