Created
March 28, 2018 22:11
-
-
Save Archakov06/7f614521973725655314d755cf3c6dff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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