PHP code example of ppranav / table-insights

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

    

ppranav / table-insights example snippets

bash
php artisan vendor:publish --tag=tableinsights
bash
public function setQuery(Activity $activity)
{
    return $activity->query()->where(‘user_id’, auth()->id());
}

bash
class Dashboard extends TableInsights
{

    /**
     * Add arrays of models
     * @return array<Model, string>
     */
    public function models() {
        return [
            Project::class => 'created_at',
            TaskLog::class => 'committed_at'
        ];
    }

    public function setQuery(Activity $activity)
    {
        return $activity->query()->where('created_for_id', auth()->id());
    }
}