1. Go to this page and download the library: Download thepinecode/policy 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/ */
thepinecode / policy example snippets
use Pine\Policy\UsesModelName;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
use UsesModelName;
protected $appends = ['model_name'];
}
html
@currentUser
<!-- Result -->
<script>window['user'] = { ... };</script>
html
@currentUser ('admin')
<!-- Result -->
<script>window['admin'] = { ... };</script>