File "AddressBook.php"

Full Path: /home/clickysoft/public_html/jmapi5.clickysoft.net/app/Models/AddressBook.php
File size: 1.18 KB
MIME-type: text/x-php
Charset: utf-8

<?php

namespace App\Models;

use \DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class AddressBook extends Model
{
    use HasFactory;

    public $table = 'address_books';

    protected $dates = [
        'created_at',
        'updated_at',
        'deleted_at',
    ];

    protected $casts = [
        'created_at'  => 'date:m-d-Y',
        'updated_at'  => 'date:m-d-Y',
    ];

    protected $fillable = [
        'user_id',
        'company_name',
        'primary_contact_name',
        'primary_contact_email',
        'secondary_contact_name',
        'secondary_contact_email',
        'address_line_1',
        'address_line_2',
        'city',
        'state_id',
        'zipcode',
        'phone_number',
        'is_default',
        'created_at',
        'updated_at',
        'deleted_at',
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    public function state()
    {
        return $this->belongsTo(StateSalesTax::class, 'state_id');
    }
}