added source feature
This commit is contained in:
@ -4,18 +4,20 @@ namespace App\Abstracts;
|
||||
|
||||
use App\Abstracts\Http\FormRequest;
|
||||
use App\Interfaces\Job\HasOwner;
|
||||
use App\Interfaces\Job\HasSource;
|
||||
use App\Interfaces\Job\ShouldCreate;
|
||||
use App\Interfaces\Job\ShouldDelete;
|
||||
use App\Interfaces\Job\ShouldUpdate;
|
||||
use App\Traits\Jobs;
|
||||
use App\Traits\Relationships;
|
||||
use App\Traits\Sources;
|
||||
use App\Traits\Uploads;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
abstract class Job
|
||||
{
|
||||
use Jobs, Relationships, Uploads;
|
||||
use Jobs, Relationships, Sources, Uploads;
|
||||
|
||||
protected $model;
|
||||
|
||||
@ -49,6 +51,10 @@ abstract class Job
|
||||
if ($this instanceof HasOwner) {
|
||||
$this->setOwner();
|
||||
}
|
||||
|
||||
if ($this instanceof HasSource) {
|
||||
$this->setSource();
|
||||
}
|
||||
}
|
||||
|
||||
public function bootUpdate(...$arguments): void
|
||||
@ -106,4 +112,17 @@ abstract class Job
|
||||
|
||||
$this->request->merge(['created_by' => user_id()]);
|
||||
}
|
||||
|
||||
public function setSource(): void
|
||||
{
|
||||
if (! $this->request instanceof Request) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->request->has('created_from')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->request->merge(['created_from' => $this->getSourceName($this->request)]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user