Chatter-Laravel / core

The Laravel single page forum package (Vue + Tailwind CSS + Laravel)
MIT License
159 stars 39 forks source link

Change profile avatar | config/chatter.php not work #23

Closed Dhaoui0Chaher closed 4 years ago

Dhaoui0Chaher commented 4 years ago

I'm working with chatter forum with laravel 6 and I have a problem.

the Problem: chatter use avatars for the profiles photo's, how I can change that to use images links in the database? I tried to change the Config/chatter.php but still not work

 'user' => [
        'namespace'                     => 'App\User',
        'database_field_with_user_name' => 'name',
        'relative_url_to_profile'       => '',
        'relative_url_to_image_assets'  => '/public/storage/',
        'avatar_image_database_field'   => 'avatar',
    ],
sbarbat commented 4 years ago

@Dhaoui0Chaher just override the public function getForumAvatarAttribute(): string method from CanDiscuss.php in your User model

Dhaoui0Chaher commented 4 years ago

I deleted the public function getForumAvatarAttribute(): string and still not work I save images in storage, what should I do? I tried to change the chatter/src/views/discussion.blade.php <img src="{{ Config::get('chatter.user.relative_url_to_image_assets') . $post->user->{$db_field} }}"> to <img src="<?php echo asset("storage/$post->user->{$db_field} ")?>"> and to <img src="<?php echo asset("storage/$post->user->avatar")?>"> and not work

sbarbat commented 4 years ago

No, just override the function to return whatever you want, don't delete it.

Your user model:


public function getForumAvatarAttribute(): string {
    return "the image URL you want to return";
}

Do not try to change old chatter views, since they aren't used, it's all Vuejs.