mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various small updates [skip ci]
This commit is contained in:
parent
2d0820873a
commit
5e809633e3
@ -67,7 +67,7 @@ class ChartController extends BaseController
|
||||
}
|
||||
// loop and get array data.
|
||||
|
||||
$url = count($accounts) == 1
|
||||
$url = count($accounts) == 1 && is_array($accounts)
|
||||
? '<a href="' . route('accounts.show', [$account->id]) . '">View more</a>'
|
||||
:
|
||||
'<a href="' . route('accounts.index') . '">View more</a>';
|
||||
|
@ -21,7 +21,9 @@ class CreateUsersTable extends Migration {
|
||||
$table->string('reset',32)->nullable();
|
||||
$table->string('remember_token',255)->nullable();
|
||||
$table->boolean('migrated');
|
||||
});
|
||||
|
||||
$table->unique('email');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,8 @@ class CreateAccountsTable extends Migration {
|
||||
$table->foreign('account_type_id')
|
||||
->references('id')->on('account_types')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id','account_type_id','name']);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,10 @@ class CreateComponentsTable extends Migration {
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id','class','name']);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ class CreatePiggybanksTable extends Migration
|
||||
$table->timestamps();
|
||||
$table->integer('account_id')->unsigned();
|
||||
$table->date('targetdate')->nullable();
|
||||
$table->string('name', 500);
|
||||
$table->string('name', 100);
|
||||
$table->decimal('amount', 10, 2);
|
||||
$table->decimal('target', 10, 2)->nullable();
|
||||
$table->integer('order')->unsigned();
|
||||
@ -28,6 +28,7 @@ class CreatePiggybanksTable extends Migration
|
||||
$table->foreign('account_id')
|
||||
->references('id')->on('accounts')
|
||||
->onDelete('cascade');
|
||||
$table->unique(['account_id','name']);
|
||||
|
||||
}
|
||||
);
|
||||
|
@ -12,10 +12,20 @@ class CreateRecurringTransactionsTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('recurringtransactions', function(Blueprint $table)
|
||||
Schema::create('recurring_transactions', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->string('name',50);
|
||||
$table->decimal('amount_max',10,2);
|
||||
$table->decimal('amount_min',10,2);
|
||||
$table->boolean('active');
|
||||
$table->enum('repeat_freq', ['daily', 'weekly','monthly','quarterly','half-year','yearly']);
|
||||
|
||||
$table->unique(['user_id','name']);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -26,7 +36,7 @@ class CreateRecurringTransactionsTable extends Migration {
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('recurringtransactions');
|
||||
Schema::drop('recurring_transactions');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RecurringTransactionsToComponents extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_recurring_transaction', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('recurring_transaction_id')->unsigned();
|
||||
|
||||
// link components with component_id
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
|
||||
// link transaction journals with transaction_journal_id
|
||||
$table->foreign('recurring_transaction_id')
|
||||
->references('id')->on('recurring_transactions')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_recurring_transaction');
|
||||
}
|
||||
|
||||
}
|
@ -18,7 +18,7 @@ class EmailHelper implements EmailHelperInterface
|
||||
|
||||
$reset = \Str::random(32);
|
||||
$user->reset = $reset;
|
||||
$user->save();
|
||||
$user->forceSave();
|
||||
$email = $user->email;
|
||||
$data = ['reset' => $reset];
|
||||
|
||||
@ -40,7 +40,7 @@ class EmailHelper implements EmailHelperInterface
|
||||
$password = \Str::random(12);
|
||||
$user->password = \Hash::make($password);
|
||||
$user->reset = \Str::random(32); // new one.
|
||||
$user->save();
|
||||
$user->forceSave();
|
||||
$email = $user->email;
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ class EmailHelper implements EmailHelperInterface
|
||||
{
|
||||
$reset = \Str::random(32);
|
||||
$user->reset = $reset;
|
||||
$user->save();
|
||||
$user->forceSave();
|
||||
$email = $user->email;
|
||||
|
||||
$data = ['reset' => $reset];
|
||||
|
@ -17,30 +17,6 @@ class EloquentUserRepository implements UserRepositoryInterface
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $array
|
||||
*
|
||||
* @return bool|\User
|
||||
*/
|
||||
public function register($array)
|
||||
{
|
||||
$user = new \User;
|
||||
$user->email = isset($array['email']) ? $array['email'] : null;
|
||||
$user->migrated = 0;
|
||||
$user->reset = \Str::random(32);
|
||||
$user->password = \Hash::make(\Str::random(12));
|
||||
|
||||
if (!$user->save()) {
|
||||
\Log::error('Invalid user');
|
||||
\Session::flash('error', 'Input invalid, please try again: ' . $user->errors()->first());
|
||||
|
||||
return false;
|
||||
}
|
||||
$user->save();
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $array
|
||||
*
|
||||
@ -57,6 +33,16 @@ class EloquentUserRepository implements UserRepositoryInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $email
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function findByEmail($email)
|
||||
{
|
||||
return \User::where('email', $email)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $reset
|
||||
*
|
||||
@ -68,13 +54,26 @@ class EloquentUserRepository implements UserRepositoryInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $email
|
||||
* @param $array
|
||||
*
|
||||
* @return mixed
|
||||
* @return bool|\User
|
||||
*/
|
||||
public function findByEmail($email)
|
||||
public function register($array)
|
||||
{
|
||||
return \User::where('email', $email)->first();
|
||||
$user = new \User;
|
||||
$user->email = isset($array['email']) ? $array['email'] : null;
|
||||
$user->migrated = 0;
|
||||
$user->reset = \Str::random(32);
|
||||
$user->password = \Hash::make(\Str::random(12));
|
||||
|
||||
if (!$user->save()) {
|
||||
\Log::error('Invalid user');
|
||||
\Session::flash('error', 'Input invalid, please try again: ' . $user->errors()->first());
|
||||
return false;
|
||||
}
|
||||
$user->save();
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,13 +88,7 @@ class EloquentUserRepository implements UserRepositoryInterface
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
$user->password = $password;
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
if($user->validate()) {
|
||||
$user->save();
|
||||
} else {
|
||||
var_dump($user->errors()->all());
|
||||
exit;
|
||||
}
|
||||
$user->save();
|
||||
$user->forceSave();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class User extends Ardent implements UserInterface, RemindableInterface
|
||||
|
||||
public static $rules
|
||||
= [
|
||||
'email' => 'required|email',
|
||||
'email' => 'required|email|unique:users,email',
|
||||
'migrated' => 'required|numeric|between:0,1',
|
||||
'password' => 'required|between:60,60',
|
||||
'reset' => 'between:32,32',
|
||||
@ -66,7 +66,7 @@ class User extends Ardent implements UserInterface, RemindableInterface
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = array('remember_token');
|
||||
protected $hidden = ['remember_token'];
|
||||
|
||||
public function accounts()
|
||||
{
|
||||
|
@ -22,7 +22,6 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="something">Bla bla</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<h2><a href="{{route('migrate')}}">Migrate from Firefly II</a></h2>
|
||||
@ -32,7 +31,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<h2><a href="#">Start from scratch</a></h2>
|
||||
<h2><a href="{{route('accounts.create')}}">Start from scratch</a></h2>
|
||||
|
||||
<p>
|
||||
Use this option if you are new to Firefly (III).
|
||||
|
Loading…
Reference in New Issue
Block a user