mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-31 05:16:49 -04:00
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\Import\Jobs;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Modules\Import\Imports\VideoImport;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
class ImportVideoJob implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(public Request $request)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
try {
|
|
DB::beginTransaction();
|
|
|
|
Excel::import(new VideoImport, $this->request->file('import'));
|
|
|
|
DB::commit();
|
|
} catch (\Exception $ex) {
|
|
DB::rollBack();
|
|
logger($ex->getMessage());
|
|
}
|
|
}
|
|
}
|