1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 11:22:42 +01:00
freescout/app/Email.php

44 lines
788 B
PHP
Raw Normal View History

2018-07-10 12:15:58 +02:00
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Email extends Model
{
/**
* Email types
*/
const TYPE_WORK = 'work';
const TYPE_HOME = 'home';
const TYPE_OTHER = 'other';
public $timestamps = false;
/**
* Attributes which are not fillable using fill() method
*/
protected $guarded = ['id', 'customer_id'];
/**
2018-07-14 03:23:37 +02:00
* Get email's customer
2018-07-10 12:15:58 +02:00
*/
public function customer()
{
return $this->belongsTo('App\Customer');
}
/**
* Sanatize email address
* @param string $email
* @return string
*/
public static function sanatizeEmail($email)
{
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
$email = strtolower($email);
return $email;
}
}