PHP code example of ayoub-amzil / model-activity-log
1. Go to this page and download the library: Download ayoub-amzil/model-activity-log 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/ */
ayoub-amzil / model-activity-log example snippets
composer
php artisan vendor:publish --tag=model-activity-log-migrations
php artisan migrate
use AyoubAmzil\ModelActivityLog\Traits\LogsActivity;
class Product extends Model
{
use LogsActivity;
// Your model code...
}
// create
$product = Product::create(['name' => 'Example', 'price' => 100]);
// update
$product->price = 120;
$product->save();
//delete
$product->delete();
use AyoubAmzil\ModelActivityLog\Models\ActivityLog;
$logs = ActivityLog::all();