close #191 Fixed : When trying to edit Companies. it is broken
This commit is contained in:
@ -92,7 +92,10 @@ class Version119 extends Listener
|
|||||||
$items = $data[basename($model)];
|
$items = $data[basename($model)];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if ($item->$name) {
|
if (!$item->$name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$path = explode('uploads/', $item->$name);
|
$path = explode('uploads/', $item->$name);
|
||||||
|
|
||||||
$path = end($path);
|
$path = end($path);
|
||||||
@ -102,20 +105,30 @@ class Version119 extends Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($path) && Storage::exists($path)) {
|
if (!empty($path) && Storage::exists($path)) {
|
||||||
|
$media = \App\Models\Common\Media::where('filename', '=', pathinfo(basename($path), PATHINFO_FILENAME))->first();
|
||||||
|
|
||||||
|
if ($media) {
|
||||||
|
$item->attachMedia($media, $name);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$media = MediaUploader::importPath(config('mediable.default_disk'), $path);
|
$media = MediaUploader::importPath(config('mediable.default_disk'), $path);
|
||||||
|
|
||||||
$item->attachMedia($media, $name);
|
$item->attachMedia($media, $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$settings['company_logo'] = \App\Models\Setting\Setting::where('key', '=', 'general.company_logo')->where('company_id', '<>', '0')->get();
|
$settings['company_logo'] = \App\Models\Setting\Setting::where('key', '=', 'general.company_logo')->where('company_id', '<>', '0')->get();
|
||||||
$settings['invoice_logo'] = \App\Models\Setting\Setting::where('key', '=', 'general.invoice_logo')->where('company_id', '<>', '0')->get();
|
$settings['invoice_logo'] = \App\Models\Setting\Setting::where('key', '=', 'general.invoice_logo')->where('company_id', '<>', '0')->get();
|
||||||
|
|
||||||
foreach ($settings as $name => $items) {
|
foreach ($settings as $name => $items) {
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if ($item->value) {
|
if (!$item->value) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$path = explode('uploads/', $item->value);
|
$path = explode('uploads/', $item->value);
|
||||||
|
|
||||||
$path = end($path);
|
$path = end($path);
|
||||||
@ -147,4 +160,3 @@ class Version119 extends Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -236,14 +236,8 @@ class Company extends Eloquent
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCompanyLogoAttribute($value)
|
public function getCompanyLogoAttribute()
|
||||||
{
|
{
|
||||||
if (!empty($value) && !$this->hasMedia('company_logo')) {
|
|
||||||
return $value;
|
|
||||||
} elseif (!$this->hasMedia('company_logo')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->getMedia('company_logo')->last();
|
return $this->getMedia('company_logo')->last();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
public/css/app.css
vendored
5
public/css/app.css
vendored
@ -538,3 +538,8 @@ ul.add-new.nav.navbar-nav.pull-left {
|
|||||||
margin-top: 25px;
|
margin-top: 25px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.picture, span.attachment {
|
||||||
|
margin-left: 10px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user