PHP code example of origami / consent

1. Go to this page and download the library: Download origami/consent 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/ */

    

origami / consent example snippets



use Origami\Consent\GivesConsent;

class User extends Model {

  use GivesConsent;

}


$model->giveConsentTo('consent-name');

$model->giveConsentTo('consent-name', [
  'text' => 'You are consenting to ...',
  'meta' => [
    'ip' => '192.168.0.1',
  ]
]);

$model->revokeConsentTo('consent-name');

if ( $model->hasGivenConsent('consent-name') ) {

}

if ( $model->hasGivenConsent('consent-name', true) ) {

}

$consent = $model->getConsent('consent-name');

php artisan vendor:publish --provider="Origami\Consent\ConsentServiceProvider" --tag="migrations"

php artisan migrate