PHP code example of awcodes / recently

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

    

awcodes / recently example snippets


use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make(),
        ])
}

use Awcodes\Recently\Concerns\HasRecentHistoryRecorder;

class EditUser extends EditRecord
{
    use HasRecentHistoryRecorder;

    protected static string $resource = UserResource::class;
}

class ViewUser extends ViewRecord
{
    use HasRecentHistoryRecorder;

    protected static string $resource = UserResource::class;
}

// config/recently.php
return [
    'user_model' => App\Models\User::class,
    'max_items' => 20,
    'width' => 'xs',
    'global_search' => true,
    'menu' => true,
    'icon' => 'heroicon-o-arrow-uturn-left',
];

use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make()
                ->globalSearch(condition: false),
        ])
}

use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make()
                ->menu(condition: false),
        ])
}

use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make()
                ->icon('heroicon-o-clock'),
        ]);
}

use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make()
                ->rounded(condition: false),
        ]);
}

use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make()
                ->label('Recently Viewed Records'),
        ]);
}

use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make()
                ->width('sm'),
        ]);
}

use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make()
                ->maxItems(10),
        ]);
}

use Awcodes\Recently\RecentlyPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            RecentlyPlugin::make()
                ->renderUsingHook('PanelsRenderHook::USER_MENU_AFTER'),
        ]);
}
bash
php artisan recently:install
js
content: [
    './vendor/awcodes/recently/resources/**/*.blade.php',
]