|
@@ -66,37 +66,37 @@ class TestCommand extends Command
|
|
|
foreach ($files as $file) {
|
|
|
|
|
|
$file_name = $file['filename'];
|
|
|
- dd($file);
|
|
|
+
|
|
|
$arr = str2arr($file_name, '-');
|
|
|
|
|
|
$time = Carbon::parse(str_replace('.', '-', $arr[0]))->toDateTimeString();
|
|
|
- dd($time);
|
|
|
+
|
|
|
$video_name = $arr[1];
|
|
|
$teacher = str2arr($arr[2], '.')[0];
|
|
|
|
|
|
$path = "zhongjingdaketang/{$file['basename']}";
|
|
|
|
|
|
-// $resource = Resource::query()->updateOrCreate([
|
|
|
-// 'name' => $file,
|
|
|
-// 'path' => $path,
|
|
|
-// 'disk' => 'public',
|
|
|
-// 'original_name' => $file,
|
|
|
-// ], [
|
|
|
-// 'url' => Storage::disk('public')->url($path)
|
|
|
-// ]);
|
|
|
+ $resource = Resource::query()->updateOrCreate([
|
|
|
+ 'name' => $file,
|
|
|
+ 'path' => $path,
|
|
|
+ 'disk' => 'public',
|
|
|
+ 'original_name' => $file,
|
|
|
+ ], [
|
|
|
+ 'url' => Storage::disk('public')->url($path)
|
|
|
+ ]);
|
|
|
|
|
|
|
|
|
-// Video::query()->updateOrCreate([
|
|
|
-// 'course_id' => $course->id,
|
|
|
-// 'title' => $video_name,
|
|
|
-// 'url' => $resource->id,
|
|
|
-// 'short_description' => $video_name,
|
|
|
-// 'description' => $video_name,
|
|
|
-// 'published_at' => $time,
|
|
|
-// ], [
|
|
|
-// 'slug' => Str::random(),
|
|
|
-// 'status' => ModelStatusEnum::OK
|
|
|
-// ]);
|
|
|
+ Video::query()->updateOrCreate([
|
|
|
+ 'course_id' => $course->id,
|
|
|
+ 'title' => $video_name,
|
|
|
+ 'url' => $resource->id,
|
|
|
+ 'short_description' => $video_name,
|
|
|
+ 'description' => $video_name,
|
|
|
+ 'published_at' => $time,
|
|
|
+ ], [
|
|
|
+ 'slug' => Str::random(),
|
|
|
+ 'status' => ModelStatusEnum::OK
|
|
|
+ ]);
|
|
|
}
|
|
|
}
|
|
|
|