restore composer.json, add mysqli extension
This commit is contained in:
51
app/Jobs/Dashboard/Service/Update.php
Executable file
51
app/Jobs/Dashboard/Service/Update.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Dashboard\Service;
|
||||
|
||||
use App\Models\Service;
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Http\Requests\Dashboard\Service\Update as Request;
|
||||
|
||||
class Update
|
||||
{
|
||||
protected $service;
|
||||
protected $attr;
|
||||
|
||||
/**
|
||||
* Update constructor.
|
||||
* @param Service $service
|
||||
* @param array $attr
|
||||
*/
|
||||
public function __construct(Service $service, array $attr = [])
|
||||
{
|
||||
$this->attr = Arr::only($attr, ['name', 'image', 'type', 'status', 'position', 'is_power', 'with_problem']);
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Service $service
|
||||
* @param Request $request
|
||||
* @param $path
|
||||
* @return Update
|
||||
*/
|
||||
public static function fromRequest(Service $service, Request $request, $path)
|
||||
{
|
||||
return new static($service, [
|
||||
'name' => $request->getName(),
|
||||
'image' => $path,
|
||||
'status' => $request->status,
|
||||
'position' => $request->getPosition(),
|
||||
'is_power' => $request->is_power == null ? false : true,
|
||||
'with_problem' => $request->with_problem == null ? false : true,
|
||||
'type' => $request->generateSlug(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->service->update($this->attr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user