1. Go to this page and download the library: Download nawasara/auth-primitives library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Livewire\Component;
use Nawasara\AuthPrimitives\Attributes\RequiresSudo;
use Nawasara\AuthPrimitives\Traits\WithSudo;
class DangerousThings extends Component
{
use WithSudo;
#[RequiresSudo(reason: 'menghapus database')]
public function dropDatabase(string $name): void
{
// …only runs inside an active sudo window
}
}