Booking, QI Content, Trees, Media

This commit is contained in:
Kevin Adametz 2019-10-02 20:03:55 +02:00
parent 1f340e96fa
commit 7fbac395a9
260 changed files with 27160 additions and 3773 deletions

View file

@ -43,6 +43,10 @@ use Illuminate\Support\Str;
* @method static \Illuminate\Database\Query\Builder|\App\Models\IQContentTree withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\IQContentTree withoutTrashed()
* @mixin \Eloquent
* @property int|null $page_id
* @property int|null $root_id
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IQContentTree wherePageId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IQContentTree whereRootId($value)
*/
class IQContentTree extends Model
{
@ -83,4 +87,29 @@ class IQContentTree extends Model
}
}
public static function getTreesOptions($id = false, $html = true, $choose = true) {
$values = [];
$ret = "";
$models = IQContentTree::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 . '</option>\n';
}
return $ret;
}else{
foreach ($models as $model) {
$values[$model->id] = $model->name;
}
return $values;
}
return false;
}
}