diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index c342d6986dd4..ed307aaf76b7 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -19,6 +19,49 @@ class AccountController extends \BaseController { $this->contactMailer = $contactMailer; } + public function install() + { + if (!Utils::isNinja() && !Schema::hasTable('accounts')) { + try { + Artisan::call('migrate'); + Artisan::call('db:seed'); + } catch (Exception $e) { + Response::make($e->getMessage(), 500); + } + } + + return Redirect::to('/'); + } + + public function update() + { + if (!Utils::isNinja()) { + try { + Artisan::call('migrate'); + } catch (Exception $e) { + Response::make($e->getMessage(), 500); + } + } + + return Redirect::to('/'); + } + + public function reset() + { + if (Utils::isNinjaDev()) { + Confide::logout(); + try { + Artisan::call('migrate:reset'); + Artisan::call('migrate'); + Artisan::call('db:seed'); + } catch (Exception $e) { + Response::make($e->getMessage(), 500); + } + } + + return Redirect::to('/'); + } + public function getStarted() { if (Auth::check()) diff --git a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php index 65326c575b82..7412ebe74560 100755 --- a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php +++ b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php @@ -331,11 +331,11 @@ class ConfideSetupUsersTable extends Migration { $t->decimal('amount', 13, 2); $t->decimal('balance', 13, 2); - $t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade'); + $t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade'); $t->foreign('account_id')->references('id')->on('accounts'); - $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');; + $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $t->foreign('invoice_status_id')->references('id')->on('invoice_statuses'); - $t->foreign('recurring_invoice_id')->references('id')->on('invoices'); + $t->foreign('recurring_invoice_id')->references('id')->on('invoices')->onDelete('cascade'); $t->unsignedInteger('public_id')->index(); $t->unique( array('account_id','public_id') ); diff --git a/app/models/Gateway.php b/app/models/Gateway.php index bb6afda0a3ef..7d84a7db32ec 100755 --- a/app/models/Gateway.php +++ b/app/models/Gateway.php @@ -21,7 +21,7 @@ class Gateway extends Eloquent if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) { - $fields = Omnipay::create($this->provider)->getDefaultParameters(); + $fields = Omnipay::create($this->provider)->getDefaultParameters(); } else { diff --git a/app/routes.php b/app/routes.php index d4569f43c8d2..bcd098c9058a 100755 --- a/app/routes.php +++ b/app/routes.php @@ -22,6 +22,9 @@ //dd(gethostname()); //Log::error('test'); +Route::get('install', 'AccountController@install'); +Route::get('update', 'AccountController@update'); +Route::get('reset', 'AccountController@reset'); Route::get('/', 'HomeController@showIndex'); Route::get('/rocksteady', 'HomeController@showIndex'); @@ -52,7 +55,6 @@ Route::post('signup/validate', 'AccountController@checkEmail'); Route::post('signup/submit', 'AccountController@submitSignup'); - // Confide routes Route::get('login', 'UserController@login'); Route::post('login', 'UserController@do_login'); diff --git a/app/views/accounts/product.blade.php b/app/views/accounts/product.blade.php index 6893beac28af..daa4dc01c7b6 100644 --- a/app/views/accounts/product.blade.php +++ b/app/views/accounts/product.blade.php @@ -3,7 +3,9 @@ @section('content') @parent - {{ Former::open($url)->method($method)->addClass('col-md-8 col-md-offset-2 warn-on-exit') }} + {{ Former::open($url)->method($method) + ->rules(['product_key' => 'required|max:20']) + ->addClass('col-md-8 col-md-offset-2 warn-on-exit') }} {{ Former::legend($title) }}