Warenwirtschaft: OPT-2 Settings-CRUD-Basisklasse
- Abstrakte SettingCrudController-Basis für die kleinen Stammdaten-CRUDs - TaxRate/DeliveryTime/DisposalReason/MaterialQuality/Location/SupplierCategory/PackagingMaterial auf ~25-Zeilen-Konfiguration reduziert - Identische Update*Request-Klassen entfernt (Update nutzt Store-Request, via updateRequestClass() überschreibbar) - Bilanz -441/+73 Zeilen; Grundlage für die Lagerort-CRUDs in AP-21 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
65f949dd7a
commit
8c90d95c69
16 changed files with 216 additions and 445 deletions
|
|
@ -2,53 +2,28 @@
|
|||
|
||||
namespace App\Http\Controllers\Admin\Inventory;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Inventory\StoreDeliveryTimeRequest;
|
||||
use App\Http\Requests\Inventory\UpdateDeliveryTimeRequest;
|
||||
use App\Models\DeliveryTime;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class DeliveryTimeController extends Controller
|
||||
class DeliveryTimeController extends SettingCrudController
|
||||
{
|
||||
public function create(): View
|
||||
protected function modelClass(): string
|
||||
{
|
||||
return view('admin.inventory.delivery-times.form', [
|
||||
'model' => new DeliveryTime(['active' => true, 'pos' => 0]),
|
||||
]);
|
||||
return DeliveryTime::class;
|
||||
}
|
||||
|
||||
public function store(StoreDeliveryTimeRequest $request): RedirectResponse
|
||||
protected function viewPrefix(): string
|
||||
{
|
||||
DeliveryTime::create($request->validated());
|
||||
|
||||
\Session::flash('alert-save', '1');
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
return 'admin.inventory.delivery-times';
|
||||
}
|
||||
|
||||
public function edit(DeliveryTime $deliveryTime): View
|
||||
protected function redirectRoute(): string
|
||||
{
|
||||
return view('admin.inventory.delivery-times.form', [
|
||||
'model' => $deliveryTime,
|
||||
]);
|
||||
return 'admin.inventory.general';
|
||||
}
|
||||
|
||||
public function update(UpdateDeliveryTimeRequest $request, DeliveryTime $deliveryTime): RedirectResponse
|
||||
protected function storeRequestClass(): string
|
||||
{
|
||||
$deliveryTime->update($request->validated());
|
||||
|
||||
\Session::flash('alert-save', '1');
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
}
|
||||
|
||||
public function destroy(DeliveryTime $deliveryTime): RedirectResponse
|
||||
{
|
||||
$deliveryTime->delete();
|
||||
|
||||
\Session::flash('alert-success', __('Eintrag gelöscht'));
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
return StoreDeliveryTimeRequest::class;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue