How to show name instead of avatar/black circle with initials?
I don't want avatar. I want the user name something like
Auth::user->name
I guess in the top right corner.
How to do that? Right now I have there a black circle with initials.Solution:Jump to solution
GitHub
GitHub - laravolt/avatar: Plug n play avatar, turn name, email, and...
Plug n play avatar, turn name, email, and any other string into beautiful avatar (or gravatar), effortless. - GitHub - laravolt/avatar: Plug n play avatar, turn name, email, and any other string i...
28 Replies
Is there any method to do that? Like
->avatar('name')
?
or ->avatar('email')
?I don't thinkso, you would need to disable the avatar and just add a render hook to render the users name.
I don't understand.
I don't want avatar. How to remove it and show my name or email instead?
In which file can I edit the visual representation of the top banner with the avatar and sway it for <div>{{ Auth::user->name }}</div> instead?
I don't even need a name of the user - it will be always me.
I want there perhaps just a log out button. No popup,drop down menu.
just a user name and a logout link
Why is such a simple thing so complicated?
š
I don't want avatars, I want {{ Auth::user->name }}
So just hide it with CSS and put in a custom render hook rendering your User Name blade and a logout button.
https://filamentphp.com/docs/3.x/support/render-hooks
https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme
This seems super complicated for me. I will probably just create my custom provider and generate an svg image with initials myself. https://stackoverflow.com/questions/28128491/center-text-in-circle-with-svg I don't understand why wouldn't it be done locally in the first place. Would it even work on intranet in an off-line mode - think some engineering factory with a filament backend for workers, etc.
Stack Overflow
Center text in circle with SVG
I'm trying to center text in a circle with SVG. The size of the text will be dynamic.
My code on Plunker:
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/
It can be done locally, if you want to keep the avatar you just simply add the getAvatar function to the user model and fetch it from whereever you want. But you specifically requested it to not render at all.
All of this is in the docs.
Yeah, but you use super advanced jargon and abstract terms. It's hard to understand you as a beginner.
It's fairly basic, not advanced jargon. You should understand the basics of PHP before using Laravel and Filamentphp.
I have been sucessfuly using Livewire, but Filament seems to be super abstract and hard to grasp and visualize.
It's all classes and implementations/interfaces
It's an abstracted approach yes, because it allows rapid functional development with crazy consistency throughtout.
If you have a decent IDE you will see all the layers, but the documentation explains everything fairly well.
evertyhing is overwritten and changed somewhere in the chain.
It's only overwritten when you want to change something
Yes, it's super opinionated.
for 95% it's great. But sometimes, like in this case
you spend a few hours solving such a thing that would be done in 2 minutes
in plain livewire/blade
component
But it's only not because you don't understand it.... I can do this is 2 minutes. You can't because you are not familiar with it.
Well, I doubt you wouldn't have to google svg
tags
Once you learn render hooks, you'll understand how powerfull it can be, again another learning curve
and how to center text and stuff
center text is easy? depending on where, ->alignCenter() again all explained in the docs
or ->extraAttributes(['class' => 'text-center'])
By the way, this is off topic but this is a nice link https://svg-tutorial.com/svg/basic-shapes
SVG Tutorial
Day 1: How to Draw Basic Shapes with SVG - SVG Tutorial
Learn how to draw basic shaped with SVG. In the first example we draw a Christmas Ornament with two circles and a rectangle element.
O saw it on hackernews a few days ago
SVG is super underrated
That is for basic shapes, but filament uses bladeicons so you can render any SVG from blade icons.
Yeah I will need to create a circle and put
the initials there
nothing fancy.
I think I will be able to do it in a few minutes or so
Solution
GitHub
GitHub - laravolt/avatar: Plug n play avatar, turn name, email, and...
Plug n play avatar, turn name, email, and any other string into beautiful avatar (or gravatar), effortless. - GitHub - laravolt/avatar: Plug n play avatar, turn name, email, and any other string i...
OK, thanks I will look at it.
Try that example you linked. It's not working š
I am trying the laravolt/avatar now though. It can do svg. So perhaps it will be the solution for now.
Hopefully it will work with Filament 3
Hmm, I don't know how to make it with FIlament š Will ask in another question.
you spend a few hours solving such a thing that would be done in 2 minutes in plain livewire/bladeThat's the down side of every abstraction layer.
@toeknee Laravolt/avatar seems to be working nicely - it seems to not trigger any external URLs.
Just be careful to import the right file so don't import this in your custom provider file:
But import this instead: