PHP code example of regulus / activity-log

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

    

regulus / activity-log example snippets


	Activity::log([
		'contentId'   => $user->id,
		'contentType' => 'User',
		'action'      => 'Create',
		'description' => 'Created a User',
		'details'     => 'Username: '.$user->username,
		'updated'     => (bool) $id,
	]);

	Activity::log([
		'contentType' => 'Record',
		'description' => [
			'created_items', [ // "activity-log::descriptions.created_items" is ":user created :number :items."
				'number' => 2,
				'items'  => 'SPL|labels.record', // "labels.record" in this example has a string of "Record|Records"
			],
		],
		'details' => [
			'record',
			'This is Some Kind of Record',
		],
		'data' => [
			'category' => 'Content',
		],
	]);

	echo $activity->getDescription(); // may output "Unknown User created 2 records."

	echo $activity->getDetails(); // may output "Record: This is Some Kind of Record"

	echo $activity->getData('category'); // will output "Content"

	'item' => [
		'uri'       => 'view/:id',
		'subdomain' => 'items',
		'model'     => 'App\Models\Item',
	],

	echo $activity->getIconMarkup();