Subscriber Note Model
| DB Table Name | {wp_db_prefix}_fc_subscriber_notes |
|---|---|
| Schema | Check Schema |
| Source File | fluent-crm/app/Models/SubscriberNote.php |
| Name Space | FluentCrm\App\Models |
| Class | FluentCrm\App\Models\SubscriberNote |
Global Scope
This model has a global scope that excludes rows where status IN ('_company_note_', '_system_log_'). This means queries on SubscriberNote only return regular contact notes.
Shared Table
The fc_subscriber_notes table is shared by three models:
- SubscriberNote — regular contact notes (excludes
_company_note_and_system_log_statuses) - CompanyNote — company notes (
status = '_company_note_') - SystemLog — system log entries (
status = '_system_log_')
Attributes
| Attribute | Data Type | Comment |
|---|---|---|
| id | Integer | |
| subscriber_id | Integer | |
| parent_id | Integer | |
| created_by | Integer | Auto-set to current user on create |
| status | String | |
| type | String | |
| is_private | Boolean | |
| title | String | |
| description | Text | |
| created_at | Date Time | Auto-set on create |
| updated_at | Date Time | Auto-set on create and update |
Usage
Please check Model Basic for Common methods.
Accessing Attributes
php
$note = FluentCrm\App\Models\SubscriberNote::find(1);
$note->id; // returns id
$note->title; // returns title
$note->description; // returns description
.......Fillable Attributes
php
'subscriber_id',
'parent_id',
'created_by',
'type',
'title',
'description',
'created_at'Relations
subscriber
Access the associated subscriber of a note
- return
FluentCrm\App\Models\SubscriberModel
Example:
php
// Accessing Subscriber
$subscriber = $note->subscriber;
// Get notes which has subscriber ids: 1/2/3
$notes = FluentCrm\App\Models\SubscriberNote::whereHas('subscriber', function($query) {
$query->whereIn('id', [1,2,3]);
})->get();
// Get notes which does not have subscriber ids: 1/2/3
$notes = FluentCrm\App\Models\SubscriberNote::whereDoesntHave('subscriber', function($query) {
$query->whereIn('id', [1,2,3]);
})->get();Methods
markAs($status)
Update the note status
- Parameters
- $status
string
- $status
- Returns
FluentCrm\App\Models\SubscriberNote
Usage
php
$note = $note->markAs('open');createdBy()
Get note creator personal information
- Parameters
- none
- Returns
array—['ID', 'display_name', 'photo']
Usage
php
$creatorInfo = $note->createdBy();