Viewing file: Product.php (1.74 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Models;
use Illuminate\Auth\Authenticatable; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Laravel\Lumen\Auth\Authorizable;
class Product extends Model implements AuthenticatableContract, AuthorizableContract { use Authenticatable, Authorizable, HasFactory;
/** * The attributes that are mass assignable. * * @var string[] */ protected $fillable =['title','description','page_id','image','product_code','folder','vendor_id',"visibility" ,'categories_1','categories_2','categories_3','sub_categories_1','sub_categories_2','sub_categories_3'];
// public function product_variants() // { // return $this->hasOne('App\Models\ProductVariants', 'for_id', 'id'); // } public function product_category_1() { return $this->hasOne('App\Models\Categories', 'id', 'categories_1'); } public function product_category_2() { return $this->hasOne('App\Models\Categories', 'id', 'categories_2'); } public function product_category_3() { return $this->hasOne('App\Models\Categories', 'id', 'categories_3'); } public function product_sub_category_1() { return $this->hasOne('App\Models\Categories', 'id', 'sub_categories_1'); } public function product_sub_category_2() { return $this->hasOne('App\Models\Categories', 'id', 'sub_categories_2'); } public function product_sub_category_3() { return $this->hasOne('App\Models\Categories', 'id', 'sub_categories_3'); } // public $timestamps = false; }
|