1. Go to this page and download the library: Download brackets/verifications 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/ */
brackets / verifications example snippets
'enabled' => env('VERIFICATION_ENABLED', true), // you can enable/disable globally (i.e. disabled for tests/dev env)
'actions' => [
'my-action' => [
'enabled' => true, // you can enable/disable single action
'channel' => 'sms', // currently: sms, email
'form_template' => 'brackets/verifications::verification', // blade name with namespace used for verification code form
'expires_in' => 15, // specifies how many minutes does it take to
public function postDownloadInvoice(Invoice $invoice)
{
// this code will run on the attempt before the verification and then again, after the successful verification
if (!$invoice->isPublished()) {
throw new InvoiceNotPublishedException();
}
return Verification::verify('download-invoice', // name of the action
'/invoices', // URL user will be redirect after verification (he must click to download the invoice again manually :(
function () use ($invoice) {
// on the other hand this code will run only once, after the verification
return $invoice->download();
});
}
class User extends Authenticatable implements Verifiable
{
use VerifiableTrait;
// ...
public function isVerificationRequired($action) {
// allow super admin to all actions
if ($this->hasRole('Admin') {
return false;
}
if ($action == 'withdraw-money') {
// allow withdraw-money action to be optional (i.e. user can set it in their profile)
if (!$this->withdraw_monoey_