mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-17 20:08:52 +00:00
Replaced Ardent with another package.
This commit is contained in:
@@ -9,7 +9,6 @@ use FireflyIII\Database\Ifaces\CUD;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
/**
|
||||
* Class Account
|
||||
@@ -224,17 +223,58 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
|
||||
// delete journals:
|
||||
$journals = \TransactionJournal::whereIn(
|
||||
'id', function ($query) use ($model) {
|
||||
$query->select('transaction_journal_id')
|
||||
->from('transactions')->whereIn(
|
||||
'account_id', function ($query) use ($model) {
|
||||
$query
|
||||
->select('id')
|
||||
->from('accounts')
|
||||
->where(
|
||||
function ($q) use ($model) {
|
||||
$q->where('id', $model->id);
|
||||
$q->orWhere(
|
||||
function ($q) use ($model) {
|
||||
$q->where('accounts.name', 'LIKE', '%' . $model->name . '%');
|
||||
// TODO magic number!
|
||||
$q->where('accounts.account_type_id', 3);
|
||||
$q->where('accounts.active', 0);
|
||||
}
|
||||
);
|
||||
}
|
||||
)->where('accounts.user_id', $this->getUser()->id);
|
||||
}
|
||||
)->get();
|
||||
}
|
||||
)->delete();
|
||||
|
||||
/*
|
||||
* Trigger deletion:
|
||||
*/
|
||||
\Event::fire('account.destroy', [$model]);
|
||||
$model->delete();
|
||||
|
||||
// delete accounts:
|
||||
\Account::where(
|
||||
function ($q) use ($model) {
|
||||
$q->where('id', $model->id);
|
||||
$q->orWhere(
|
||||
function ($q) use ($model) {
|
||||
$q->where('accounts.name', 'LIKE', '%' . $model->name . '%');
|
||||
// TODO magic number!
|
||||
$q->where('accounts.account_type_id', 3);
|
||||
$q->where('accounts.active', 0);
|
||||
}
|
||||
);
|
||||
})->delete();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -243,7 +283,7 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -263,8 +303,8 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
|
||||
$data = array_except($data, ['_token', 'what']);
|
||||
$account = new \Account($data);
|
||||
if (!$account->validate()) {
|
||||
var_dump($account->errors()->all());
|
||||
if (!$account->isValid()) {
|
||||
var_dump($account->getErrors()->all());
|
||||
exit;
|
||||
}
|
||||
$account->save();
|
||||
@@ -290,12 +330,12 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
$model->name = $data['name'];
|
||||
$model->active = isset($data['active']) ? intval($data['active']) : 0;
|
||||
@@ -415,7 +455,7 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
namespace FireflyIII\Database;
|
||||
|
||||
use Firefly\Exception\FireflyException;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use FireflyIII\Database\Ifaces\AccountTypeInterface;
|
||||
use FireflyIII\Database\Ifaces\CommonDatabaseCalls;
|
||||
use FireflyIII\Database\Ifaces\CUD;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
/**
|
||||
* Class AccountType
|
||||
@@ -19,11 +18,11 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
// TODO: Implement destroy() method.
|
||||
throw new NotImplementedException;
|
||||
@@ -32,7 +31,7 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -41,12 +40,12 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
throw new NotImplementedException;
|
||||
@@ -71,7 +70,7 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@ use FireflyIII\Database\Ifaces\CUD;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
/**
|
||||
* Class Budget
|
||||
@@ -28,11 +27,11 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
$model->delete();
|
||||
|
||||
@@ -42,7 +41,7 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -51,8 +50,8 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
$budget = new \Budget($data);
|
||||
$budget->class = 'Budget';
|
||||
|
||||
if (!$budget->validate()) {
|
||||
var_dump($budget->errors()->all());
|
||||
if (!$budget->isValid()) {
|
||||
var_dump($budget->getErrors()->all());
|
||||
exit;
|
||||
}
|
||||
$budget->save();
|
||||
@@ -61,16 +60,16 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
$model->name = $data['name'];
|
||||
if (!$model->validate()) {
|
||||
var_dump($model->errors()->all());
|
||||
if (!$model->isValid()) {
|
||||
var_dump($model->getErrors()->all());
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -124,7 +123,7 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ use FireflyIII\Database\Ifaces\CUD;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Class Category
|
||||
@@ -28,11 +28,11 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
$model->delete();
|
||||
|
||||
@@ -42,7 +42,7 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -50,8 +50,8 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
$category->name = $data['name'];
|
||||
$category->class = 'Category';
|
||||
$category->user()->associate($this->getUser());
|
||||
if (!$category->validate()) {
|
||||
var_dump($category->errors());
|
||||
if (!$category->isValid()) {
|
||||
var_dump($category->getErrors());
|
||||
exit();
|
||||
}
|
||||
$category->save();
|
||||
@@ -60,16 +60,16 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
$model->name = $data['name'];
|
||||
if (!$model->validate()) {
|
||||
var_dump($model->errors()->all());
|
||||
if (!$model->isValid()) {
|
||||
var_dump($model->getErrors()->all());
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
$validator = \Validator::make($model, \Component::$rules);
|
||||
|
||||
if ($validator->invalid()) {
|
||||
$errors->merge($validator->errors());
|
||||
$errors->merge($validator->getErrors());
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace FireflyIII\Database\Ifaces;
|
||||
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Interface CUD
|
||||
@@ -13,26 +13,26 @@ interface CUD
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model);
|
||||
public function destroy(\Eloquent $model);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data);
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data);
|
||||
public function update(\Eloquent $model, array $data);
|
||||
|
||||
/**
|
||||
* Validates an array. Returns an array containing MessageBags
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace FireflyIII\Database\Ifaces;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ interface CommonDatabaseCalls
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id);
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
namespace FireflyIII\Database;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Firefly\Exception\FireflyException;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use FireflyIII\Database\Ifaces\CommonDatabaseCalls;
|
||||
use FireflyIII\Database\Ifaces\CUD;
|
||||
use FireflyIII\Database\Ifaces\PiggybankInterface;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Class Piggybank
|
||||
@@ -29,11 +29,11 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
$model->delete();
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -58,8 +58,8 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
|
||||
|
||||
$piggybank = new \Piggybank($data);
|
||||
if (!$piggybank->validate()) {
|
||||
var_dump($piggybank->errors()->all());
|
||||
if (!$piggybank->isValid()) {
|
||||
var_dump($piggybank->getErrors()->all());
|
||||
exit;
|
||||
}
|
||||
$piggybank->save();
|
||||
@@ -68,12 +68,12 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
/** @var \Piggybank $model */
|
||||
$model->name = $data['name'];
|
||||
@@ -90,8 +90,8 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
$model->reminder = null;
|
||||
}
|
||||
|
||||
if (!$model->validate()) {
|
||||
var_dump($model->errors());
|
||||
if (!$model->isValid()) {
|
||||
var_dump($model->getErrors());
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ use FireflyIII\Database\Ifaces\RecurringInterface;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
use stdObject;
|
||||
|
||||
/**
|
||||
@@ -31,11 +31,11 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
$model->delete();
|
||||
|
||||
@@ -45,7 +45,7 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -71,8 +71,8 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
$recurring->date = $date;
|
||||
$recurring->skip = intval($data['skip']);
|
||||
|
||||
if (!$recurring->validate()) {
|
||||
var_dump($recurring->errors());
|
||||
if (!$recurring->isValid()) {
|
||||
var_dump($recurring->getErrors());
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -82,12 +82,12 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
var_dump($data);
|
||||
|
||||
@@ -104,8 +104,8 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
$model->repeat_freq = $data['repeat_freq'];
|
||||
$model->skip = intval($data['skip']);
|
||||
|
||||
if (!$model->validate()) {
|
||||
var_dump($model->errors());
|
||||
if (!$model->isValid()) {
|
||||
var_dump($model->getErrors());
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ use FireflyIII\Database\Ifaces\PiggybankInterface;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
{
|
||||
@@ -272,11 +272,11 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
// TODO: Implement destroy() method.
|
||||
throw new NotImplementedException;
|
||||
@@ -285,7 +285,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -305,8 +305,8 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
|
||||
|
||||
$repeated = new \Piggybank($data);
|
||||
if (!$repeated->validate()) {
|
||||
var_dump($repeated->errors()->all());
|
||||
if (!$repeated->isValid()) {
|
||||
var_dump($repeated->getErrors()->all());
|
||||
exit;
|
||||
}
|
||||
$repeated->save();
|
||||
@@ -315,12 +315,12 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
throw new NotImplementedException;
|
||||
@@ -425,7 +425,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace FireflyIII\Database;
|
||||
|
||||
use Firefly\Exception\FireflyException;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use FireflyIII\Database\Ifaces\CommonDatabaseCalls;
|
||||
use FireflyIII\Database\Ifaces\CUD;
|
||||
use FireflyIII\Database\Ifaces\TransactionInterface;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Class Transaction
|
||||
@@ -21,11 +21,11 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
use SwitchUser;
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
// TODO: Implement destroy() method.
|
||||
throw new NotImplementedException;
|
||||
@@ -34,7 +34,7 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -48,22 +48,22 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
if (isset($data['description'])) {
|
||||
$transaction->description = $data['description'];
|
||||
}
|
||||
if ($transaction->validate()) {
|
||||
if ($transaction->isValid()) {
|
||||
$transaction->save();
|
||||
} else {
|
||||
throw new FireflyException($transaction->errors()->first());
|
||||
throw new FireflyException($transaction->getErrors()->first());
|
||||
}
|
||||
|
||||
return $transaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
throw new NotImplementedException;
|
||||
@@ -140,7 +140,7 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -4,14 +4,13 @@ namespace FireflyIII\Database;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Firefly\Exception\FireflyException;
|
||||
use FireflyIII\Database\Ifaces\CommonDatabaseCalls;
|
||||
use FireflyIII\Database\Ifaces\CUD;
|
||||
use FireflyIII\Database\Ifaces\TransactionJournalInterface;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
/**
|
||||
* Class TransactionJournal
|
||||
@@ -31,11 +30,11 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
/*
|
||||
* Trigger deletion.
|
||||
@@ -58,7 +57,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -88,8 +87,8 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
/*
|
||||
* This must be enough to store the journal:
|
||||
*/
|
||||
if (!$journal->validate()) {
|
||||
\Log::error($journal->errors()->all());
|
||||
if (!$journal->isValid()) {
|
||||
\Log::error($journal->getErrors()->all());
|
||||
throw new FireflyException('store() transaction journal failed, but it should not!');
|
||||
}
|
||||
$journal->save();
|
||||
@@ -171,12 +170,12 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
/** @var \FireflyIII\Database\TransactionType $typeRepository */
|
||||
$typeRepository = \App::make('FireflyIII\Database\TransactionType');
|
||||
@@ -202,8 +201,8 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
/*
|
||||
* This must be enough to store the journal:
|
||||
*/
|
||||
if (!$model->validate()) {
|
||||
\Log::error($model->errors()->all());
|
||||
if (!$model->isValid()) {
|
||||
\Log::error($model->getErrors()->all());
|
||||
throw new FireflyException('store() transaction journal failed, but it should not!');
|
||||
}
|
||||
$model->save();
|
||||
@@ -269,7 +268,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
$transaction->account()->associate($data['from']);
|
||||
$transaction->amount = $amount * -1;
|
||||
}
|
||||
if (!$transaction->validate()) {
|
||||
if (!$transaction->isValid()) {
|
||||
throw new FireflyException('Could not validate transaction while saving.');
|
||||
}
|
||||
$transaction->save();
|
||||
@@ -446,7 +445,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ use FireflyIII\Database\Ifaces\TransactionTypeInterface;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Support\Collection;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Class TransactionType
|
||||
@@ -20,11 +20,11 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(Ardent $model)
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
// TODO: Implement destroy() method.
|
||||
throw new NotImplementedException;
|
||||
@@ -33,7 +33,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -42,12 +42,12 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Ardent $model
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
throw new NotImplementedException;
|
||||
@@ -72,7 +72,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Ardent
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ class User
|
||||
|
||||
if (!$user->save()) {
|
||||
\Log::error('Invalid user with data: ' . isset($data['email']) ? $data['email'] : '(no email!)');
|
||||
\Session::flash('error', 'Input invalid, please try again: ' . $user->errors()->first());
|
||||
\Session::flash('error', 'Input invalid, please try again: ' . $user->getErrors()->first());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user