Drop columns and company logo change variable name.
This commit is contained in:
parent
3ffdb98a4b
commit
3c15d3e96f
@ -60,12 +60,12 @@ class Companies extends Controller
|
|||||||
setting()->set('general.company_address', $request->get('company_address'));
|
setting()->set('general.company_address', $request->get('company_address'));
|
||||||
|
|
||||||
if ($request->file('company_logo')) {
|
if ($request->file('company_logo')) {
|
||||||
$logo = $this->getMedia($request->file('company_logo'), 'settings', $company->id);
|
$company_logo = $this->getMedia($request->file('company_logo'), 'settings', $company->id);
|
||||||
|
|
||||||
if ($logo) {
|
if ($company_logo) {
|
||||||
$company->attachMedia($logo, 'logo');
|
$company->attachMedia($company_logo, 'company_logo');
|
||||||
|
|
||||||
setting()->set('general.company_logo', $logo->id);
|
setting()->set('general.company_logo', $company_logo->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,12 +141,12 @@ class Companies extends Controller
|
|||||||
setting()->set('general.company_address', $request->get('company_address'));
|
setting()->set('general.company_address', $request->get('company_address'));
|
||||||
|
|
||||||
if ($request->file('company_logo')) {
|
if ($request->file('company_logo')) {
|
||||||
$logo = $this->getMedia($request->file('company_logo'), 'settings', $company->id);
|
$company_logo = $this->getMedia($request->file('company_logo'), 'settings', $company->id);
|
||||||
|
|
||||||
if ($logo) {
|
if ($company_logo) {
|
||||||
$company->attachMedia($logo, 'logo');
|
$company->attachMedia($company_logo, 'company_logo');
|
||||||
|
|
||||||
setting()->set('general.company_logo', $logo->id);
|
setting()->set('general.company_logo', $company_logo->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
app/Listeners/Updates/Version116.php
Normal file
28
app/Listeners/Updates/Version116.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners\Updates;
|
||||||
|
|
||||||
|
use App\Events\UpdateFinished;
|
||||||
|
use App\Models\Setting\Currency;
|
||||||
|
|
||||||
|
class Version116 extends Listener
|
||||||
|
{
|
||||||
|
const ALIAS = 'core';
|
||||||
|
|
||||||
|
const VERSION = '1.1.6';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle(UpdateFinished $event)
|
||||||
|
{
|
||||||
|
// Check if should listen
|
||||||
|
if (!$this->check($event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -236,12 +236,12 @@ class Company extends Eloquent
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLogoAttribute()
|
public function getCompanyLogoAttribute()
|
||||||
{
|
{
|
||||||
if (!$this->hasMedia('logo')) {
|
if (!$this->hasMedia('company_logo')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getMedia('logo')->last();
|
return $this->getMedia('company_logo')->last();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
'App\Listeners\Updates\Version110',
|
'App\Listeners\Updates\Version110',
|
||||||
'App\Listeners\Updates\Version112',
|
'App\Listeners\Updates\Version112',
|
||||||
'App\Listeners\Updates\Version113',
|
'App\Listeners\Updates\Version113',
|
||||||
|
'App\Listeners\Updates\Version116',
|
||||||
],
|
],
|
||||||
'Illuminate\Auth\Events\Login' => [
|
'Illuminate\Auth\Events\Login' => [
|
||||||
'App\Listeners\Auth\Login',
|
'App\Listeners\Auth\Login',
|
||||||
|
@ -41,8 +41,7 @@ class CreateMediableTables extends Migration
|
|||||||
$table->index(['mediable_id', 'mediable_type']);
|
$table->index(['mediable_id', 'mediable_type']);
|
||||||
$table->index('tag');
|
$table->index('tag');
|
||||||
$table->index('order');
|
$table->index('order');
|
||||||
$table->foreign('media_id')->references('id')->on('media')
|
$table->foreign('media_id')->references('id')->on('media')->onDelete('cascade');
|
||||||
->onDelete('cascade');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropAttachmentColumnBillPaymentsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('bill_payments', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('attachment');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('bill_payments', function (Blueprint $table) {
|
||||||
|
$table->string('attachment')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropAttachmentColumnBillsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('bills', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('attachment');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('bills', function (Blueprint $table) {
|
||||||
|
$table->string('attachment')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropAttachmentColumnInvoicePaymentsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('invoice_payments', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('attachment');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('invoice_payments', function (Blueprint $table) {
|
||||||
|
$table->string('attachment')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropAttachmentColumnInvoicesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('invoices', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('attachment');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('invoices', function (Blueprint $table) {
|
||||||
|
$table->string('attachment')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropAttachmentColumnPaymentsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('payments', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('attachment');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('payments', function (Blueprint $table) {
|
||||||
|
$table->string('attachment')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropAttachmentColumnRevenuesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('revenues', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('attachment');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('revenues', function (Blueprint $table) {
|
||||||
|
$table->string('attachment')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropPictureColumnItemsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('items', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('picture');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('items', function (Blueprint $table) {
|
||||||
|
$table->string('picture')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropPictureColumnUsersTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('picture');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->string('picture')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -61,21 +61,21 @@
|
|||||||
$('#company_logo').fancyfile({
|
$('#company_logo').fancyfile({
|
||||||
text : '{{ trans('general.form.select.file') }}',
|
text : '{{ trans('general.form.select.file') }}',
|
||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
@if($company->logo)
|
@if($company->company_logo)
|
||||||
placeholder : '<?php echo $company->logo->basename; ?>'
|
placeholder : '<?php echo $company->company_logo->basename; ?>'
|
||||||
@else
|
@else
|
||||||
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
@if($company->logo)
|
@if($company->company_logo)
|
||||||
attachment_html = '<span class="attachment">';
|
attachment_html = '<span class="attachment">';
|
||||||
attachment_html += ' <a href="{{ url('uploads/' . $company->logo->id . '/download') }}">';
|
attachment_html += ' <a href="{{ url('uploads/' . $company->company_logo->id . '/download') }}">';
|
||||||
attachment_html += ' <span id="download-attachment" class="text-primary">';
|
attachment_html += ' <span id="download-attachment" class="text-primary">';
|
||||||
attachment_html += ' <i class="fa fa-file-{{ $company->logo->aggregate_type }}-o"></i> {{ $company->logo->basename }}';
|
attachment_html += ' <i class="fa fa-file-{{ $company->company_logo->aggregate_type }}-o"></i> {{ $company->company_logo->basename }}';
|
||||||
attachment_html += ' </span>';
|
attachment_html += ' </span>';
|
||||||
attachment_html += ' </a>';
|
attachment_html += ' </a>';
|
||||||
attachment_html += ' {!! Form::open(['id' => 'attachment-' . $company->logo->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $company->logo->id)], 'style' => 'display:inline']) !!}';
|
attachment_html += ' {!! Form::open(['id' => 'attachment-' . $company->company_logo->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $company->company_logo->id)], 'style' => 'display:inline']) !!}';
|
||||||
attachment_html += ' <a id="remove-attachment" href="javascript:void();">';
|
attachment_html += ' <a id="remove-attachment" href="javascript:void();">';
|
||||||
attachment_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
|
attachment_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
|
||||||
attachment_html += ' </a>';
|
attachment_html += ' </a>';
|
||||||
@ -85,7 +85,7 @@
|
|||||||
$('.fancy-file .fake-file').append(attachment_html);
|
$('.fancy-file .fake-file').append(attachment_html);
|
||||||
|
|
||||||
$(document).on('click', '#remove-attachment', function (e) {
|
$(document).on('click', '#remove-attachment', function (e) {
|
||||||
confirmDelete("#attachment-{!! $company->logo->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $company->logo->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
|
confirmDelete("#attachment-{!! $company->company_logo->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $company->company_logo->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
|
||||||
});
|
});
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user