ledgerrz/app/Http/Controllers/DynamicController.php
Daan Meijer a1adf1da1c
Some checks failed
linter / quality (push) Failing after 1m3s
tests / ci (8.3) (push) Failing after 48s
tests / ci (8.4) (push) Failing after 1m5s
tests / ci (8.5) (push) Failing after 1m4s
added media, mutation events, agent instructions
2026-06-15 22:30:17 +02:00

87 lines
1.8 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.media',
'participants',
'chat.messages.user',
'chat.messages.media'
]);
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)
{
//
}
}