PHP code example of axn / laravel-eloquent-authorable
1. Go to this page and download the library: Download axn/laravel-eloquent-authorable 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/ */
axn / laravel-eloquent-authorable example snippets
use Axn\EloquentAuthorable\AuthorableTrait;
use Illuminate\Database\Eloquent\Model
class Post extends Model
{
use AuthorableTrait;
public $authorable = [
'users_model' => \App\Admin::class,
'guard' => 'admin',
];
//...
}
use Axn\EloquentAuthorable\AuthorableTrait;
use Illuminate\Database\Eloquent\Model
class Post extends Model
{
use AuthorableTrait;
public $authorable = [
'created_by_column_name' => 'custom_created_by',
'updated_by_column_name' => 'custom_updated_by',
];
//...
}
use Axn\EloquentAuthorable\AuthorableTrait;
use Illuminate\Database\Eloquent\Model
class Post extends Model
{
use AuthorableTrait;
public $authorable = [
'set_author_when_creating' => false,
'set_author_when_updating' => false,
];
//...
}
use Axn\EloquentAuthorable\AuthorableTrait;
use Illuminate\Database\Eloquent\Model
class Post extends Model
{
use AuthorableTrait;
public $authorable = [
'users_model' => \App\Admin::class,
'guard' => 'admin',
'created_by_column_name => 'custom_created_by',
'set_author_when_creating' => true,
'updated_by_column_name' => 'custom_updated_by',
'set_author_when_updating' => false,
];
//...
}
sh
php artisan vendor:publish --provider="Axn\EloquentAuthorable\ServiceProvider" --tag="config"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.