Created API endpoints
This commit is contained in:
45
app/Models/Questionnaire.php
Normal file
45
app/Models/Questionnaire.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Questionnaire extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The attributes that should be mutated to dates.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dates = [
|
||||
'updated_at',
|
||||
'released_at',
|
||||
'created_at',
|
||||
'closed_at',
|
||||
'reviewed_at',
|
||||
'deleted_at'
|
||||
];
|
||||
|
||||
public function sections()
|
||||
{
|
||||
return $this->hasMany(Section::class);
|
||||
}
|
||||
|
||||
public function questions()
|
||||
{
|
||||
return $this->hasManyThrough(Question::class, Section::class);
|
||||
}
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user