add frontend changes
This commit is contained in:
24
common/components/CustomerAwareBehavior.php
Normal file
24
common/components/CustomerAwareBehavior.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use yii\base\Behavior;
|
||||
use common\models\Customer;
|
||||
|
||||
class CustomerAwareBehavior extends Behavior{
|
||||
|
||||
|
||||
public function getCustomerName(){
|
||||
$result = "";
|
||||
$customer = $this->owner->customer;
|
||||
if (isset($customer)){
|
||||
$result = $customer->name;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function getCustomer(){
|
||||
return $this->owner->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] ) ;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user