Travel Guide Frontend Backend
This commit is contained in:
parent
e6cc042aee
commit
0857a34766
681 changed files with 6680 additions and 1689 deletions
96
app/Models/AnswerQuestion.php
Normal file
96
app/Models/AnswerQuestion.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class AnswerQuestion
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $question
|
||||
* @property string $question_text
|
||||
* @property string $answer
|
||||
* @property string $answer_text
|
||||
* @property bool $active
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereAnswer($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereAnswerText($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereQuestion($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereQuestionText($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\IQContentFaq[] $iq_content_faq
|
||||
* @property-read int|null $iq_content_faq_count
|
||||
* @property int|null $i_q_content_category_id
|
||||
* @property-read \App\Models\IQContentCategory|null $iq_content_category
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnswerQuestion whereIQContentCategoryId($value)
|
||||
*/
|
||||
class AnswerQuestion extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'answer_questions';
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'i_q_content_category_id',
|
||||
'question',
|
||||
'question_text',
|
||||
'answer',
|
||||
'answer_text',
|
||||
'active'
|
||||
];
|
||||
|
||||
public function iq_content_category()
|
||||
{
|
||||
return $this->belongsTo(IQContentCategory::class, 'i_q_content_category_id');
|
||||
}
|
||||
|
||||
public function iq_content_faq()
|
||||
{
|
||||
return $this->hasMany(IQContentFaq::class, 'faq_id', 'id');
|
||||
}
|
||||
|
||||
public static function getSiteOptions($id, $identifier, $html = true, $choose = true) {
|
||||
|
||||
$values = [];
|
||||
$ret = "";
|
||||
$models = AnswerQuestion::with('iq_content_category')->select('answer_questions.*')->where('answer_questions.active', 1)//->where('iq_content_category.identifier', $identifier)
|
||||
->whereHas('iq_content_category', function ($q) use ($identifier) {
|
||||
$q->where('slug', 'reisefuehrer');
|
||||
})->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->question . '</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}else{
|
||||
foreach ($models as $model) {
|
||||
$values[$model->id] = $model->question;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue