mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 03:07:30 -04:00 
			
		
		
		
	Always load user even if they're deleted
This commit is contained in:
		
							parent
							
								
									d9af83fd54
								
							
						
					
					
						commit
						44d46a01ab
					
				| @ -19,6 +19,6 @@ class AccountToken extends EntityModel | |||||||
| 
 | 
 | ||||||
|     public function user() |     public function user() | ||||||
|     { |     { | ||||||
|         return $this->belongsTo('App\Models\User'); |         return $this->belongsTo('App\Models\User')->withTrashed(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ class Contact extends EntityModel implements AuthenticatableContract, CanResetPa | |||||||
| 
 | 
 | ||||||
|     public function user() |     public function user() | ||||||
|     { |     { | ||||||
|         return $this->belongsTo('App\Models\User'); |         return $this->belongsTo('App\Models\User')->withTrashed(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function client() |     public function client() | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ class Credit extends EntityModel | |||||||
| { | { | ||||||
|     use SoftDeletes; |     use SoftDeletes; | ||||||
|     use PresentableTrait; |     use PresentableTrait; | ||||||
|      | 
 | ||||||
|     protected $dates = ['deleted_at']; |     protected $dates = ['deleted_at']; | ||||||
|     protected $presenter = 'App\Ninja\Presenters\CreditPresenter'; |     protected $presenter = 'App\Ninja\Presenters\CreditPresenter'; | ||||||
| 
 | 
 | ||||||
| @ -19,7 +19,7 @@ class Credit extends EntityModel | |||||||
| 
 | 
 | ||||||
|     public function user() |     public function user() | ||||||
|     { |     { | ||||||
|         return $this->belongsTo('App\Models\User'); |         return $this->belongsTo('App\Models\User')->withTrashed(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function invoice() |     public function invoice() | ||||||
| @ -59,9 +59,9 @@ class Credit extends EntityModel | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Credit::creating(function ($credit) { | Credit::creating(function ($credit) { | ||||||
|      | 
 | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| Credit::created(function ($credit) { | Credit::created(function ($credit) { | ||||||
|     event(new CreditWasCreated($credit)); |     event(new CreditWasCreated($credit)); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -86,7 +86,7 @@ class Document extends EntityModel | |||||||
| 
 | 
 | ||||||
|     public function user() |     public function user() | ||||||
|     { |     { | ||||||
|         return $this->belongsTo('App\Models\User'); |         return $this->belongsTo('App\Models\User')->withTrashed(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function expense() |     public function expense() | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ class Expense extends EntityModel | |||||||
| 
 | 
 | ||||||
|     public function user() |     public function user() | ||||||
|     { |     { | ||||||
|         return $this->belongsTo('App\Models\User'); |         return $this->belongsTo('App\Models\User')->withTrashed(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function vendor() |     public function vendor() | ||||||
| @ -90,13 +90,13 @@ class Expense extends EntityModel | |||||||
|     { |     { | ||||||
|         return round($this->amount * $this->exchange_rate, 2); |         return round($this->amount * $this->exchange_rate, 2); | ||||||
|     } |     } | ||||||
|      | 
 | ||||||
|     public function toArray() |     public function toArray() | ||||||
|     { |     { | ||||||
|         $array = parent::toArray(); |         $array = parent::toArray(); | ||||||
|          | 
 | ||||||
|         if(empty($this->visible) || in_array('converted_amount', $this->visible))$array['converted_amount'] = $this->convertedAmount(); |         if(empty($this->visible) || in_array('converted_amount', $this->visible))$array['converted_amount'] = $this->convertedAmount(); | ||||||
|          | 
 | ||||||
|         return $array; |         return $array; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ class Task extends EntityModel | |||||||
| 
 | 
 | ||||||
|     public function user() |     public function user() | ||||||
|     { |     { | ||||||
|         return $this->belongsTo('App\Models\User'); |         return $this->belongsTo('App\Models\User')->withTrashed(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function client() |     public function client() | ||||||
| @ -91,4 +91,4 @@ class Task extends EntityModel | |||||||
|     { |     { | ||||||
|         return round($this->getDuration() / (60 * 60), 2); |         return round($this->getDuration() / (60 * 60), 2); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -87,7 +87,7 @@ class Vendor extends EntityModel | |||||||
| 
 | 
 | ||||||
|     public function user() |     public function user() | ||||||
|     { |     { | ||||||
|         return $this->belongsTo('App\Models\User'); |         return $this->belongsTo('App\Models\User')->withTrashed(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function payments() |     public function payments() | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ class VendorContact extends EntityModel | |||||||
|     use SoftDeletes; |     use SoftDeletes; | ||||||
|     protected $dates = ['deleted_at']; |     protected $dates = ['deleted_at']; | ||||||
|     protected $table = 'vendor_contacts'; |     protected $table = 'vendor_contacts'; | ||||||
|      | 
 | ||||||
|     protected $fillable = [ |     protected $fillable = [ | ||||||
|         'first_name', |         'first_name', | ||||||
|         'last_name', |         'last_name', | ||||||
| @ -30,7 +30,7 @@ class VendorContact extends EntityModel | |||||||
| 
 | 
 | ||||||
|     public function user() |     public function user() | ||||||
|     { |     { | ||||||
|         return $this->belongsTo('App\Models\User'); |         return $this->belongsTo('App\Models\User')->withTrashed(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function vendor() |     public function vendor() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user