Files
admin-php-module/models/Client.php
miroman-afk d24bba305f v.2.24
1. POSTBonus in/out
2. POSTPresale in/out
3. Переработана форма гостя
2022-12-14 12:42:39 +03:00

67 lines
1.6 KiB
PHP

<?php
namespace App\Component\Models;
use Illuminate\Database\Eloquent\Model;
class Client extends Model {
protected $table = 'clients';
/**
* Get clients phone.
*/
public function clientPhone() {
return $this->belongsTo('App\Component\Models\ClientsPhone', 'user_code', 'client_guid');
}
public static function getPhone($guid) {
$phone = ClientsPhone::where('client_guid', $guid)->first();
if (isset($phone)) {
$phone = $phone['phone'];
} else {
$phone = '';
}
return $phone;
}
public static function getEmail($guid) {
$email = ClientsEmail::where('client_guid', $guid)->first();
if (isset($email)) {
$email = $email['email'];
} else {
$email = '';
}
return $email;
}
public static function getAddress($guid) {
$address = ClientsAddress::where('client_guid', $guid)->first();
if (isset($address)) {
$address = $address['address'];
} else {
$address = '';
}
return $address;
}
public static function getBarcode($guid) {
$barcode = ClientsBarcode::where('client_guid', $guid)->first();
if (isset($barcode)) {
$barcode = $barcode['value'];
} else {
$barcode = '';
}
return $barcode;
}
public static function getID($guid) {
$id = Client::where('client_guid', $guid)->first();
if (isset($id)) {
$id = $id['id'];
} else {
$id = '';
}
return $id;
}
}