feat: Implement chat pagination, participant single page with mutations, and fix user link substitutions
This commit is contained in:
@@ -4,11 +4,29 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Dynamic;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class ParticipantController extends Controller
|
||||
{
|
||||
use AuthorizesRequests;
|
||||
|
||||
public function update(Request $request, Dynamic $dynamic)
|
||||
{
|
||||
$request->validate([
|
||||
'display_name' => ['required', 'string', 'max:255'],
|
||||
]);
|
||||
|
||||
$participant = $dynamic->participants()->where('user_id', $request->user()->id)->firstOrFail();
|
||||
|
||||
$dynamic->participants()->updateExistingPivot($participant->id, [
|
||||
'display_name' => $request->input('display_name'),
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('success', 'Display name updated successfully!');
|
||||
}
|
||||
|
||||
public function show(Request $request, Dynamic $dynamic, User $user)
|
||||
{
|
||||
// Ensure both the authenticated user and the target user are in the dynamic
|
||||
@@ -25,7 +43,7 @@ class ParticipantController extends Controller
|
||||
->take(10)
|
||||
->get();
|
||||
|
||||
return Inertia::render('Participants/Show', [
|
||||
return Inertia::render('Dynamics/Participants/Show', [
|
||||
'dynamic' => $dynamic,
|
||||
'participant' => [
|
||||
'id' => $user->id,
|
||||
@@ -37,18 +55,4 @@ class ParticipantController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Request $request, Dynamic $dynamic)
|
||||
{
|
||||
$request->validate([
|
||||
'display_name' => ['required', 'string', 'max:255'],
|
||||
]);
|
||||
|
||||
$participant = $dynamic->participants()->where('user_id', $request->user()->id)->firstOrFail();
|
||||
|
||||
$dynamic->participants()->updateExistingPivot($participant->id, [
|
||||
'display_name' => $request->input('display_name'),
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('success', 'Display name updated successfully!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user