osb/app/Models/Product.php
2018-05-20 22:53:14 +10:00

31 lines
520 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected $table = 'ab_product';
protected $with = ['descriptions'];
public function descriptions()
{
return $this->hasMany(ProductTranslate::class);
}
public function services()
{
return $this->hasMany(Service::class);
}
/**
* Get the language name
*
* @param Language $lo
*/
public function name(Language $lo)
{
return $this->descriptions->where('language_id',$lo->id)->first()->name;
}
}