80 lines
1.6 KiB
PHP
80 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Requests\StoreDynamicRequest;
|
|
use App\Models\Dynamic;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
|
|
class DynamicController extends Controller
|
|
{
|
|
/**
|
|
* 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');
|
|
|
|
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)
|
|
{
|
|
//
|
|
}
|
|
}
|