How to handle visual changes across Bagisto environments? #15
-
|
Hi! I want to keep all my visual modifications (especially anything done with bagisto visual) in my code. I'd like to push these updates via my code repo, without having to mess around with exporting and importing database stuff every time. Is it possible to save these visual changes to files (like Blade templates or some JSON config) instead of just staying in the database? Or is there any other recommended way to handle this for a smoother deployment flow? PHP: 8.2.12 Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi! Great question. Actually, bagisto visual does not store any data in the database. Here how you can do it: Step 1 - Publish the Config Filephp artisan vendor:publish --tag=visual-configThis will create config/bagisto_visual.php. with the following content: return [
'data_path' => storage_path('bagisto-visual'),
'images_storage' => 'public',
'images_directory' => 'bagisto-visual/images',
];Step 1 - Configure config/bagisto_visual.phpUpdate the config with custom values like so: Step 3 - Add a custom disk in config/filesystems.php'disks' => [
// ... existing disks ...
'visual' => [
'driver' => 'local',
'root' => base_path('visual/uploads'),
'url' => env('APP_URL') . '/visual-uploads',
'visibility' => 'public',
],
],Step 4 - Register a symlink in config/filesystems.php 'links' => [
public_path('storage') => storage_path('app/public'),
public_path('visual-uploads') => base_path('visual/uploads'), // <----
],and make sure the directories exists mkdir -p visual/data
mkdir -p visual/uploads/imagesThen create the symlink: (this should be done on each env) php artisan storage:linkStep 5 - Update config/imagecache.phpAdd base_path('visual/uploads/images') to the paths array: 'paths' => [
storage_path('app/public'),
public_path('storage'),
base_path('visual/uploads/images'), // <----
],Step 6 - Migrate existing visual data & images# Move visual data files
mv storage/bagisto-visual/* visual/data/
# Move uploaded images
mv storage/app/public/bagisto-visual/images/* visual/uploads/images/Now you can just add visual/ to your git index and all changes made can be versioned. Make sure to update to the latest version of bagisto visual. |
Beta Was this translation helpful? Give feedback.
Hi! Great question.
I planned to add a documentation section for this, but didn't have time to do it.
Actually, bagisto visual does not store any data in the database.
All visual changes are saved to disk. By default changes are stored in storage/bagisto-visual, but you can configure a custom directory where the changes are saved.
Here how you can do it:
Step 1 - Publish the Config File
This will create config/bagisto_visual.php.
with the following content:
Step 1 - Configure config/bagisto_visua…