What I want to achieve is, I have audience in a few countries. I also have editors in different country.
For example, editor in US can only edit & view posts in US, editor in Hong Kong not allowed to view US posts.
Route::get('{country}/posts', [
'uses' => 'CountryController@posts',
'middleware' => ['permission:view posts,{country}'], <------- SEE HERE
]);
Is it possible to achieve this?
P/S: I'm using Spatie laravel-permission
It's not possible, but I use this lines of code in a middleware:
$country = $request->route('country'); // gets 'us' or 'hk'
This method of Request
returns the route segment.