added pointer interfaces for jobs
This commit is contained in:
@ -3,31 +3,13 @@
|
||||
namespace App\Jobs\Setting;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Interfaces\Job\HasOwner;
|
||||
use App\Interfaces\Job\ShouldCreate;
|
||||
use App\Models\Setting\Currency;
|
||||
|
||||
class CreateCurrency extends Job
|
||||
class CreateCurrency extends Job implements HasOwner, ShouldCreate
|
||||
{
|
||||
protected $currency;
|
||||
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param $request
|
||||
*/
|
||||
public function __construct($request)
|
||||
{
|
||||
$this->request = $this->getRequestInstance($request);
|
||||
$this->request->merge(['created_by' => user_id()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return Currency
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): Currency
|
||||
{
|
||||
// Force the rate to be 1 for default currency
|
||||
if ($this->request->get('default_currency')) {
|
||||
@ -35,7 +17,7 @@ class CreateCurrency extends Job
|
||||
}
|
||||
|
||||
\DB::transaction(function () {
|
||||
$this->currency = Currency::create($this->request->all());
|
||||
$this->model = Currency::create($this->request->all());
|
||||
|
||||
// Update default currency setting
|
||||
if ($this->request->get('default_currency')) {
|
||||
@ -44,6 +26,6 @@ class CreateCurrency extends Job
|
||||
}
|
||||
});
|
||||
|
||||
return $this->currency;
|
||||
return $this->model;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user