feat: add descriptions for product table
This commit is contained in:
@@ -31,6 +31,8 @@ public function store(Request $request, $packageName)
|
||||
'title' => 'string|required',
|
||||
'price' => 'integer|required',
|
||||
'type' => ['integer', Rule::in(Product::TYPES)],
|
||||
'descriptions' => 'array|nullable',
|
||||
'descriptions.*' => 'string|max:1000',
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::with('products')->where('name', $packageName)->first()) {
|
||||
@@ -49,6 +51,8 @@ public function update(Request $request, $packageName, $productId)
|
||||
'title' => 'string|required',
|
||||
'price' => 'integer|required',
|
||||
'type' => ['integer', Rule::in(Product::TYPES)],
|
||||
'descriptions' => 'array|nullable',
|
||||
'descriptions.*' => 'string|max:1000'
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::with('products')->where('name', $packageName)->first()) {
|
||||
|
||||
@@ -24,6 +24,10 @@ public function users()
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'user_product')->withPivot(['expire_at', 'purchase_token', 'gateway'])->withTimestamps();
|
||||
}
|
||||
protected $casts = [
|
||||
'descriptions' => 'array',
|
||||
];
|
||||
|
||||
|
||||
public function packageName()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user