Merge branch 'master' of github.com:akaunting/akaunting
This commit is contained in:
commit
48a4ce7382
@ -4,6 +4,7 @@ namespace App\Http\Controllers\Settings;
|
|||||||
|
|
||||||
use App\Abstracts\Http\Controller;
|
use App\Abstracts\Http\Controller;
|
||||||
use App\Http\Requests\Setting\Setting as Request;
|
use App\Http\Requests\Setting\Setting as Request;
|
||||||
|
use App\Jobs\Setting\UpdateEmailTemplate;
|
||||||
use App\Models\Common\Company;
|
use App\Models\Common\Company;
|
||||||
use App\Models\Common\EmailTemplate;
|
use App\Models\Common\EmailTemplate;
|
||||||
use App\Utilities\Installer;
|
use App\Utilities\Installer;
|
||||||
@ -106,10 +107,10 @@ class Email extends Controller
|
|||||||
|
|
||||||
$template = EmailTemplate::alias($alias)->first();
|
$template = EmailTemplate::alias($alias)->first();
|
||||||
|
|
||||||
$template->update([
|
$this->dispatch(new UpdateEmailTemplate($template, [
|
||||||
'subject' => $fields[$subject_key],
|
'subject' => $fields[$subject_key],
|
||||||
'body' => $fields[$body_key],
|
'body' => $fields[$body_key],
|
||||||
]);
|
]));
|
||||||
|
|
||||||
unset($fields[$subject_key]);
|
unset($fields[$subject_key]);
|
||||||
unset($fields[$body_key]);
|
unset($fields[$body_key]);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Jobs\Common;
|
namespace App\Jobs\Setting;
|
||||||
|
|
||||||
use App\Abstracts\Job;
|
use App\Abstracts\Job;
|
||||||
use App\Interfaces\Job\HasOwner;
|
use App\Interfaces\Job\HasOwner;
|
18
app/Jobs/Setting/DeleteEmailTemplate.php
Normal file
18
app/Jobs/Setting/DeleteEmailTemplate.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs\Setting;
|
||||||
|
|
||||||
|
use App\Abstracts\Job;
|
||||||
|
use App\Interfaces\Job\ShouldDelete;
|
||||||
|
|
||||||
|
class DeleteEmailTemplate extends Job implements ShouldDelete
|
||||||
|
{
|
||||||
|
public function handle(): bool
|
||||||
|
{
|
||||||
|
\DB::transaction(function () {
|
||||||
|
$this->model->delete();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
19
app/Jobs/Setting/UpdateEmailTemplate.php
Normal file
19
app/Jobs/Setting/UpdateEmailTemplate.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs\Setting;
|
||||||
|
|
||||||
|
use App\Abstracts\Job;
|
||||||
|
use App\Interfaces\Job\ShouldUpdate;
|
||||||
|
use App\Models\Common\EmailTemplate;
|
||||||
|
|
||||||
|
class UpdateEmailTemplate extends Job implements ShouldUpdate
|
||||||
|
{
|
||||||
|
public function handle(): EmailTemplate
|
||||||
|
{
|
||||||
|
\DB::transaction(function () {
|
||||||
|
$this->model->update($this->request->all());
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->model;
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@
|
|||||||
namespace Database\Seeds;
|
namespace Database\Seeds;
|
||||||
|
|
||||||
use App\Abstracts\Model;
|
use App\Abstracts\Model;
|
||||||
use App\Jobs\Common\CreateEmailTemplate;
|
use App\Jobs\Setting\CreateEmailTemplate;
|
||||||
use App\Traits\Jobs;
|
use App\Traits\Jobs;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user