item transformer doesn't accept null
This commit is contained in:
parent
f8ce9ffd32
commit
f1cd07dd70
@ -51,10 +51,14 @@ class Payment extends TransformerAbstract
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @return \League\Fractal\Resource\Item
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function includeVendor(Model $model)
|
public function includeVendor(Model $model)
|
||||||
{
|
{
|
||||||
|
if (!$model->vendor) {
|
||||||
|
return $this->null();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->item($model->vendor, new Vendor());
|
return $this->item($model->vendor, new Vendor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,10 +51,14 @@ class Revenue extends TransformerAbstract
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @return \League\Fractal\Resource\Item
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function includeCustomer(Model $model)
|
public function includeCustomer(Model $model)
|
||||||
{
|
{
|
||||||
|
if (!$model->customer) {
|
||||||
|
return $this->null();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->item($model->customer, new Customer());
|
return $this->item($model->customer, new Customer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,19 +40,27 @@ class Item extends TransformerAbstract
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @return \League\Fractal\Resource\Item
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function includeTax(Model $model)
|
public function includeTax(Model $model)
|
||||||
{
|
{
|
||||||
|
if (!$model->tax) {
|
||||||
|
return $this->null();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->item($model->tax, new Tax());
|
return $this->item($model->tax, new Tax());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @return \League\Fractal\Resource\Item
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function includeCategory(Model $model)
|
public function includeCategory(Model $model)
|
||||||
{
|
{
|
||||||
|
if (!$model->category) {
|
||||||
|
return $this->null();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->item($model->category, new Category());
|
return $this->item($model->category, new Category());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user