Mails
This commit is contained in:
parent
68b9d1ff88
commit
b9c26d06d0
75 changed files with 2143 additions and 818 deletions
75
app/Http/Controllers/Settings/EmailTemplateController.php
Executable file
75
app/Http/Controllers/Settings/EmailTemplateController.php
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\EmailTemplate;
|
||||
use Request;
|
||||
|
||||
class EmailTemplateController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'email_template' => EmailTemplate::all(),
|
||||
];
|
||||
return view('settings.email_template.index', $data);
|
||||
}
|
||||
|
||||
public function load(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
if(Request::ajax()) {
|
||||
|
||||
if($data['action'] === "modal-email-template") {
|
||||
if($data['id'] === 'new'){
|
||||
$value = new EmailTemplate();
|
||||
$value->id = 0;
|
||||
$value->active = 1;
|
||||
|
||||
}else{
|
||||
$value = EmailTemplate::find($data['id']);
|
||||
|
||||
}
|
||||
$ret = view("settings.email_template.modal", compact('value'))->render();
|
||||
}
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret]);
|
||||
}
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
|
||||
if($data['id'] === "new" || $data['id'] == 0){
|
||||
$model = EmailTemplate::create($data);
|
||||
}else{
|
||||
$model = EmailTemplate::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_email_template'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
||||
$model = EmailTemplate::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue