81 lines
1.9 KiB
PHP
81 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Branch\Models;
|
|
|
|
use App\Models\User;
|
|
use App\Modules\Province\Models\Province;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Spatie\Translatable\HasTranslations;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $unique_code
|
|
* @property array<string, string> $name
|
|
* @property array<string, string>|null $address
|
|
* @property string $region
|
|
* @property int|null $province_id
|
|
* @property array<string, string>|null $phone_numbers
|
|
* @property string|null $billing_username
|
|
* @property string|null $billing_password
|
|
* @property string|null $billing_swift_username
|
|
* @property string|null $billing_swift_password
|
|
* @property string|null $billing_visa_master_username
|
|
* @property string|null $billing_visa_master_password
|
|
* @property string|null $billing_sber_username
|
|
* @property string|null $billing_sber_password
|
|
* @property bool $active
|
|
* @property \Illuminate\Support\Carbon $created_at
|
|
* @property \Illuminate\Support\Carbon $updated_at
|
|
*/
|
|
class Branch extends Model
|
|
{
|
|
use HasTranslations;
|
|
|
|
/**
|
|
* Table name
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'branches';
|
|
|
|
/**
|
|
* Translatable fields
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
public $translatable = [
|
|
'name',
|
|
'address',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array<string, string>
|
|
*/
|
|
protected $casts = [
|
|
'active' => 'boolean',
|
|
'phone_numbers' => 'array',
|
|
];
|
|
|
|
/**
|
|
* Province relationship
|
|
*
|
|
* @return BelongsTo<Province, $this>
|
|
*/
|
|
public function province(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Province::class);
|
|
}
|
|
|
|
/**
|
|
* Branches associated with user
|
|
*/
|
|
public function users(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(User::class);
|
|
}
|
|
}
|