w0bm.com v1.5z FULL.RETARD.BUILD.BUT.STILL.WORKS
This commit is contained in:
39
database/seeds/VideoTableSeeder.php
Normal file
39
database/seeds/VideoTableSeeder.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class VideoTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$videos = glob(public_path() . '/b/*');
|
||||
usort($videos, function($a, $b) {
|
||||
$a = (int) basename($a, '.webm');
|
||||
$b = (int) basename($b, '.webm');
|
||||
if ($a == $b) {
|
||||
return 0;
|
||||
}
|
||||
return ($a < $b) ? -1 : 1;
|
||||
});
|
||||
|
||||
$category = \App\Models\Category::where('shortname', '=', 'misc')->first();
|
||||
$user = \App\Models\User::find(1);
|
||||
|
||||
foreach($videos as $video) {
|
||||
if(\App\Models\Video::whereFile(basename($video))->count() > 0)
|
||||
continue;
|
||||
|
||||
$v = new \App\Models\Video();
|
||||
$v->user()->associate($user);
|
||||
$v->category()->associate($category);
|
||||
$v->hash = sha1_file($video);
|
||||
$v->file = basename($video);
|
||||
$v->save();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user