build version 400

This commit is contained in:
Mohit Panjwani
2020-12-02 17:54:08 +05:30
parent 326508e567
commit 89ee58590c
963 changed files with 62887 additions and 48868 deletions

39
app/Models/Address.php Normal file
View File

@ -0,0 +1,39 @@
<?php
namespace Crater\Models;
use Crater\Models\Company;
use Illuminate\Database\Eloquent\Model;
use Crater\Models\User;
use Crater\Models\Country;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Address extends Model
{
use HasFactory;
const BILLING_TYPE = 'billing';
const SHIPPING_TYPE = 'shipping';
protected $guarded = ['id'];
public function getCountryNameAttribute()
{
$name = $this->country ? $this->country->name : null;
return $name;
}
public function user()
{
return $this->belongsTo(User::class);
}
public function company()
{
return $this->belongsTo(Company::class);
}
public function country()
{
return $this->belongsTo(Country::class);
}
}