| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Created by Reliese Model. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Date: Thu, 12 Jul 2018 22:39:27 +0000. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | namespace App\Models\Lookup; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use App\Models\BaseModel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Backpack\CRUD\app\Models\Traits\CrudTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * Class Department | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @property int $id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * @property string $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * @property string $impact | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * @property string $preference | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @property \Jenssegers\Date\Date $created_at | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * @property \Jenssegers\Date\Date $updated_at | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * @property \Illuminate\Database\Eloquent\Collection $managers | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  * @property \Illuminate\Database\Eloquent\Collection $job_posters | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  * Localized Properties: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  * @property string $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  * @property string $impact | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  * @property string $preference | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  * Methods | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  * @method mixed[] toApiArray() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | class Department extends BaseModel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     use CrudTrait; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     use HasTranslations; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @var $translatable string[] | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |      * */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     public $translatable = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         'name', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         'impact', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         'preference', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @var $fillable string[] | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     protected $fillable = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         'name', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         'impact', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         'preference', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     ]; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |     public function managers() // phpcs:ignore | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |         return $this->hasMany(\App\Models\Manager::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     public function job_posters() // phpcs:ignore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         return $this->hasMany(\App\Models\JobPoster::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * Return the array of values used to represent this object in an api response. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * @return mixed[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     public function toApiArray() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         $deptArray = ['id' => $this->id]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         foreach (['en', 'fr'] as $locale) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |             $deptArray[$locale] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |                 'name' => $this->getTranslation('name', $locale), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |                 'impact' => $this->getTranslation('impact', $locale), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |             ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         return $deptArray; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 85 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 86 |  |  |  |