PHP code example of victorlap / laravel-approvable
1. Go to this page and download the library: Download victorlap/laravel-approvable 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/ */
victorlap / laravel-approvable example snippets
use Illuminate\Database\Eloquent\Model;
use Victorlap\Approvable\Approvable;
// Minimal
class Post extends Model
{
use Approvable;
}
// Extended
class Post extends Model
{
use Approvable;
protected $approveOf = array();
protected $dontApproveOf = array();
protected function currentUserCanApprove()
{
return Auth::check();
}
protected function getSystemUserId()
{
return Auth::id();
}
}
$post->title = "Very Good Post";
$post->save(); // This still works!
$post->title = "Very Good Post";
$post->save(); // Post remains with the old title in the database, however a change request is now also present.