Replies: 1 comment
-
Ok, fixed, I decided to add rules in my MessagesController at show() function. I must say this is kinda ugly that by default, anyone can type messages/{id} to read messages not meant to him/her...
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
After checking Laravel Messenger examples here, I checked my routes and noticed an issue.
It works like this: I use Breeze, and my Dashboard header (aka my resources\views\layouts\navigation.blade.php) includes a 'Messages' link towards Messages index (see Routes below).
Issue: After log in, a user can display any thread it's NOT participating in, by typing myLaravelProject/messages/5 for example, even if it is not a 'Participant' of the thread having id = 5.
Note: I installed Breeze using Laravel docs (https://laravel.com/docs/9.x/starter-kits#laravel-breeze) and Laravel Messenger using ReadMe (https://github.com/cmgmyr/laravel-messenger#installation-laravel-5x).
Laravel version: 8.83.4
I must say it doesn't help that the default install gives us demo files which are different than the examples here.
#feelsbadman
Thanks
Stawn
Routes:
Route::group(['middleware' => 'auth', 'prefix' => 'messages', 'as' => 'messages'], function () { Route::get('/', [MessagesController::class, 'index']); Route::get('create', [MessagesController::class, 'create'])->name('.create'); Route::post('/', [MessagesController::class, 'store'])->name('.store'); Route::get('{thread}', [MessagesController::class, 'show'])->name('.show'); Route::put('{thread}', [MessagesController::class, 'update'])->name('.update'); Route::delete('{thread}', [MessagesController::class, 'destroy'])->name('.destroy'); });
MessagesController looks like:
Beta Was this translation helpful? Give feedback.
All reactions