芝麻web文件管理V1.00
编辑当前文件:/home/digitalh/panorama.panoramawholesale.com/app/Models/ProductCategory.php
belongsTo('App\Models\Product', 'product_id'); } /** * Foreign key with Category model * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function category() { return $this->belongsTo('App\Models\Category', 'category_id'); } /** * Store * * @param array $data * @return int|null */ public function store($data = []) { $lastProduct = parent::create($data); if (! empty($lastProduct)) { self::forgetCache(); return $lastProduct->id; } return false; } /** * Update Product Category * * @param array $data * @param null $id * @return bool */ public function updateProductCategory($data = [], $id = null) { $result = parent::where('product_id', $id); if ($result->exists()) { $result->update($data); self::forgetCache(); return true; } return false; } /** * remove product category * * @return bool */ public function remove($id = null) { $result = parent::where('product_id', $id); if ($result->exists()) { $result->delete(); self::forgetCache(); return true; } return false; } }