ledgerrz/app/Http/Controllers/DynamicController.php
Daan Meijer 1d1ca88aea
Some checks failed
linter / quality (push) Failing after 1m35s
tests / ci (8.3) (push) Failing after 1m34s
tests / ci (8.4) (push) Failing after 1m5s
tests / ci (8.5) (push) Failing after 1m3s
work in progress: removed applayout from pages, trying to get broadcasting to work
2026-06-15 01:19:26 +02:00

82 lines
1.7 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreDynamicRequest;
use App\Models\Dynamic;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Http\Request;
use Inertia\Inertia;
class DynamicController extends Controller
{
use AuthorizesRequests;
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
return Inertia::render('Dynamics/Index', [
'dynamics' => $request->user()->dynamics()->get(),
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return Inertia::render('Dynamics/Create');
}
/**
* Store a newly created resource in storage.
*/
public function store(StoreDynamicRequest $request)
{
$dynamic = Dynamic::create($request->validated());
$dynamic->participants()->attach($request->user()->id, ['role' => 'owner']);
return redirect()->route('dynamics.show', $dynamic);
}
/**
* Display the specified resource.
*/
public function show(Dynamic $dynamic)
{
$this->authorize('view', $dynamic);
$dynamic->load('ledgers', 'participants', 'chat.messages.user');
return Inertia::render('Dynamics/Show', [
'dynamic' => $dynamic,
]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Dynamic $dynamic)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Dynamic $dynamic)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Dynamic $dynamic)
{
//
}
}