PHP code example of vinicius73 / laravel-model-shield

1. Go to this page and download the library: Download vinicius73/laravel-model-shield 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/ */

    

vinicius73 / laravel-model-shield example snippets


'Vinicius73\ModelShield\ModelShieldServiceProvider',

'Shield' => 'Vinicius73\ModelShield\Facades\Shield',

use Vinicius73\ModelShield\ModelShield;

class Student extends ModelShield
{
   protected $table = 'students';
}

use Vinicius73\ModelShield\Traits\Shield;

class Student extends Eloquent
{
   use Shield;

   protected $table = 'students';
}

use Cartalyst\Sentry\Users\Eloquent\User as SentryModel;
use Vinicius73\ModelShield\Traits\ShieldSentry;

class User extends SentryModel
{
   use ShieldSentry;
}


// students.php

return [
   'default' => [
      'name' => 'e:students',
      'password' => 'tom_messages' => [
      'gistered!'
   ],
   // Custom Attribute Names
   'attribute_names' => [
      'email' => 'Your name'
   ]
];

$student = new Student();
$student->name 'Amanda M.';

if($student->save()):
 // do something
else:
 $errors = $student->getErrors();
 // do something
endif;