Fixes for company logo output

This commit is contained in:
David Bomba 2019-10-03 15:17:57 +10:00
parent 23265fb9e3
commit 9afcc28549
4 changed files with 11 additions and 2 deletions

View File

@ -33,6 +33,8 @@ class UpdateCompanyRequest extends Request
public function rules() public function rules()
{ {
\Log::error($this->all());
return [ return [
'logo' => 'mimes:jpeg,jpg,png,gif|max:10000', // max 10000kb 'logo' => 'mimes:jpeg,jpg,png,gif|max:10000', // max 10000kb
'industry_id' => 'integer|nullable', 'industry_id' => 'integer|nullable',

View File

@ -186,6 +186,11 @@ class Company extends BaseModel
return isset($this->settings->language_id) && $this->language() ? $this->language()->locale : config('ninja.i18n.locale'); return isset($this->settings->language_id) && $this->language() ? $this->language()->locale : config('ninja.i18n.locale');
} }
public function getLogo()
{
return $this->logo ? config('ninja.site_url').$this->logo : '';
}
/** /**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */

View File

@ -66,7 +66,7 @@ class CompanyTransformer extends EntityTransformer
return [ return [
'id' => $this->encodePrimaryKey($company->id), 'id' => $this->encodePrimaryKey($company->id),
'name' => $company->name ?: '', 'name' => $company->name ?: '',
'logo' => $company->logo ?: '', 'logo' => $company->getLogo(),
'company_key' => $company->company_key ?: '', 'company_key' => $company->company_key ?: '',
'address1' => $company->address1 ?: '', 'address1' => $company->address1 ?: '',
'address2' => $company->address2 ?: '', 'address2' => $company->address2 ?: '',

View File

@ -84,7 +84,9 @@ class UploadLogoTest extends TestCase
$response->assertStatus(302); $response->assertStatus(302);
//Log::error(print_r($response->json(),1)); //$acc = $response->json();
//\Log::error(print_r($acc,1));
} }