Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sanjayacloud's avatar

how to use spatie permission in vue 3 with laravel backend

how to use spatie permission in vue 3 with laravel backend. I use back end as Laravel and VUe as front end separately. Anyone can help?

0 likes
6 replies
MohamedTammam's avatar

Spatie permission package is only working on back-end and not related to front-end. So you need to pass that information yourself.

That's how I do it, image we have a post API resource

return [
	'id' => '...',
	'title' => '...',
	'content' => '...',
	'can' => [
		'edit' => auth()->user()->can('edit posts'),
		'delete' => auth()->user()->can('delete posts')
	]
];

That's an example of Laracasts response

1 like

Please or to participate in this conversation.