restore composer.json, add mysqli extension
This commit is contained in:
47
app/Jobs/Dashboard/UsefulInfoItemJob/Store.php
Executable file
47
app/Jobs/Dashboard/UsefulInfoItemJob/Store.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Dashboard\UsefulInfoItemJob;
|
||||
|
||||
use App\Models\UsefulInfoItem;
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Http\Requests\Dashboard\UsefulInfoItemRequest\Store as Request;
|
||||
|
||||
class Store
|
||||
{
|
||||
protected $attr;
|
||||
|
||||
/**
|
||||
* Store constructor.
|
||||
* @param array $attr
|
||||
*/
|
||||
public function __construct(array $attr = [])
|
||||
{
|
||||
$this->attr = Arr::only($attr, ['name', 'description', 'file_url', 'video_url', 'link_url', 'useful_info_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param $file_path
|
||||
* @param $useful_info_id
|
||||
* @return Store
|
||||
*/
|
||||
public static function fromRequest(Request $request, $file_path, $useful_info_id)
|
||||
{
|
||||
return new static([
|
||||
'name' => $request->getName(),
|
||||
'description' => $request->getDescription(),
|
||||
'video_url' => $request->video_url,
|
||||
'link_url' => $request->link_url,
|
||||
'file_url' => $file_path,
|
||||
'useful_info_id' => $useful_info_id
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
UsefulInfoItem::create($this->attr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user