restore composer.json, add mysqli extension
This commit is contained in:
76
app/Jobs/Dashboard/Product/Store.php
Executable file
76
app/Jobs/Dashboard/Product/Store.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Dashboard\Product;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
use App\Http\Requests\Dashboard\Product\Store as Request;
|
||||
|
||||
class Store
|
||||
{
|
||||
protected $attr;
|
||||
|
||||
/**
|
||||
* Store constructor.
|
||||
* @param array $attr
|
||||
*/
|
||||
public function __construct(array $attr = [])
|
||||
{
|
||||
$this->attr = Arr::only($attr, ['measurement_id', 'power', 'name', 'poster', 'poster_thumb', 'body', 'price', 'price_discount', 'price_credit', 'currency', 'slug', 'published', 'brand_id', 'short_body', 'article_number', 'leader_of_sales', 'popular', 'count', 'available', 'descriptions', 'keywords', 'title_seo', 'is_ready_solution', 'data_sheet']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return Store
|
||||
*/
|
||||
public static function fromRequest(Request $request)
|
||||
{
|
||||
return new static([
|
||||
'name' => $request->getName(),
|
||||
//'category_id' => $request->getCategoryID(),
|
||||
'brand_id' => $request->getBrandID(),
|
||||
'measurement_id' => $request->getMeasurementId(),
|
||||
|
||||
'currency' => $request->currency,
|
||||
|
||||
'price' => $request->getPrice(),
|
||||
'price_discount' => $request->getPriceDiscount(),
|
||||
// 'price_credit' => $request->getPriceCredit(),
|
||||
|
||||
'poster' => $request->getPoster(),
|
||||
'calc' => $request->getCalc(),
|
||||
'poster_thumb' => $request->getPosterThumb(),
|
||||
'is_ready_solution' => $request->is_ready_solution == false ? 0 : 1,
|
||||
'power' => $request->power,
|
||||
|
||||
'data_sheet' => $request->getDataSheet(),
|
||||
|
||||
'body' => $request->getBody(),
|
||||
'short_body' => $request->short_body,
|
||||
|
||||
'slug' => $request->getSlug(),
|
||||
'published' => $request->getPublished(),
|
||||
// 'popular' => $request->getPopular(),
|
||||
'leader_of_sales' => $request->getLeaderOfSales(),
|
||||
|
||||
'article_number' => $request->article_number,
|
||||
'count' => $request->count,
|
||||
'available' => $request->getAvailable(),
|
||||
'keywords' => $request->keywords,
|
||||
'descriptions' => $request->descriptions,
|
||||
'title_seo' => $request->title_seo,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$product = Product::create($this->attr);
|
||||
|
||||
return $product;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user