/** * Run the database seeds. * * @return void */ public function run() { $destinationFile = File::first(); $file = new VideoFile(array("width" => 1920, "height" => 1080)); $file->qualityDefinition()->associate(QualityDefinition::find(1)); $file->file()->associate($destinationFile); $file->save(); $file = new VideoFile(array("width" => 1280, "height" => 720)); $file->qualityDefinition()->associate(QualityDefinition::find(2)); $file->file()->associate($destinationFile); $file->save(); $file = new VideoFile(array("width" => 640, "height" => 480)); $file->qualityDefinition()->associate(QualityDefinition::find(3)); $file->file()->associate($destinationFile); $file->save(); $file = new VideoFile(array("width" => 640, "height" => 360)); $file->qualityDefinition()->associate(QualityDefinition::find(4)); $file->file()->associate($destinationFile); $file->save(); $file = new VideoFile(array("width" => 426, "height" => 240)); $file->qualityDefinition()->associate(QualityDefinition::find(5)); $file->file()->associate($destinationFile); $file->save(); $this->command->info('Video files records created!'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); LiveStream::truncate(); MediaItem::truncate(); MediaItemComment::truncate(); MediaItemLike::truncate(); MediaItemLiveStream::truncate(); MediaItemVideo::truncate(); Permission::truncate(); PermissionGroup::truncate(); QualityDefinition::truncate(); LiveStreamUri::truncate(); Playlist::truncate(); Show::truncate(); SiteUser::truncate(); User::truncate(); VideoFile::truncate(); DB::table("media_item_to_playlist")->truncate(); DB::table("permission_to_group")->truncate(); DB::table("user_to_group")->truncate(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); $this->command->info('Tables truncated!'); }