| 123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\ModelTimeFormat;
- use Illuminate\Support\Str;
- class Log extends Model
- {
- use ModelTimeFormat;
- protected $fillable = [
- 'operation', 'description','type', 'operator', 'ip','id_user','created_at','updated_at'
- ];
- public function getUserNameAttribute(){
- $idUser=$this['id_user'];
- if($idUser){
- $user=User::find($idUser);
- return $user['name'];
- }
- return '';
- }
- public function getExceptionMarkAttribute(){
- if (Str::upper(substr($this->type,0,1)) != 'E')return 'N';
- if (Str::upper(substr($this->type,0,5)) == 'ERROR' || Str::upper(substr($this->type,0,9)) == 'EXCEPTION')
- return 'Y';
- return 'N';
- }
- // function getDetailAttribute(): string
- // {
- // return 'abc';
- // }
- }
|