prevent change/delete for reconciled records
This commit is contained in:
@@ -41,6 +41,12 @@ class DeleteTransaction extends Job
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
if ($this->transaction->reconciled) {
|
||||
$message = trans('messages.warning.reconciled_tran');
|
||||
|
||||
throw new \Exception($message);
|
||||
}
|
||||
|
||||
if ($this->transaction->category->id == Category::transfer()) {
|
||||
throw new \Exception('Unauthorized');
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ class UpdateTransaction extends Job
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->authorize();
|
||||
|
||||
$this->transaction->update($this->request->all());
|
||||
|
||||
// Upload attachment
|
||||
@@ -44,4 +46,18 @@ class UpdateTransaction extends Job
|
||||
|
||||
return $this->transaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this action is applicable.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
if ($this->transaction->reconciled) {
|
||||
$message = trans('messages.warning.reconciled_tran');
|
||||
|
||||
throw new \Exception($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user