我正在通过访问器和更改器对Laravel中的DB字段值进行加密/解密,这在正常的雄辩事务中运行正常。
class Person extends Model
{
use Notifiable;
protected $table = 'person';
public function getFirstNameAttribute($value)
{
return Crypt::decryptString($value);
}
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $guarded = array();
protected function user()
{
return $this->belongsTo('App\Models\User', 'useraccount_id', 'id');
}
}
Run Code Online (Sandbox Code Playgroud)
但是加密和解密在以下情况下不起作用
工作中
$person = Person::find($person_id);
$person->firstName;
Run Code Online (Sandbox Code Playgroud)
无法运作
$user = User::find($user_id);
$user->person->firstName;
Run Code Online (Sandbox Code Playgroud) 在角度4中集成typed.js时,我得到以下错误.错误TypeError:WEBPACK_IMPORTED_MODULE_2_typed_js .Typed不是构造函数
我的组件是:
import { Component, OnInit } from '@angular/core';
import { Typed } from 'typed.js';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
ngOnInit() {
let options = {
strings: ["Books.", "Cinema.", "Paintings.","Music."],
typeSpeed: 100,
backSpeed: 100,
showCursor: true,
cursorChar: "|",
loop:true
}
let typed = new Typed(".typing-element", options);
}
}
Run Code Online (Sandbox Code Playgroud)
我的Html是
<div class="container">
<div class="home-header-title">
<span class="title">what you like </span>
<span class="typing-element"></span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)