Question
extends CrmClientModel
in package
This class represents a question It has some static methods to retrieve questions and answers
Tags
Table of Contents
- $answers : array<string|int, Answer>
- $id : string
- $question : string
- $type : QuestionType
- $modelFields : array<string|int, mixed>
- The crm customer fields
- $validation : array<string|int, mixed>
- Validation rules
- $answers : array<string|int, mixed>
- The question answers
- $id : int
- The question id
- $question : string
- The actual question as a string
- $type : QuestionType
- The question type
- __construct() : mixed
- Question
- __get() : mixed
- General accessor
- __set() : void
- Set prop on the model.
- all() : array<string|int, mixed>
- Get all questions only
- allWithCustomerAnswers() : array<string|int, mixed>
- Get all the questions with customer answers
- fill() : void
- Fill values into model using validation rules.
- jsonSerialize() : array<string|int, mixed>
- Serialize this object to an array
- unansweredBy() : array<string|int, mixed>
- Get unanswered question for a specific customer
- validateAllValues() : array<string|int, mixed>
- Validate all model properties
Properties
$answers
public
array<string|int, Answer>
$answers
An array with answers
$id
public
string
$id
The question id
$question
public
string
$question
The actual question as a string
$type
public
QuestionType
$type
The question type to display, it also hints wether it can accept one or multiple responses, so only checkbox allows multiple responses
$modelFields
The crm customer fields
protected
array<string|int, mixed>
$modelFields
= ['id', 'question', 'type', 'answers']
$validation
Validation rules
protected
static array<string|int, mixed>
$validation
= ['id' => 'required|int', 'question' => 'required|string|max:255', 'type' => ['required'], 'answers' => 'required|array']
$answers
The question answers
private
array<string|int, mixed>
$answers
= []
\LDC\LDCCRM\Models\Answer
$id
The question id
private
int
$id
Required Field Type bigInt
$question
The actual question as a string
private
string
$question
= null
Required Max length 255 Field Type varchar
$type
The question type
private
QuestionType
$type
= null
Validate: in QuestionType::toValues()
Required Field Type tinyInteger
Methods
__construct()
Question
public
__construct([array<string|int, mixed> $properties = [] ]) : mixed
Parameters
- $properties : array<string|int, mixed> = []
Tags
Return values
mixed —__get()
General accessor
public
__get(string $field) : mixed
Parameters
- $field : string
Return values
mixed —__set()
Set prop on the model.
public
__set(string $field, mixed $value) : void
Parameters
- $field : string
- $value : mixed
Tags
Return values
void —all()
Get all questions only
public
static all() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —of \LDC\LDCCRM\Models\Question
allWithCustomerAnswers()
Get all the questions with customer answers
public
static allWithCustomerAnswers(Customer $customer) : array<string|int, mixed>
Parameters
- $customer : Customer
Tags
Return values
array<string|int, mixed> —[ 0 => [ 'question' => \LDC\LDCCRM\Models\Question, 'customerAnswers' => \LDC\LDCCRM\Models\Answer[] ] ]
with \LDC\LDCCRM\Models\Question[] and the customer \LDC\LDCCRM\Models\Answer[]
fill()
Fill values into model using validation rules.
public
fill(array<string|int, mixed> $properties) : void
Parameters
- $properties : array<string|int, mixed>
Tags
Return values
void —jsonSerialize()
Serialize this object to an array
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —unansweredBy()
Get unanswered question for a specific customer
public
static unansweredBy(Customer $customer) : array<string|int, mixed>
Parameters
- $customer : Customer
Tags
Return values
array<string|int, mixed> —of \LDC\LDCCRM\Models\Question
validateAllValues()
Validate all model properties
protected
validateAllValues([array<string|int, mixed> $ignore = [] ]) : array<string|int, mixed>
Parameters
- $ignore : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed> —the validated values