Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use Webpatser\Uuid\Uuid;
- class Item extends Model
- {
- protected $hidden = [
- 'id','created_at','updated_at'
- ];
- public function currency(){
- return $this->belongsTo('App\Currency');
- }
- public function company(){
- return $this->hasOne('App\Company');
- }
- public static function boot()
- {
- parent::boot();
- self::creating(function($model){
- $model->guid = Uuid::generate();
- });
- }
- }
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use Webpatser\Uuid\Uuid;
- class Company extends Model
- {
- protected $fillable = [
- 'name', 'guid','is_active'
- ];
- protected $hidden = [
- 'id'
- ];
- public function company_type(){
- return $this->hasOne('App\CompanyType');
- }
- public function account(){
- return $this->hasOne('App\Account');
- }
- public function items()
- {
- return $this->hasMany('App\Item');
- }
- public function clients()
- {
- return $this->hasMany('App\Client');
- }
- public static function boot()
- {
- parent::boot();
- self::creating(function($model){
- $model->guid = Uuid::generate();
- });
- }
- }
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class Currency extends Model
- {
- public function items()
- {
- return $this->hasMany('App\Item');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement