Aknaproff/app/FormData.php

57 lines
979 B
PHP
Raw Permalink Normal View History

2023-09-21 12:45:08 +00:00
<?php
namespace App;
2023-09-21 14:20:06 +00:00
use App\Traits\UsesUuid;
2023-09-21 12:45:08 +00:00
use Illuminate\Database\Eloquent\Model;
class FormData extends Model
{
2023-09-21 14:20:06 +00:00
use UsesUuid;
2023-09-21 12:45:08 +00:00
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'data' => 'array',
];
public static function sources()
{
return ['app'];
}
/**
* Get the form for the form data
*/
public function form()
{
return $this->belongsTo(\App\Form::class);
}
/**
* Get the submitted by for the form.
*/
public function submittedBy()
{
return $this->belongsTo(\App\User::class, 'submitted_by');
}
/**
* Get the form's comment
*/
public function comments()
{
return $this->hasMany(\App\FormDataComment::class, 'form_data_id');
}
}