modified enabled column
This commit is contained in:
parent
375718b5d0
commit
0c579d02b0
30
app/Listeners/Updates/Version1210.php
Normal file
30
app/Listeners/Updates/Version1210.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners\Updates;
|
||||||
|
|
||||||
|
use App\Events\UpdateFinished;
|
||||||
|
use Artisan;
|
||||||
|
|
||||||
|
class Version1210 extends Listener
|
||||||
|
{
|
||||||
|
const ALIAS = 'core';
|
||||||
|
|
||||||
|
const VERSION = '1.2.10';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle(UpdateFinished $event)
|
||||||
|
{
|
||||||
|
// Check if should listen
|
||||||
|
if (!$this->check($event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update database
|
||||||
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
|
}
|
||||||
|
}
|
@ -95,7 +95,7 @@ class Model extends Eloquent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scope to only include active currencies.
|
* Scope to only include active models.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
@ -104,4 +104,15 @@ class Model extends Eloquent
|
|||||||
{
|
{
|
||||||
return $query->where('enabled', 1);
|
return $query->where('enabled', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope to only include passive models.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeDisabled($query)
|
||||||
|
{
|
||||||
|
return $query->where('enabled', 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
class ModifyEnabledColumn extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('accounts', function (Blueprint $table) {
|
||||||
|
$table->tinyInteger('enabled')->default(1)->change();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('categories', function (Blueprint $table) {
|
||||||
|
$table->tinyInteger('enabled')->default(1)->change();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('currencies', function (Blueprint $table) {
|
||||||
|
$table->tinyInteger('enabled')->default(1)->change();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('items', function (Blueprint $table) {
|
||||||
|
$table->tinyInteger('enabled')->default(1)->change();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('customers', function (Blueprint $table) {
|
||||||
|
$table->tinyInteger('enabled')->default(1)->change();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('vendors', function (Blueprint $table) {
|
||||||
|
$table->tinyInteger('enabled')->default(1)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user