mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
refactor 310 update listener
This commit is contained in:
@ -10,25 +10,17 @@ use Crater\Events\UpdateFinished;
|
||||
use Crater\Setting;
|
||||
use Crater\Currency;
|
||||
use Schema;
|
||||
use Artisan;
|
||||
|
||||
class Version310 extends Listener
|
||||
{
|
||||
const VERSION = '3.1.0';
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param object $event
|
||||
* @param UpdateFinished $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(UpdateFinished $event)
|
||||
@ -52,12 +44,7 @@ class Version310 extends Listener
|
||||
]
|
||||
);
|
||||
|
||||
if (!Schema::hasColumn('expenses', 'user_id')) {
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->integer('user_id')->unsigned()->nullable();
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
|
||||
// Update Crater app version
|
||||
Setting::setSetting('version', static::VERSION);
|
||||
|
||||
@ -14,7 +14,7 @@ class Updater
|
||||
{
|
||||
use SiteApi;
|
||||
|
||||
public static function update($installed, $version)
|
||||
public static function update($version)
|
||||
{
|
||||
$data = null;
|
||||
$path = null;
|
||||
@ -26,7 +26,6 @@ class Updater
|
||||
$url = 'https://craterapp.com/downloads/file/'.$version.'?type=update';
|
||||
}
|
||||
|
||||
|
||||
$response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true]);
|
||||
|
||||
// Exception
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddUserIdToExpensesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->integer('user_id')->unsigned()->nullable();
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->dropColumn('paid');
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ Route::get('/expenses/{id}/receipt/{hash}', [
|
||||
'uses' => 'ExpensesController@downloadReceipt'
|
||||
]);
|
||||
|
||||
// Setup for instalation of app
|
||||
// Setup for installation of app
|
||||
// ----------------------------------------------
|
||||
Route::get('/on-boarding', function () {
|
||||
return view('app');
|
||||
|
||||
Reference in New Issue
Block a user