mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
hide event
This commit is contained in:
81
app/Console/Commands/update.php
Normal file
81
app/Console/Commands/update.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class update extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'update';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update C-CMS';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->info('Starting update ...');
|
||||
|
||||
$this->updateDatabase();
|
||||
|
||||
$this->info('Update completed !');
|
||||
|
||||
}
|
||||
|
||||
private function updateDatabase()
|
||||
{
|
||||
$this->info('Updating database ...');
|
||||
|
||||
// Check event table
|
||||
if (!Schema::hasColumn('events','hidden'))
|
||||
{
|
||||
$this->info('Updating events table ...');
|
||||
Schema::table('events', function ($table) {
|
||||
$table->boolean('hidden')->default(0);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info('Events table is up to date ...');
|
||||
}
|
||||
|
||||
// Check event_type table
|
||||
if (!Schema::hasColumn('event_types','hidden'))
|
||||
{
|
||||
$this->info('Updating event_types table ...');
|
||||
Schema::table('event_types', function ($table) {
|
||||
$table->boolean('hidden')->default(0);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info('Event_types table is up to date ...');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user