Tree Travel Guide
This commit is contained in:
parent
a1ca534f55
commit
1f340e96fa
78 changed files with 4133 additions and 1027 deletions
103
app/Repositories/IQ/ContentSiteRepository.php
Normal file
103
app/Repositories/IQ/ContentSiteRepository.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repositories\IQ;
|
||||
|
||||
|
||||
use App\Repositories\BaseRepository;
|
||||
|
||||
class ContentSiteRepository extends BaseRepository {
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//IQContentSite $model
|
||||
$this->model = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* refresh.
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
|
||||
/*
|
||||
if($data['user_id'] == "new"){
|
||||
|
||||
$this->model = User::create([
|
||||
'email' => $data['email'],
|
||||
'password' => env('APP_KEY'),
|
||||
]);
|
||||
}
|
||||
else{
|
||||
$this->model = $this->getById($data['user_id']);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public function siteFieldPrepare($contentSite, $area_section){
|
||||
|
||||
$ret = [];
|
||||
foreach($area_section->iq_content_model->iq_content_model_fields as $model_field){
|
||||
$site_field = false;
|
||||
// $site_field = IQContentSiteField::getSiteFieldOrNew($contentSite->id, $model_field->id);
|
||||
//new
|
||||
if(!$site_field->id){
|
||||
$site_field->site_id = $contentSite->id;
|
||||
$site_field->model_field_id = $model_field->id;
|
||||
$site_field->field = $model_field->field;
|
||||
$site_field->pos = $model_field->pos;
|
||||
$site_field->settings = $model_field->settings;
|
||||
$site_field->active = true;
|
||||
$site_field->search = $model_field->search;
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
$ret[] = $site_field;
|
||||
}
|
||||
|
||||
$sort = [];
|
||||
foreach ($ret as $key => $site_field) {
|
||||
$sort[$key] = $site_field->pos;
|
||||
}
|
||||
array_multisort($sort, SORT_ASC, $ret);
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public function storeContentSideFields($contentFields){
|
||||
$pos = 0;
|
||||
foreach ($contentFields as $data){
|
||||
|
||||
$data['user_id'] = \Auth::user()->id;
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
$data['search'] = isset($data['search']) ? true : false;
|
||||
|
||||
$data['pos'] = $pos++;
|
||||
|
||||
if(isset($data['settings'])){
|
||||
$data['settings'] = json_decode($data['settings']);
|
||||
}
|
||||
|
||||
/*if($data['id'] == null || $data['id'] == 0){
|
||||
$site_field = IQContentSiteField::create($data);
|
||||
}else {
|
||||
$site_field = IQContentSiteField::find($data['id']);
|
||||
$site_field->fill($data);
|
||||
$site_field->save();
|
||||
}
|
||||
if(isset($data['content'])){
|
||||
$site_field->setContent($data['content']);
|
||||
$site_field->save();
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue