PHP code example of tanmaymishu / laravel-funnel

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

    

tanmaymishu / laravel-funnel example snippets


use HasFilters;
protected $filters = [];


   
   namespace App;
   
   use Illuminate\Database\Eloquent\Model;
   use TanmayMishu\LaravelFunnel\HasFilters;
   
   class Post extends Model
   {
       use HasFilters;
   
       protected $filters = [
           \App\Filters\Published::class,
       ];
   }

    php artisan -h funnel:filter
    

// A Post hasMany Comments and a Comment hasMany Replies
// Post is the model that we want to query.

Post::createMany([
    ['title' => 'Foo', 'body' => 'Lorem ipsum'], // We'll call it Post 1
    ['title' => 'Bar', 'body' => 'Dolor sit amet'], // We'll call it Post 2
]);
Comment::createMany([
    ['body' => 'Comment A', 'post_id' => 1],
    ['body' => 'Comment B', 'post_id' => 2],
]);
Reply::createMany([
    ['content' => 'Reply A', 'comment_id' => 1],
    ['content' => 'Reply B', 'comment_id' => 2],
]);