for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace RuffleLabs\ProductCore\Models;
use Illuminate\Database\Eloquent\Model;
class ProductCategory extends Model
{
protected $table = 'product_categories';
protected $fillable = ['product_id', 'category_id', 'product_type'];
public function children()
return $this->whereParentId($this->id)->get();
}
public function parent()
return $this->whereId($this->parent_id)->first();