53 lines
2.4 KiB
PHP
53 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Genre;
|
|
use App\Models\Movie;
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class MovieSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$movies = [
|
|
[
|
|
'movie_name' => 'Alvin and the Chipmunks',
|
|
'movie_description' => 'A struggling songwriter named Dave Seville finds success when he comes across a trio of singing chipmunks: mischievous leader Alvin, brainy Simon, and chubby, impressionable Theodore.',
|
|
'movie_year' => '2007',
|
|
'movie_age_limit' => 6,
|
|
'movie_length' => 90,
|
|
'movie_image' => 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/vRiB9uvcD0WYp7k2pAeWz9ukpuN.jpg',
|
|
'genre_id' => (new \App\Models\Genre)->findGenreByName('Comedy')->genre_id,
|
|
],
|
|
[
|
|
'movie_name' => 'Alvin and the Chipmunks: The Squeakquel',
|
|
'movie_description' => 'Pop sensations Alvin, Simon and Theodore end up in the care of Dave Seville\'s twenty-something nephew Toby. The boys must put aside music super stardom to return to school, and are tasked with saving the school\'s music program by winning the $25,000 prize in a battle of the bands. But the Chipmunks unexpectedly meet their match in three singing chipmunks known as The Chipettes - Brittany, Eleanor and Jeanette. Romantic and musical sparks are ignited when the Chipmunks and Chipettes square off.',
|
|
'movie_year' => '2009',
|
|
'movie_age_limit' => 6,
|
|
'movie_length' => 92,
|
|
'movie_image' => 'https://www.themoviedb.org/t/p/w600_and_h900_bestv2/8mdPqOga5fty15nXmaNcK1fsNMa.jpg',
|
|
'genre_id' => (new \App\Models\Genre)->findGenreByName('Comedy')->genre_id,
|
|
],
|
|
];
|
|
|
|
foreach ($movies as $movie) {
|
|
$m = new Movie();
|
|
$m->movie_name = $movie['movie_name'];
|
|
$m->movie_description = $movie['movie_description'];
|
|
$m->movie_year = $movie['movie_year'];
|
|
$m->movie_age_limit = $movie['movie_age_limit'];
|
|
$m->movie_length = $movie['movie_length'];
|
|
$m->movie_image = $movie['movie_image'];
|
|
$m->genre_id = $movie['genre_id'];
|
|
$m->save();
|
|
}
|
|
|
|
}
|
|
}
|