Initial support for importing supplier costs
This commit is contained in:
41
app/Console/Commands/ImportCosts.php
Normal file
41
app/Console/Commands/ImportCosts.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Jobs\ImportCosts as Job;
|
||||
use App\Models\{Site,Supplier};
|
||||
|
||||
class ImportCosts extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'costs:import {siteid : Site ID} {supplier : Supplier Name} {file : Filename} {date : Date}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Import Costs from file';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Job::dispatchSync(
|
||||
Site::findOrFail($this->argument('siteid')),
|
||||
Supplier::where('name',$this->argument('supplier'))->singleOrFail(),
|
||||
Carbon::create($this->argument('date')),
|
||||
$this->argument('file'),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user