PHP code example of zepfietje / laravel-seeable

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

    

zepfietje / laravel-seeable example snippets


   return new class extends Migration
   {
       public function up(): void
       {
           Schema::table('users', function (Blueprint $table) {
               $table->timestamp('seen_at')->nullable();
           });
       }

       // ...
   };
   

   namespace App\Models;

   // ...
   use ZepFietje\Seeable\Concerns\Seeable;

   class User extends Authenticatable
   {
       // ...
       use Seeable;
   }
   

   protected $middlewareGroups = [
       'web' => [
           // ...
           \ZepFietje\Seeable\Http\Middleware\SeeUser::class,
       ],
   ];
   

User::seenAfter('2022-06-30')->get();
$dailyActiveUsers = User::seenPastDay()->count();
$weeklyActiveUsers = User::seenPastWeek()->count();
$monthlyActiveUsers = User::seenPastMonth()->count();
bash
    php artisan vendor:publish --tag="seeable-config"