marispro / nova-vue-avatar
Vue Avatar (https://eliep.github.io/vue-avatar/) 是 Laravel Nova (https://nova.laravel.net.cn/) 的字段包装器
0.6
2022-03-14 12:30 UTC
Requires
- php: >=7.1.0
README
Vue Avatar 是 Laravel Nova 的包装器
安装
composer require marispro/nova-vue-avatar
用法
<?php
namespace App\Nova;
use Marispro\NovaVueAvatar\NovaVueAvatar as Avatar;
class User extends Resource
{
public function fields()
{
return [
Avatar::make('Name', 'Avatar'), // by default field - Name, column name - Avatar (optional)
->rounded(false) // disable rounded corners (optional, default: true)
->size() // set avatar size (optional, default: 40)
->image('https://eliep.github.io/vue-avatar/static/darth-vader.png'), // specify avatar as image (optional)
->color('#fff') // specify text color (optional, default: white)
];
}
}
计算属性
Avatar::make(function($user){
return $user->firstname . ' ' . $user->lastname;
}),