Code.php 619 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Notifications\Notifiable;
  5. class Code extends Model
  6. {
  7. use Notifiable{
  8. notify as protected laravelNotify;
  9. }
  10. protected $table='code';
  11. public function get_user(){
  12. return $this->belongsTo(User::class,'user_id');
  13. }
  14. public function user(){
  15. return $this->belongsTo(User::class,'user_id');
  16. }
  17. public function enroll(){
  18. return $this->belongsTo(Code::class,'user_id','user_id');
  19. }
  20. public function notify($instance)
  21. {
  22. $this->laravelNotify($instance);
  23. }
  24. }