sarga/packages/Webkul/Channel/src/Models/Channel.php

44 lines
891 B
PHP
Raw Normal View History

2018-07-24 11:11:32 +00:00
<?php
namespace Webkul\Channel\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Core\Models\Locale;
use Webkul\Core\Models\Currency;
class Channel extends Model
{
protected $fillable = ['code', 'name', 'description', 'default_locale', 'base_currency'];
/**
* Get the channel locales.
*/
2018-07-27 06:22:12 +00:00
public function locales()
2018-07-24 11:11:32 +00:00
{
2018-07-27 06:22:12 +00:00
return $this->belongsToMany(Locale::class, 'channel_locales');
2018-07-24 11:11:32 +00:00
}
/**
* Get the default locale
*/
public function default_locale()
{
return $this->belongsTo(Locale::class);
}
/**
* Get the channel locales.
*/
public function currencies()
{
return $this->belongsToMany(Currency::class, 'channel_currencies');
}
/**
* Get the base currency
*/
public function base_currency()
{
return $this->belongsTo(Currency::class);
}
}