Skip to content

Instantly share code, notes, and snippets.

@Archakov06
Created March 28, 2018 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Archakov06/7f614521973725655314d755cf3c6dff to your computer and use it in GitHub Desktop.
Save Archakov06/7f614521973725655314d755cf3c6dff to your computer and use it in GitHub Desktop.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\User;
use App\Question;
use App\UploadedFile;
class Answer extends Model
{
protected $fillable = [
'text', 'question_id'
];
public function user()
{
return $this->belongsTo(User::class);
}
public function question()
{
return $this->belongsTo(Question::class);
}
public function files()
{
return $this->morphMany(UploadedFile::class, 'parent');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment