Files
freeu-project/app/Models/Company.php

35 lines
884 B
PHP
Raw Normal View History

2024-03-28 14:52:40 +05:30
<?php
namespace App\Models;
use App\Models\CompanyCategory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Company extends Model
{
use HasFactory;
protected $table = 'companies';
protected $hidden = ['created_at','updated_at','created_by','modified_by'];
protected $fillable = ['company_name','company_logo','company_status','created_by','modified_by'];
// const path = 'https://jerichoalternatives.in/public/uploads/manufactures_company/logo/';
public function scopeActive($query)
{
return $query->where('status', true);
}
public function getCompanyLogoAttribute($value)
{
return imagePath('public/uploads/manufactures_company/logo/').$value;
}
public function category(){
return $this->hasMany(CompanyCategory::class,'companies_id');
}
}