| Server IP : 178.212.43.201 / Your IP : 10.100.0.33 Web Server : Apache/2.4.37 (Oracle Linux Server) OpenSSL/1.1.1k System : Linux spa0007.srv.paxillus.pl 5.4.17-2136.355.3.1.el8uek.x86_64 #3 SMP Sat May 9 17:11:55 PDT 2026 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/kontur2/vendor/evsmash/cms/libs/ |
Upload File : |
<?php
namespace Evsmash\Cms;
use Evsmash\Core\Database\Eloquent;
use Evsmash\Core\Database\SoftDeleting;
use Evsmash\Core\Simpy\Params;
use Evsmash\Cms\Schemas\Blocks as Schema;
class Block extends Eloquent {
use SoftDeleting;
// validate
static public function validate() {
return Schema::validate();
}
// belongs to group
public function group() {
return $this->belongsTo('Evsmash\Cms\BlocksGroup');
}
// params
public function scopeParams($query, $params = false) {
$scope = new Params();
$scope->scope($query, $params);
$scope->where('published');
$scope->where('group', 'group_id');
$scope->search(['name', 'content']);
$scope->order(['group_id' => 'asc', 'sort' => 'asc']);
$scope->with(['group']);
return $scope->query;
}
// published
public function scopePublished($query, $params = false) {
return $query->where('published', 1);
}
// get group
public function scopeGetgroup($query, $params = false) {
if(empty(!$params)) {
return $query->where('group_id', $params);
}
return $query->where('group_id', 1000);
}
// structure
static public function structure() {
$output = [];
foreach(Block::with('group')->orderBy('group_id', 'asc')->get() as $row) {
if(empty($row->group_id)) {
$output[$row->id] = $row->name;
} else {
$output[$row->id] = '{'.$row->group->name.'} '.$row->name;
}
}
return collect($output);
}
}