# Put a permission on the route

> role and permission middleware refuse the request. The Vue page only receives a boolean it can show.

- URL: https://laravel-vuejs.space/spatie-permission-middleware-vue
- Author: Anass Ez-zouaine (https://laravel-vuejs.space/author/anass-ez-zouaine)
- Published: 2026-10-11
- Topics: Laravel, VueJs, Permissions

People searching “Spatie permission middleware Vue” check `v-if="can('posts.update')"` in the page and never register the middleware. The [permissions guide](https://laravel-vuejs.space/laravel-vue-permissions) installs the package and shares a boolean. This page is the route.

> **TL;DR**
>
> -   role and permission middleware refuse the request.
> -   The Vue page only receives a boolean it can show.
> -   Do not spell the permission differently in the seeder and the route.
> -   Do not grant it from the Vue page.
>
> **Who it's for:** Laravel + Vue developers
>
> **Applies to:** Laravel 13 · Vue 3

## The fix

Publish and migrate are in that guide. The alias belongs in `bootstrap/app.php` if it is not registered yet:

```php
$middleware->alias([
    'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
    'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
]);
```

```php
Route::post('/posts', [PostController::class, 'store'])
    ->middleware(['auth', 'permission:posts.update']);
```

A user without `posts.update` gets a 403 before the controller. The Vue page can still hide the button from the boolean the permissions guide shares. Hiding is not this middleware.

## What to avoid

> **Gotcha**
>
> Do not spell the permission differently in the seeder and the route. `posts.update` and `post.update` are two permissions. Do not grant it from the Vue page.

## FAQ

**Q: How do I put a permission on the route?**

role and permission middleware refuse the request. The Vue page only receives a boolean it can show.

**Q: What goes wrong with Spatie permission middleware Vue?**

Many developers check \`v-if="can('posts. Do not spell the permission differently in the seeder and the route.
