cineflex/app/Models/Address.php

39 lines
811 B
PHP
Raw Normal View History

2022-11-23 09:32:34 +01:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Address extends Model
{
protected $table = 'addresses';
protected $primaryKey = 'address_id';
public $timestamps = false;
protected $fillable = [
'address_street',
'address_city',
'address_state',
'address_zip',
'address_country',
'user_id', // to whom does this address belong?
];
protected $hidden = [
'created_at',
'updated_at',
];
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
2023-01-01 20:13:11 +01:00
public function string()
{
return $this->address_street . ", " . $this->address_city . ", " . $this->address_state . " " . $this->address_zip . ", " . $this->address_country;
}
2022-11-23 09:32:34 +01:00
}