Neustrukturierung Customer / Lead / Booking Phase 2
This commit is contained in:
parent
313f0dbf4e
commit
6df9c401af
69 changed files with 3809 additions and 374 deletions
60
app/Http/Controllers/OfferTemplateController.php
Normal file
60
app/Http/Controllers/OfferTemplateController.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\OfferTemplate;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OfferTemplateController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(['admin', '2fa']);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('offer_template.index', [
|
||||
'templates' => OfferTemplate::query()->orderBy('name')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
if ($id === 'new') {
|
||||
$template = new OfferTemplate();
|
||||
$id = 'new';
|
||||
} else {
|
||||
$template = OfferTemplate::findOrFail($id);
|
||||
$id = $template->id;
|
||||
}
|
||||
return view('offer_template.detail', [
|
||||
'template' => $template,
|
||||
'id' => $id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request, $id = null)
|
||||
{
|
||||
if (! $request->has('action')) {
|
||||
abort(403, 'keine Action');
|
||||
}
|
||||
\Session::flash('alert-info', 'Vorlagen speichern (Stub A6) — C1 liefert die Logik.');
|
||||
|
||||
if ($id === 'new' || $id === null) {
|
||||
return redirect()->route('offer_template_detail', ['id' => 'new']);
|
||||
}
|
||||
$template = OfferTemplate::findOrFail($id);
|
||||
|
||||
return redirect()->route('offer_template_detail', ['id' => $template->id]);
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$template = OfferTemplate::findOrFail($id);
|
||||
$template->delete();
|
||||
\Session::flash('alert-success', 'Vorlage gelöscht.');
|
||||
|
||||
return redirect()->route('offer_templates');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue