File manager - Edit - /var/www/html/spdc/api/app/Models/Address.php
Back
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Factories\HasFactory; class Address extends Model { use HasFactory; use HasUuids; protected $fillable = [ 'postal_code', 'street', 'neighborhood', 'city', 'state', 'complement', 'reference_point', 'latitude', 'longitude', 'number' ]; /** * Determine if the user is an administrator. * * @return \Illuminate\Database\Eloquent\Casts\Attribute */ protected function fullAddress(): Attribute { return new Attribute( get: function() { $fullAddress = isset($this->street) ? $this->street : ''; $fullAddress .= isset($this->number) ? ' ,' . $this->number : ''; $fullAddress .= isset($this->neighborhood) ? ' ,' . $this->neighborhood : ''; $fullAddress .= isset($this->postal_code) ? ' - ' . $this->postal_code : ''; $fullAddress .= isset($this->city) ? ' - ' . $this->city . ' /' : ''; $fullAddress .= isset($this->state) ? ' ' . $this->state . '/' : ''; return $fullAddress; }, ); } /** * Get all of the occurrencies for the Address * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function occurrencies(): HasMany { return $this->hasMany(Occurrency::class); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings