Fewo Mails / Booking Country Services

This commit is contained in:
Kevin Adametz 2020-05-28 19:03:42 +02:00
parent b9c26d06d0
commit 48a6eb2282
154 changed files with 7761 additions and 1643 deletions

View file

@ -32,6 +32,12 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSContent newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSContent newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSContent query()
* @property string|null $identifier
* @property array|null $object
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSContent whereIdentifier($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSContent whereObject($value)
* @property int|null $pos
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSContent wherePos($value)
*/
class CMSContent extends Model
{
@ -59,7 +65,12 @@ class CMSContent extends Model
protected $table = 'c_m_s_contents';
protected $fillable = [
'name', 'slug', 'field', 'text', 'full_text', 'integer', 'decimal',
'name', 'slug', 'identifier', 'field', 'text', 'full_text', 'object', 'integer', 'decimal', 'pos',
];
protected $casts = [
'object' => 'array',
'pos' => 'int'
];
public function sluggable()
@ -107,11 +118,14 @@ class CMSContent extends Model
return $this->full_text;
break;
case 'file':
return \GuzzleHttp\json_decode($this->full_text);
// return \GuzzleHttp\json_decode($this->full_text);
return $this->object;
break;
case 'array':
return $this->object;
break;
case 'integer':
return $this->integer;
break;
case 'decimal':
return $this->decimal;
@ -122,13 +136,21 @@ class CMSContent extends Model
//FILE ------------------------
public function isFile(){
return $this->field === 'file' ? true : false;
return $this->id > 0 && $this->field === 'file' ? true : false;
}
/*'identifier', 'filename', 'dir', 'original_name', 'ext', 'mine', 'size'*/
public function getFileContent($key= false){
if($key && $this->isFile()){
$file = \GuzzleHttp\json_decode($this->full_text);
return isset($file->{$key}) ? $file->{$key} : false;
// $file = \GuzzleHttp\json_decode($this->full_text);
return isset($this->object[$key]) ? $this->object[$key] : false;
}
return false;
}
public function getArrayContent($key= false){
if($key && $this->field === 'array'){
// $file = \GuzzleHttp\json_decode($this->full_text);
return isset($this->object[$key]) ? $this->object[$key] : false;
}
return false;
}
@ -209,7 +231,10 @@ class CMSContent extends Model
return $CMSContent->full_text;
break;
case 'file':
return \GuzzleHttp\json_decode($CMSContent->full_text);
return $CMSContent->object; //\GuzzleHttp\json_decode($CMSContent->full_text);
break;
case 'array':
return $CMSContent->object; //\GuzzleHttp\json_decode($CMSContent->full_text);
break;
case 'integer':
return $CMSContent->integer;