Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Message.php 823B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Model\Raharja;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Message extends Model
  5. {
  6. //protected $connection = 'connection-name'; //jika menggunakan 2 DB modelnya harus dikasih ini
  7. //protected $primaryKey = 'your_key_name'; // set primarykeymu jika bukan ID
  8. protected $table = 'message';
  9. protected $fillable = [
  10. 'category_message_id',
  11. 'title',
  12. 'content',
  13. 'user_id',
  14. ];
  15. public function userReceive(){
  16. return $this->hasMany(UserReceive::class, 'message_id', 'id');
  17. }
  18. public function categoryMessage(){
  19. return $this->belongsTo(CategoryMesssage::class, 'category_message_id', 'id');
  20. }
  21. //public $incrementing = false; //jika primary keynya string
  22. //public $timestamps = false; //matiin created_at, updated_at
  23. }