Initial refactoring work

This commit is contained in:
Deon George
2018-05-20 22:53:14 +10:00
parent d6cb505e1c
commit feda44db8a
121 changed files with 6601 additions and 602 deletions

31
app/Models/Product.php Normal file
View File

@@ -0,0 +1,31 @@
<?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;
}
}