12345678910111213141516171819202122232425262728 |
- <?php
-
- namespace App\Model\Raharja;
-
- use Illuminate\Database\Eloquent\Model;
-
- class Message extends Model
- {
- //protected $connection = 'connection-name'; //jika menggunakan 2 DB modelnya harus dikasih ini
- //protected $primaryKey = 'your_key_name'; // set primarykeymu jika bukan ID
- protected $table = 'message';
- protected $fillable = [
- 'category_message_id',
- 'title',
- 'content',
- 'user_id',
- ];
-
- public function userReceive(){
- return $this->hasMany(UserReceive::class, 'message_id', 'id');
- }
-
- public function categoryMessage(){
- return $this->belongsTo(CategoryMesssage::class, 'category_message_id', 'id');
- }
- //public $incrementing = false; //jika primary keynya string
- //public $timestamps = false; //matiin created_at, updated_at
- }
|