*
* @var string
*/
- protected $signature = 'pdf:ingest';
+ protected $signature = 'pdf:ingest {mode=auto}';
/**
* The console command description.
foreach ($files as $file) {
$path = \Storage::path($file);
- $fileName = basename($path, '.pdf');
- $ref = Str::after($fileName, 'PSQ ');
- $lastModified = \File::lastModified($path);
- $lastModified = Carbon::createFromFormat("U", $lastModified);
+
+
+ if($this->argument('mode') === 'fileName'){
+ $fileName = basename($path, '.pdf');
+ $ref = Str::after($fileName, 'PSQ ');
+ $date = \File::lastModified($path);
+ $date = Carbon::createFromFormat("U", $date);
+
+ } else {
+ $fileName = basename($path, '.pdf');
+ $ref = Str::after($fileName, 'PSQ ');
+ $date = \File::lastModified($path);
+ $date = Carbon::createFromFormat("U", $date);
+ }
+
$collection = FileCollection::findOrFail(1);
$title = "{$collection->short_name} - $ref";
'title' => $title,
'headlines' => [],
'published' => 1,
- 'created_at' => $lastModified
+ 'created_at' => $date
]);
$this->info("$pdfFile created. Processing file.");