Viewing file: Contact.php (855 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','last_name','email','company','email_notification','address','zip_code','city','state','note','label_id','contact_dial_code','keyword_id'];
public function getFullNameAttribute(){
return trim($this->first_name.' '.$this->last_name);
}
public function getFullNumberAttribute(){
return $this->contact_dial_code.$this->number;
}
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));
}
}
|