Change admin panel logo with spatie-setting package
how to change admin panel logo with spatie-setting value
26 Replies
Call the settings logo where the logo is and change it?
how we exactly do it?
use a uploadfield in your settings
something like this
and you can use this in a the logo blade file something like this
may i know where this image logo save?
Depens what your storage is.
https://filamentphp.com/docs/3.x/forms/fields/file-upload
i will check and test it
thank you
I already test it using the code you provide but still keep loading when i click Save changes the loading don't stop, but when i check the storage/app/public the logo is save there
FileUpload::make('logo')
->image()
->imagePreviewHeight('72')
->panelLayout('integrated')
->previewable(true)
->getUploadedFileNameForStorageUsing(
fn (TemporaryUploadedFile $file): string => (string) str('CompanySettingsLogo.'.$file->guessExtension())
),
it create this file CompanySettingsLogo.png
Have you done this : https://laravel.com/docs/10.x/filesystem#the-public-disk
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
i will check it thank you
btw how exactly i will use this to display the image
<img src="{{ app(CompanySettings::class)->logo }}" alt="Company Logo" >
i have error
GitHub
GitHub - spatie/laravel-settings: Store strongly typed application ...
Store strongly typed application settings. Contribute to spatie/laravel-settings development by creating an account on GitHub.
Take a look if this helps you
https://discord.com/channels/883083792112300104/1181091809691193417/1189249320453673052
i will check it thank you
just curious is Spartie Settings plugin really work?
I try to follow the docs using the controller but it's not working
i got this error even i already use the controller from docs
Error: Undefined variable $site_name
class GeneralSettingsController
{
public function show(GeneralSettings $settings){
return view('settings.show', [
'site_name' => $settings->site_name,
'site_active' => $settings->site_active
]); } I even try this controller class IndexController { public function __invoke(GeneralSettings $settings){ return view('index', [ 'site_name' => $settings->site_name, ]); } }
]); } I even try this controller class IndexController { public function __invoke(GeneralSettings $settings){ return view('index', [ 'site_name' => $settings->site_name, ]); } }
Have you created migrations, and correctly followd the steps to install and use this package?
yes i am
my i only issue is showing the data on the view page like welcome page title
@jay02k Can you share the settings class and the settings.php config file
<?php
namespace App\Settings;
use Spatie\LaravelSettings\Settings;
class AdminSettings extends Settings
{
public string $site_name;
public bool $site_active;
public string $site_copyright;
public string $site_logo;
public string $site_favicon;
public static function group(): string
{
return 'admin';
}
}
This wont work if you have AdminSettings and not GeneralSettings
the code i send is already modified with admin
this is my new controller
<?php
namespace App\Http\Controllers;
use App\Settings\AdminSettings;
use Illuminate\Http\Request;
class SettingsController extends Controller
{
public function show(AdminSettings $settings){
return view('welcome', [
'site_name' => $settings->site_name
]);
}
}
this is where i want to display it on welcome page
<title> {{ $site_name }} </title>
and your settings.php config file?
Are the values stored in the database?
yes all are good it save on the settings page and database
Can you check if this works
ok
still same error Undefined variable $site_name
Can you share the Github Repo please?
its private
about that image preview is that a bugs?
because i make it a preview ->previewable(true) but the image not showing?
I have send you a PM.