update formatCustomField value to accept nullable client

This commit is contained in:
Benjamin Beganović 2020-12-25 12:12:56 +01:00
parent 2f18ab1eeb
commit 710c08cdef

View File

@ -41,15 +41,15 @@ class Helpers
/**
* A centralised way to format the custom fields content.
*
* @param mixed $custom_fields
* @param mixed $field
* @param mixed $value
* @param null|\App\Models\Client $client
*
* @return null|string
*
* @param mixed $custom_fields
* @param mixed $field
* @param mixed $value
* @param \App\Models\Client|null $client
*
* @return null|string
*/
public function formatCustomFieldValue($custom_fields, $field, $value, ?Client $client): ?string
public function formatCustomFieldValue($custom_fields, $field, $value, Client $client = null): ?string
{
$custom_field = '';
@ -64,7 +64,7 @@ class Helpers
switch ($custom_field) {
case 'date':
return $this->formatDate($value, $client->date_format());
return is_null($client) ? $value : $this->formatDate($value, $client->date_format());
break;
case 'switch':