Note.php 428 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Note extends Model
  5. {
  6. protected $table='notes';
  7. public function get_notes(){
  8. return $this->hasMany(Note::class,'user_id','user_id');
  9. }
  10. public function note_like(){
  11. return $this->hasOne(NoteLike::class,'note_id');
  12. }
  13. public function get_user(){
  14. return $this->hasOne(User::class,'id','user_id');
  15. }
  16. }