Repository URL to install this package:
|
Version:
3.4.1 ▾
|
<?php
namespace Evsmash\Widgets;
use Evsmash\Core\Database\Eloquent;
use Evsmash\Core\Database\SoftDeleting;
use Evsmash\Core\Simpy\Params;
class Form extends Eloquent {
use SoftDeleting;
// params
public function scopeParams($query, $params = false) {
$scope = new Params();
$scope->scope($query, $params);
$scope->search(['email', 'data']);
$scope->order(['id' => 'desc']);
return $scope->query;
}
// data list
public function getDataListAttribute() {
// check if empty
if(empty($this->data)) {
return null;
}
// unserialize
$data = unserialize($this->data, ['allowed_classes' => false]);
// output
return $data;
}
// recipients
static public function recipients($setting) {
// lines
$lines = explode("\n", $setting);
// one or multiple
if(count($lines) == 1) {
return false;
}
// multiple
$output = [];
foreach($lines as $line) {
$recipient = explode('::', $line);
$output[$recipient[0]] = $recipient[1];
}
return $output;
}
}