PHP code example of satya / eloquent-activity

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

    

satya / eloquent-activity example snippets


php artisan migrate

     /**
         * @param $id
         */
        public function history($id){
            $client = Client::where('id',$id)->first();
            if (!empty($client))
            {
                dump($client);
                dd($client->recordHistory->toArray());
            }
        }
    

    
    
    namespace App\Models;
    
    use Illuminate\Database\Eloquent\Model;
    use Satya\EloquentActivity\Traits\EloquentActivity;
    
    class Client extends Model
    {
        use EloquentActivity;
    
        /**
         * @var string
         */
        protected $table = 'clients';
    
    
        /**
         * @var string[]
         */
        protected $fillable = [
            'first_name',
            'last_name'
        ];
    }
    
    

'providers' => [
    // ...
    Satya\EloquentActivity\EloquentActivityServiceProvider::class,
];