Advertisement
claudious

UF hard delete issue

Apr 8th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. class LaravelModel {
  4.     public function delete() {
  5.         echo 'LaravelModel';
  6.     }
  7. }
  8.  
  9. class UserFrostingModel extends LaravelModel {
  10.     public function delete() {
  11.         echo 'UserFrostingModel';
  12.     }
  13. }
  14.  
  15. trait SoftDeletes {
  16.     public function delete() {
  17.         echo 'SoftDeletes';
  18.     }
  19. }
  20.  
  21. class User extends UserFrostingModel {
  22.     use SoftDeletes;
  23.  
  24.     public function myDelete(){
  25.         parent::delete();
  26.         echo "\n";
  27.         $this->delete();
  28.     }
  29.     // Uncommenting here and the calling this method starts a looop (don't know why)
  30.     // public function delete(){
  31.     //     parent::delete();
  32.     //     echo "\n";
  33.     //     $this->delete();
  34.     // }
  35. }
  36.  
  37. $user = new User();
  38. $user->myDelete();
  39. //$user->delete();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement