37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\ContentRecap;
|
|
use App\Models\Legacy\OldContentRecap;
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class ContentRecapSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
$legacyContentRecaps = OldContentRecap::all();
|
|
|
|
foreach($legacyContentRecaps as $legacyContentRecap){
|
|
ContentRecap::create([
|
|
'id' => $legacyContentRecap->id,
|
|
'title' => $legacyContentRecap->title,
|
|
'posted_date' => $legacyContentRecap->posting_date == '0000-00-00' ? now() : $legacyContentRecap->posting_date,
|
|
'channel' => $legacyContentRecap->channel,
|
|
'link' => $legacyContentRecap->link,
|
|
'image' => $legacyContentRecap->image,
|
|
'classification_id' => $legacyContentRecap->classification_id,
|
|
'created_at' => $legacyContentRecap->created_at,
|
|
'updated_at' => $legacyContentRecap->updated_at,
|
|
'deleted_at' => $legacyContentRecap->deleted_at,
|
|
'enhancer_id' => $legacyContentRecap->enhancer,
|
|
'social_media' => $legacyContentRecap->social_media,
|
|
]);
|
|
}
|
|
}
|
|
}
|