Authorization in Livewire v4 Components

Secure your components with Laravel policies.

1 min readLivewireاقرأ بالعربية

Protect actions with Laravel authorization.

Using authorize()

php
public function delete(Post $post): void
{
    $this->authorize('delete', $post);
    $post->delete();
}

In View

blade
@can('delete', $post)
    <button wire:click="delete({{ $post->id }})">Delete</button>
@endcan
All articles

Keep reading