CKeditor + word counter + Image Input + Taggable VUE3 Better Xss Sanitizer Handle Video Youtube + Image Upload + Inline Image from url Better Image Input component with reset, easizer resize Full Responsive BO
34 lines
770 B
PHP
34 lines
770 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\News;
|
|
use App\Models\Tag;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class NewsSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
DB::table('taggables')->truncate();
|
|
$this->call([
|
|
TagSeeder::class
|
|
]);
|
|
News::truncate();
|
|
$tags = Tag::query()->get();
|
|
News::factory(119)->create()
|
|
->each(function ($model) use ($tags) {
|
|
$offset = rand(0, 5);
|
|
$length = rand(1, 4);
|
|
$model->tags()
|
|
->saveMany($tags->slice($offset, $length));
|
|
$model->save();
|
|
});
|
|
}
|
|
}
|