Tree Travel Guide
This commit is contained in:
parent
a1ca534f55
commit
1f340e96fa
78 changed files with 4133 additions and 1027 deletions
|
|
@ -36,6 +36,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelGuide whereText($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelGuide whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelGuide newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelGuide newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelGuide query()
|
||||
*/
|
||||
class TravelGuide extends Model
|
||||
{
|
||||
|
|
@ -55,9 +58,10 @@ class TravelGuide extends Model
|
|||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'slug', 'text', 'full_text', 'meta_title', 'meta_description', 'meta_keywords', 'pos', 'scope', 'active',
|
||||
'tree_node_id', 'name', 'slug', 'text', 'full_text', 'keyword', 'meta_title', 'meta_description', 'meta_keywords', 'pos', 'scope', 'active',
|
||||
];
|
||||
|
||||
|
||||
public function sluggable()
|
||||
{
|
||||
return [
|
||||
|
|
@ -67,6 +71,13 @@ class TravelGuide extends Model
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
public function iq_content_tree_node()
|
||||
{
|
||||
return $this->belongsTo('App\Models\IQContentTreeNode', 'tree_node_id');
|
||||
}
|
||||
|
||||
|
||||
public static function getScopeOptions($setKey = false){
|
||||
$options = self::$scopes;
|
||||
$ret = "";
|
||||
|
|
@ -82,5 +93,29 @@ class TravelGuide extends Model
|
|||
}
|
||||
|
||||
|
||||
public static function getSiteOptions($id = false, $html = true, $choose = true) {
|
||||
|
||||
$values = [];
|
||||
$ret = "";
|
||||
$models = TravelGuide::where('active', 1)->get();
|
||||
|
||||
if($html) {
|
||||
if($choose){
|
||||
$ret .= '<option value="">Bitte wählen</option>\n';
|
||||
}
|
||||
foreach ($models as $model) {
|
||||
$attr = ($model->id == $id) ? ' selected="selected"' : '';
|
||||
$ret .= '<option value="' . $model->id . '"' . $attr . '>' . $model->name . ' ('.$model->getScopeName($model->scope).')</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}else{
|
||||
foreach ($models as $model) {
|
||||
$values[$model->id] = $model->name;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue