| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * @Author: etanasia | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @Date:   2017-11-28 00:17:29 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @Last Modified by:   etanasia | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @Last Modified time: 2017-11-28 09:44:35 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | namespace App; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Illuminate\Notifications\Notifiable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Illuminate\Database\Eloquent\SoftDeletes; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Illuminate\Database\Eloquent\Model; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | class ApiKeys extends Model | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     use Notifiable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     use SoftDeletes; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     protected $table = "api_keys"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     protected $dates = ['deleted_at']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     protected $fillable = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         'client', 'api_key', 'created_at', 'updated_at', 'user_id' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     public $hidden = ['created_at', 'updated_at']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     public function getUserName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         return $this->belongsTo('App\User','user_id','id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     public function getHistory() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         return $this->belongsTo('Jawaraegov\Workflows\Models\History','id','content_id')->with('getWorkflow')->with('getStateFrom')->with('getStateTo'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     public function getWorkflow() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         return $this->belongsTo('Jawaraegov\Workflows\Models\WorkflowModel', 'workflow_id', 'id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     public function getStateFrom() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         return $this->belongsTo('Jawaraegov\Workflows\Models\WorkflowState', 'from_state', 'id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 48 |  |  |     public function getStateTo() | 
            
                                                        
            
                                    
            
            
                | 49 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 50 |  |  |         return $this->belongsTo('Jawaraegov\Workflows\Models\WorkflowState', 'to_state', 'id'); | 
            
                                                        
            
                                    
            
            
                | 51 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 52 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 53 |  |  |  |