Viewing file: Contact.php (861 B) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Contact extends Model { protected $fillable=['number','first_name','customer_id','last_name','email','company','email_notification','address','zip_code','city','state','note','label_id','contact_dial_code','unique_random_number'];
public function getFullNameAttribute(){
return trim($this->first_name.' '.$this->last_name); } public function label(){ return $this->belongsTo(Label::class, 'label_id', 'id')->withDefault(); }
public function scopeWhere_number($query,$number){ return $query->where('number', $number)->orWhere('number', str_replace('+', '', $number))->orWhere('number', "+".str_replace('+', '', $number)); }
public function getFullNumberAttribute(){ return trim($this->contact_dial_code.$this->number); } }
|