first commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Comment extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'registration_id',
|
||||
'comment',
|
||||
];
|
||||
|
||||
/*
|
||||
|---------------------------
|
||||
| Relationships
|
||||
|---------------------------
|
||||
*/
|
||||
|
||||
// Comment belongs to a student
|
||||
public function registration()
|
||||
{
|
||||
return $this->belongsTo(Registration::class);
|
||||
}
|
||||
|
||||
/*
|
||||
|---------------------------
|
||||
| Helper methods
|
||||
|---------------------------
|
||||
*/
|
||||
|
||||
// Optional: short preview for UI
|
||||
public function getPreviewAttribute()
|
||||
{
|
||||
return strlen($this->comment) > 50
|
||||
? substr($this->comment, 0, 50) . '...'
|
||||
: $this->comment;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user