v.2.27
Fixed reports
This commit is contained in:
@@ -4,17 +4,20 @@ namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Client extends Model {
|
||||
protected $table = 'clients';
|
||||
class Client extends Model
|
||||
{
|
||||
protected $table = 'clients';
|
||||
|
||||
/**
|
||||
* Get clients phone.
|
||||
*/
|
||||
public function clientPhone() {
|
||||
return $this->belongsTo('App\Component\Models\ClientsPhone', 'user_code', 'client_guid');
|
||||
}
|
||||
/**
|
||||
* Get clients phone.
|
||||
*/
|
||||
public function clientPhone()
|
||||
{
|
||||
return $this->belongsTo('App\Component\Models\ClientsPhone', 'user_code', 'client_guid');
|
||||
}
|
||||
|
||||
public static function getPhone($guid) {
|
||||
public static function getPhone($guid)
|
||||
{
|
||||
$phone = ClientsPhone::where('client_guid', $guid)->first();
|
||||
if (isset($phone)) {
|
||||
$phone = $phone['phone'];
|
||||
@@ -24,7 +27,8 @@ class Client extends Model {
|
||||
return $phone;
|
||||
}
|
||||
|
||||
public static function getEmail($guid) {
|
||||
public static function getEmail($guid)
|
||||
{
|
||||
$email = ClientsEmail::where('client_guid', $guid)->first();
|
||||
if (isset($email)) {
|
||||
$email = $email['email'];
|
||||
@@ -34,7 +38,8 @@ class Client extends Model {
|
||||
return $email;
|
||||
}
|
||||
|
||||
public static function getAddress($guid) {
|
||||
public static function getAddress($guid)
|
||||
{
|
||||
$address = ClientsAddress::where('client_guid', $guid)->first();
|
||||
if (isset($address)) {
|
||||
$address = $address['address'];
|
||||
@@ -44,17 +49,19 @@ class Client extends Model {
|
||||
return $address;
|
||||
}
|
||||
|
||||
public static function getBarcode($guid) {
|
||||
$barcode = ClientsBarcode::where('client_guid', $guid)->first();
|
||||
public static function getBarcode($guid)
|
||||
{
|
||||
$barcode = Client::where('user_code', $guid)->first();
|
||||
if (isset($barcode)) {
|
||||
$barcode = $barcode['value'];
|
||||
$barcode = $barcode['barcode_start'];
|
||||
} else {
|
||||
$barcode = '';
|
||||
}
|
||||
return $barcode;
|
||||
}
|
||||
|
||||
public static function getID($guid) {
|
||||
public static function getID($guid)
|
||||
{
|
||||
$id = Client::where('client_guid', $guid)->first();
|
||||
if (isset($id)) {
|
||||
$id = $id['id'];
|
||||
@@ -64,4 +71,16 @@ class Client extends Model {
|
||||
return $id;
|
||||
}
|
||||
|
||||
public static function getName($guid)
|
||||
{
|
||||
$client_name = Client::where('user_code', $guid)
|
||||
->first();
|
||||
if (isset($client_name)) {
|
||||
$client_name = $client_name['name'];
|
||||
} else {
|
||||
$client_name = 'Связанный персонал не найден';
|
||||
}
|
||||
return $client_name;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user