| 
									
										
										
										
											2018-04-17 01:35:01 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace App; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use Illuminate\Database\Eloquent\Model; | 
					
						
							| 
									
										
										
										
											2018-06-14 00:52:42 +00:00
										 |  |  | use Illuminate\Database\Eloquent\SoftDeletes; | 
					
						
							| 
									
										
										
										
											2018-04-17 01:35:01 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class Like extends Model | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-06-14 00:52:42 +00:00
										 |  |  |     use SoftDeletes; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The attributes that should be mutated to dates. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     protected $dates = ['deleted_at']; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 01:35:01 +00:00
										 |  |  |     public function actor() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-05-27 02:26:44 +00:00
										 |  |  |       return $this->belongsTo(Profile::class, 'profile_id', 'id'); | 
					
						
							| 
									
										
										
										
											2018-04-17 01:35:01 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function status() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       return $this->belongsTo(Status::class); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-05-27 02:26:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     public function toText() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       $actorName = $this->actor->username; | 
					
						
							|  |  |  |       return "{$actorName} " . __('notification.likedPhoto'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function toHtml() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       $actorName = $this->actor->username; | 
					
						
							|  |  |  |       $actorUrl = $this->actor->url(); | 
					
						
							|  |  |  |       return "<a href='{$actorUrl}' class='profile-link'>{$actorName}</a> " . | 
					
						
							|  |  |  |           __('notification.likedPhoto'); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-04-17 01:35:01 +00:00
										 |  |  | } |