Payback.php 432 B

1234567891011121314151617181920
  1. <?php
  2. namespace App\Models;
  3. class Payback extends Model
  4. {
  5. protected $connection = "default";
  6. protected $table = 'payback';
  7. public function user()
  8. {
  9. $user = User::where("id", $this->attributes['userid'])->first();
  10. if ($user == null) {
  11. Bought::where('id', '=', $this->attributes['id'])->delete();
  12. return null;
  13. } else {
  14. return $user;
  15. }
  16. }
  17. }