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

This package is auto-updated.

Last update: 2024-09-14 17:59:04 UTC


README

Latest Version on Github Total Downloads

Vue AvatarLaravel Nova 的包装器

Screenshot

安装

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;
}),