# Funnel Model

DB Table Name {wp_db_prefix}_fc_funnels
Schema Check Schema
Source File fluent-crm/app/Models/Funnel.php
Name Space FluentCrm\App\Models
Class FluentCrm\App\Models\Funnel

# Attributes

Attribute Data Type Comment
id Integer
type String
title String
trigger_name String
status String
conditions String
settings Array
created_by Integer
created_at Date Time
updated_at Date Time

# Usage

Please check Model Basic for Common methods.

# Accessing Attributes


$funnel = FluentCrm\App\Models\Funnel::find(1);

$funnel->id; // returns id
$funnel->status; // returns status
.......
1
2
3
4
5
6

# Fillable Attributes

'type', // funnel : Default: funnel
'title',
'trigger_name',
'status', // draft | published  : Default: draft
'conditions',
'settings',
'created_by',
'updated_at'

1
2
3
4
5
6
7
8
9

# Scopes

This model has the following scope that you can use

# published()

returns only published funnels

# Usage:

$funnels = FluentCrm\App\Models\Funnel::published()->get();
1

# Relations

This model has the following relationships that you can use

# actions

Get all the actions of Funnel Sequence related to this funnel

  • returns FluentCrm\App\Models\FunnelSequence Model Collections

# Example:

// Accessing actions
$funnelActions = $funnel->actions;
1
2

// You can also limit your results based on the existence of a relationship. For example, if you want to get all the funnels that have ids 1, 2 and 3 in the actions, you can do the following:

// Get Funnels which have sequence ids: 1/2
$funnels = FluentCrm\App\Models\Funnel::whereHas('actions', function($query) {
    $query->whereIn('id', [1,2]);
})->get();
1
2
3
4

# subscribers

Similar to actions, get all the funnel subscribers related to funnel like following:

  • return FluentCrm\App\Models\FunnelSubscriber Model Collections

# Example:

// returns all the funnel subscribers related to funnel
$subscribersOfFunnel = $funnel->subscribers;

// Get funnels filtered by funnel subscribers

// Get Subscribers which has list ids: 1/2/3
$subscribers = FluentCrm\App\Models\Funnel::whereHas('subscribers', function($query) {
    $query->whereIn('id', [1,2,3]);
})->get();
1
2
3
4
5
6
7
8
9

You can also use whereDoseNotHave to get the funnels that do not have the given relationship.

// Get Subscribers which does not have list ids: 1/2/3
$subscribers = FluentCrm\App\Models\Funnel::whereDoesntHave('subscribers', function($query) {
    $query->whereIn('id', [1,2,3]);
})->get();
1
2
3
4