Adding bread to voyager

Solved
kaprinkey1

Sep 24th, 2023 05:07 PM

Hello,

I am reaching out today because it seems no matter what I do, adding my tables as bread works and able to edit the bread but cannot browse to it like you can posts, pages, and etc. When I try to browse the bread for my stores table it takes me to a custom front end page that I wrote? No matter what I do is still goes to that page. I even commented out my custom routes thinking that might be it. Nope, didnt work either. I wanted to use the bread because my business partner is not a developer and needs a way to enter data in voyager.

I could write a custom admin panel but that defeats the purpose lol.

Any help would be appreciated.

bobbyiliev

Sep 25th, 2023 01:52 AM

Hi there,

Just to clarify, is it the browse button in the Voyager Admin that you are referring to? Eg, the /admin/stores/{id} route:

Or is it a custom browse page that you've created?

Here are steps to diagnose and possibly resolve the issue:

  1. Check Voyager Routes File: Ensure that your Voyager routes are being loaded. Check the routes/web.php file and ensure that you have:

    Voyager::routes();
    
  2. Order of Routes: In Laravel, the order of routes matters. Make sure you define your custom routes after Voyager::routes(); in routes/web.php. This ensures that Voyager routes will take precedence over any conflicting custom routes.

  3. Route Caching: If you've used route caching (php artisan route:cache), it's possible you're seeing the cached routes. Clear the route cache and try again:

    php artisan route:clear
    

Let me know if any of those help!

kaprinkey1

Sep 25th, 2023 06:34 AM

Yes sir, I am referring to the voyager browse button after you add bread to a table. I know voyager creates the route for you when you create the bread and I though it had to be 1 a unique slug and 2, it has to match the table name i thought.

I have custom routes for /stores prefixed in a custom web.php that is called in the main web.php, below the wave and voyager routes. When you create the bread it asks for a unique slug but also thought it had to be the plural version of the table name. However, I looked it up and the slug can be anything I guess so long as its unique.

I had already tried all of that before creating this post

bobbyiliev

Sep 25th, 2023 07:36 AM

What I could suggest in this case is to run php artisan route:list | grep stores in your terminal.

This will show you all the routes associated with 'stores' and might give you a clue about any unexpected routes.

This will also help you pinpoint which route might be getting in the way of the Voyager browse routes.

kaprinkey1

Sep 25th, 2023 08:10 AM

I will do that. Thank you for that. We learn something new everyday!

kaprinkey1

Sep 25th, 2023 08:31 AM

I ran the command and believe i found the issue. Below are my listed routes

shop4charities.org_9fnlffgw5fp@server:~/httpdocs$ php artisan route:list

  GET|HEAD        / ............. wave.home › Wave\Http\Controllers\HomeController@index
  GET|HEAD        @{username} wave.profile › Wave\Http\Controllers\ProfileController@in…
  GET|HEAD        _dusk/login/{userId}/{guard?} dusk.login › Laravel\Dusk › UserControl…
  GET|HEAD        _dusk/logout/{guard?} dusk.logout › Laravel\Dusk › UserController@log…
  GET|HEAD        _dusk/user/{guard?} ... dusk.user › Laravel\Dusk › UserController@user
  POST            _ignition/execute-solution ignition.executeSolution › Spatie\LaravelI…
  GET|HEAD        _ignition/health-check ignition.healthCheck › Spatie\LaravelIgnition …
  POST            _ignition/update-config ignition.updateConfig › Spatie\LaravelIgnitio…
  GET|HEAD        admin ...... voyager.dashboard › TCG\Voyager › VoyagerController@index
  GET|HEAD        admin/announcements voyager.announcements.index › TCG\Voyager › Voyag…
  POST            admin/announcements voyager.announcements.store › TCG\Voyager › Voyag…
  POST            admin/announcements/action voyager.announcements.action › TCG\Voyager…
  GET|HEAD        admin/announcements/create voyager.announcements.create › TCG\Voyager…
  GET|HEAD        admin/announcements/order voyager.announcements.order › TCG\Voyager  …
  POST            admin/announcements/order voyager.announcements.update_order › TCG\Vo…
  GET|HEAD        admin/announcements/relation voyager.announcements.relation › TCG\Voy…
  POST            admin/announcements/remove voyager.announcements.media.remove › TCG\V…
  GET|HEAD        admin/announcements/{id} voyager.announcements.show › TCG\Voyager › V…
  PUT|PATCH       admin/announcements/{id} voyager.announcements.update › TCG\Voyager  …
  DELETE          admin/announcements/{id} voyager.announcements.destroy › TCG\Voyager …
  GET|HEAD        admin/announcements/{id}/edit voyager.announcements.edit › TCG\Voyage…
  GET|HEAD        admin/announcements/{id}/restore voyager.announcements.restore › TCG\…
  GET|HEAD        admin/bread voyager.bread.index › TCG\Voyager › VoyagerBreadControlle…
  POST            admin/bread voyager.bread.store › TCG\Voyager › VoyagerBreadControlle…
  GET|HEAD        admin/bread/delete_relationship/{id} voyager.bread.delete_relationshi…
  POST            admin/bread/relationship voyager.bread.relationship › TCG\Voyager › V…
  PUT             admin/bread/{id} voyager.bread.update › TCG\Voyager › VoyagerBreadCon…
  DELETE          admin/bread/{id} voyager.bread.delete › TCG\Voyager › VoyagerBreadCon…
  GET|HEAD        admin/bread/{table}/create voyager.bread.create › TCG\Voyager › Voyag…
  GET|HEAD        admin/bread/{table}/edit voyager.bread.edit › TCG\Voyager › VoyagerBr…
  GET|HEAD        admin/categories voyager.categories.index › TCG\Voyager › VoyagerBase…
  POST            admin/categories voyager.categories.store › TCG\Voyager › VoyagerBase…
  POST            admin/categories/action voyager.categories.action › TCG\Voyager › Voy…
  GET|HEAD        admin/categories/create voyager.categories.create › TCG\Voyager › Voy…
  GET|HEAD        admin/categories/order voyager.categories.order › TCG\Voyager › Voyag…
  POST            admin/categories/order voyager.categories.update_order › TCG\Voyager …
  GET|HEAD        admin/categories/relation voyager.categories.relation › TCG\Voyager  …
  POST            admin/categories/remove voyager.categories.media.remove › TCG\Voyager…
  GET|HEAD        admin/categories/{id} voyager.categories.show › TCG\Voyager › Voyager…
  PUT|PATCH       admin/categories/{id} voyager.categories.update › TCG\Voyager › Voyag…
  DELETE          admin/categories/{id} voyager.categories.destroy › TCG\Voyager › Voya…
  GET|HEAD        admin/categories/{id}/edit voyager.categories.edit › TCG\Voyager › Vo…
  GET|HEAD        admin/categories/{id}/restore voyager.categories.restore › TCG\Voyage…
  GET|HEAD        admin/compass voyager.compass.index › TCG\Voyager › VoyagerCompassCon…
  POST            admin/compass voyager.compass.post › TCG\Voyager › VoyagerCompassCont…
  GET|HEAD        admin/database voyager.database.index › TCG\Voyager › VoyagerDatabase…
  POST            admin/database voyager.database.store › TCG\Voyager › VoyagerDatabase…
  GET|HEAD        admin/database/create voyager.database.create › TCG\Voyager › Voyager…
  GET|HEAD        admin/database/{database} voyager.database.show › TCG\Voyager › Voyag…
  PUT|PATCH       admin/database/{database} voyager.database.update › TCG\Voyager › Voy…
  DELETE          admin/database/{database} voyager.database.destroy › TCG\Voyager › Vo…
  GET|HEAD        admin/database/{database}/edit voyager.database.edit › TCG\Voyager › …
  GET|HEAD        admin/do .............................................................
  GET|HEAD        admin/login voyager.login › TCG\Voyager › VoyagerAuthController@login
  POST            admin/login voyager.postlogin › TCG\Voyager › VoyagerAuthController@p…
  POST            admin/logout . voyager.logout › TCG\Voyager › VoyagerController@logout
  GET|HEAD        admin/media voyager.media.index › TCG\Voyager › VoyagerMediaControlle…
  POST            admin/media/crop voyager.media.crop › TCG\Voyager › VoyagerMediaContr…
  POST            admin/media/delete_file_folder voyager.media.delete › TCG\Voyager › V…
  POST            admin/media/files voyager.media.files › TCG\Voyager › VoyagerMediaCon…
  POST            admin/media/move_file voyager.media.move › TCG\Voyager › VoyagerMedia…
  POST            admin/media/new_folder voyager.media.new_folder › TCG\Voyager › Voyag…
  POST            admin/media/rename_file voyager.media.rename › TCG\Voyager › VoyagerM…
  POST            admin/media/upload voyager.media.upload › TCG\Voyager › VoyagerMediaC…
  GET|HEAD        admin/menus voyager.menus.index › TCG\Voyager › VoyagerBaseController…
  POST            admin/menus voyager.menus.store › TCG\Voyager › VoyagerBaseController…
  POST            admin/menus/action voyager.menus.action › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/menus/create voyager.menus.create › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/menus/order voyager.menus.order › TCG\Voyager › VoyagerBaseCont…
  POST            admin/menus/order voyager.menus.update_order › TCG\Voyager › VoyagerB…
  GET|HEAD        admin/menus/relation voyager.menus.relation › TCG\Voyager › VoyagerBa…
  POST            admin/menus/remove voyager.menus.media.remove › TCG\Voyager › Voyager…
  GET|HEAD        admin/menus/{id} voyager.menus.show › TCG\Voyager › VoyagerBaseContro…
  PUT|PATCH       admin/menus/{id} voyager.menus.update › TCG\Voyager › VoyagerBaseCont…
  DELETE          admin/menus/{id} voyager.menus.destroy › TCG\Voyager › VoyagerBaseCon…
  GET|HEAD        admin/menus/{id}/edit voyager.menus.edit › TCG\Voyager › VoyagerBaseC…
  GET|HEAD        admin/menus/{id}/restore voyager.menus.restore › TCG\Voyager › Voyage…
  GET|HEAD        admin/menus/{menu}/builder voyager.menus.builder › TCG\Voyager › Voya…
  POST            admin/menus/{menu}/item voyager.menus.item.add › TCG\Voyager › Voyage…
  PUT             admin/menus/{menu}/item voyager.menus.item.update › TCG\Voyager › Voy…
  DELETE          admin/menus/{menu}/item/{id} voyager.menus.item.destroy › TCG\Voyager…
  POST            admin/menus/{menu}/order voyager.menus.order_item › TCG\Voyager › Voy…
  GET|HEAD        admin/pages voyager.pages.index › TCG\Voyager › VoyagerBaseController…
  POST            admin/pages voyager.pages.store › TCG\Voyager › VoyagerBaseController…
  POST            admin/pages/action voyager.pages.action › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/pages/create voyager.pages.create › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/pages/order voyager.pages.order › TCG\Voyager › VoyagerBaseCont…
  POST            admin/pages/order voyager.pages.update_order › TCG\Voyager › VoyagerB…
  GET|HEAD        admin/pages/relation voyager.pages.relation › TCG\Voyager › VoyagerBa…
  POST            admin/pages/remove voyager.pages.media.remove › TCG\Voyager › Voyager…
  GET|HEAD        admin/pages/{id} voyager.pages.show › TCG\Voyager › VoyagerBaseContro…
  PUT|PATCH       admin/pages/{id} voyager.pages.update › TCG\Voyager › VoyagerBaseCont…
  DELETE          admin/pages/{id} voyager.pages.destroy › TCG\Voyager › VoyagerBaseCon…
  GET|HEAD        admin/pages/{id}/edit voyager.pages.edit › TCG\Voyager › VoyagerBaseC…
  GET|HEAD        admin/pages/{id}/restore voyager.pages.restore › TCG\Voyager › Voyage…
  GET|HEAD        admin/plans voyager.plans.index › TCG\Voyager › VoyagerBaseController…
  POST            admin/plans voyager.plans.store › TCG\Voyager › VoyagerBaseController…
  POST            admin/plans/action voyager.plans.action › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/plans/create voyager.plans.create › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/plans/order voyager.plans.order › TCG\Voyager › VoyagerBaseCont…
  POST            admin/plans/order voyager.plans.update_order › TCG\Voyager › VoyagerB…
  GET|HEAD        admin/plans/relation voyager.plans.relation › TCG\Voyager › VoyagerBa…
  POST            admin/plans/remove voyager.plans.media.remove › TCG\Voyager › Voyager…
  GET|HEAD        admin/plans/{id} voyager.plans.show › TCG\Voyager › VoyagerBaseContro…
  PUT|PATCH       admin/plans/{id} voyager.plans.update › TCG\Voyager › VoyagerBaseCont…
  DELETE          admin/plans/{id} voyager.plans.destroy › TCG\Voyager › VoyagerBaseCon…
  GET|HEAD        admin/plans/{id}/edit voyager.plans.edit › TCG\Voyager › VoyagerBaseC…
  GET|HEAD        admin/plans/{id}/restore voyager.plans.restore › TCG\Voyager › Voyage…
  GET|HEAD        admin/posts voyager.posts.index › TCG\Voyager › VoyagerBaseController…
  POST            admin/posts voyager.posts.store › TCG\Voyager › VoyagerBaseController…
  POST            admin/posts/action voyager.posts.action › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/posts/create voyager.posts.create › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/posts/order voyager.posts.order › TCG\Voyager › VoyagerBaseCont…
  POST            admin/posts/order voyager.posts.update_order › TCG\Voyager › VoyagerB…
  GET|HEAD        admin/posts/relation voyager.posts.relation › TCG\Voyager › VoyagerBa…
  POST            admin/posts/remove voyager.posts.media.remove › TCG\Voyager › Voyager…
  GET|HEAD        admin/posts/{id} voyager.posts.show › TCG\Voyager › VoyagerBaseContro…
  PUT|PATCH       admin/posts/{id} voyager.posts.update › TCG\Voyager › VoyagerBaseCont…
  DELETE          admin/posts/{id} voyager.posts.destroy › TCG\Voyager › VoyagerBaseCon…
  GET|HEAD        admin/posts/{id}/edit voyager.posts.edit › TCG\Voyager › VoyagerBaseC…
  GET|HEAD        admin/posts/{id}/restore voyager.posts.restore › TCG\Voyager › Voyage…
  GET|HEAD        admin/profile voyager.profile › TCG\Voyager › VoyagerUserController@p…
  GET|HEAD        admin/roles voyager.roles.index › TCG\Voyager › VoyagerRoleController…
  POST            admin/roles voyager.roles.store › TCG\Voyager › VoyagerRoleController…
  POST            admin/roles/action voyager.roles.action › TCG\Voyager › VoyagerRoleCo…
  GET|HEAD        admin/roles/create voyager.roles.create › TCG\Voyager › VoyagerRoleCo…
  GET|HEAD        admin/roles/order voyager.roles.order › TCG\Voyager › VoyagerRoleCont…
  POST            admin/roles/order voyager.roles.update_order › TCG\Voyager › VoyagerR…
  GET|HEAD        admin/roles/relation voyager.roles.relation › TCG\Voyager › VoyagerRo…
  POST            admin/roles/remove voyager.roles.media.remove › TCG\Voyager › Voyager…
  GET|HEAD        admin/roles/{id} voyager.roles.show › TCG\Voyager › VoyagerRoleContro…
  PUT|PATCH       admin/roles/{id} voyager.roles.update › TCG\Voyager › VoyagerRoleCont…
  DELETE          admin/roles/{id} voyager.roles.destroy › TCG\Voyager › VoyagerRoleCon…
  GET|HEAD        admin/roles/{id}/edit voyager.roles.edit › TCG\Voyager › VoyagerRoleC…
  GET|HEAD        admin/roles/{id}/restore voyager.roles.restore › TCG\Voyager › Voyage…
  GET|HEAD        admin/settings voyager.settings.index › TCG\Voyager › VoyagerSettings…
  POST            admin/settings voyager.settings.store › TCG\Voyager › VoyagerSettings…
  PUT             admin/settings voyager.settings.update › TCG\Voyager › VoyagerSetting…
  DELETE          admin/settings/{id} voyager.settings.delete › TCG\Voyager › VoyagerSe…
  PUT             admin/settings/{id}/delete_value voyager.settings.delete_value › TCG\…
  GET|HEAD        admin/settings/{id}/move_down voyager.settings.move_down › TCG\Voyage…
  GET|HEAD        admin/settings/{id}/move_up voyager.settings.move_up › TCG\Voyager › …
  GET|HEAD        admin/stores ............ voyager.stores.index › StoreController@index
  POST            admin/stores ............ voyager.stores.store › StoreController@store
  POST            admin/stores/action ... voyager.stores.action › StoreController@action
  GET|HEAD        admin/stores/create ... voyager.stores.create › StoreController@create
  GET|HEAD        admin/stores/order ...... voyager.stores.order › StoreController@order
  POST            admin/stores/order voyager.stores.update_order › StoreController@upda…
  GET|HEAD        admin/stores/relation voyager.stores.relation › StoreController@relat…
  POST            admin/stores/remove voyager.stores.media.remove › StoreController@rem…
  GET|HEAD        admin/stores/{id} ......... voyager.stores.show › StoreController@show
  PUT|PATCH       admin/stores/{id} ..... voyager.stores.update › StoreController@update
  DELETE          admin/stores/{id} ... voyager.stores.destroy › StoreController@destroy
  GET|HEAD        admin/stores/{id}/edit .... voyager.stores.edit › StoreController@edit
  GET|HEAD        admin/stores/{id}/restore voyager.stores.restore › StoreController@re…
  GET|HEAD        admin/themes voyager.theme.index › DevDojo\Themes › ThemesController@…
  GET|HEAD        admin/themes/activate/{theme} voyager.theme.activate › DevDojo\Themes…
  DELETE          admin/themes/delete voyager.theme.delete › DevDojo\Themes › ThemesCon…
  GET|HEAD        admin/themes/options ........................................ voyager.
  GET|HEAD        admin/themes/options/{theme} voyager.theme.options › DevDojo\Themes  …
  POST            admin/themes/options/{theme} voyager.theme.options.post › DevDojo\The…
  POST            admin/upload . voyager.upload › TCG\Voyager › VoyagerController@upload
  GET|HEAD        admin/users voyager.users.index › TCG\Voyager › VoyagerBaseController…
  POST            admin/users voyager.users.store › TCG\Voyager › VoyagerBaseController…
  POST            admin/users/action voyager.users.action › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/users/create voyager.users.create › TCG\Voyager › VoyagerBaseCo…
  GET|HEAD        admin/users/order voyager.users.order › TCG\Voyager › VoyagerBaseCont…
  POST            admin/users/order voyager.users.update_order › TCG\Voyager › VoyagerB…
  GET|HEAD        admin/users/relation voyager.users.relation › TCG\Voyager › VoyagerBa…
  POST            admin/users/remove voyager.users.media.remove › TCG\Voyager › Voyager…
  GET|HEAD        admin/users/{id} voyager.users.show › TCG\Voyager › VoyagerBaseContro…
  PUT|PATCH       admin/users/{id} voyager.users.update › TCG\Voyager › VoyagerBaseCont…
  DELETE          admin/users/{id} voyager.users.destroy › TCG\Voyager › VoyagerBaseCon…
  GET|HEAD        admin/users/{id}/edit voyager.users.edit › TCG\Voyager › VoyagerBaseC…
  GET|HEAD        admin/users/{id}/restore voyager.users.restore › TCG\Voyager › Voyage…
  GET|HEAD        admin/voyager-assets voyager.voyager_assets › TCG\Voyager › VoyagerCo…
  GET|HEAD        advertisers/create advertisers.create › AdvertiserFormController@crea…
  POST            advertisers/store . advertisers.store › AdvertiserFormController@store
  GET|HEAD        announcement/{id} wave.announcement › Wave\Http\Controllers\Announcem…
  GET|HEAD        announcements wave.announcements › Wave\Http\Controllers\Announcement…
  POST            announcements/read wave.announcements.read › Wave\Http\Controllers\An…
  POST            api/login ............. Wave\Http\Controllers\API\AuthController@login
  POST            api/logout ........... Wave\Http\Controllers\API\AuthController@logout
  POST            api/refresh ......... Wave\Http\Controllers\API\AuthController@refresh
  POST            api/register ....... Wave\Http\Controllers\API\AuthController@register
  POST            api/token ............. Wave\Http\Controllers\API\AuthController@token
  GET|HEAD        api/user .............................................................
  GET|HEAD        api/{datatype} ........ Wave\Http\Controllers\API\ApiController@browse
  POST            api/{datatype} ........... Wave\Http\Controllers\API\ApiController@add
  GET|HEAD        api/{datatype}/{id} ..... Wave\Http\Controllers\API\ApiController@read
  PUT             api/{datatype}/{id} ..... Wave\Http\Controllers\API\ApiController@edit
  DELETE          api/{datatype}/{id} ... Wave\Http\Controllers\API\ApiController@delete
  GET|HEAD        arrilot/load-widget .... Arrilot\Widgets › WidgetController@showWidget
  GET|HEAD        blog .......... wave.blog › Wave\Http\Controllers\BlogController@index
  GET|HEAD        blog/{category} wave.blog.category › Wave\Http\Controllers\BlogContro…
  GET|HEAD        blog/{category}/{post} wave.blog.post › Wave\Http\Controllers\BlogCon…
  POST            cancel wave.cancel › Wave\Http\Controllers\SubscriptionController@can…
  GET|HEAD        cancelled ............................................. wave.cancelled
  GET|HEAD        categories ............... categories.index › CategoryController@index
  GET|HEAD        categories/{slug} .......... categories.show › CategoryController@show
  GET|HEAD        category-forms/create categories.create › CategoryFormController@crea…
  POST            category-forms/store . categories.store › CategoryFormController@store
  POST            checkout checkout › Wave\Http\Controllers\SubscriptionController@chec…
  GET|HEAD        checkout/welcome .....................................................
  GET|HEAD        dashboard wave.dashboard › Wave\Http\Controllers\DashboardController@…
  GET|HEAD        docs/{page?} .........................................................
  GET|HEAD        impersonate/leave impersonate.leave › Lab404\Impersonate › Impersonat…
  GET|HEAD        impersonate/take/{id}/{guardName?} impersonate › Lab404\Impersonate  …
  GET|HEAD        install ................................................. wave.install
  GET|HEAD        livewire/livewire.js Livewire\Controllers › LivewireJavaScriptAssets@…
  GET|HEAD        livewire/livewire.js.map Livewire\Controllers › LivewireJavaScriptAss…
  POST            livewire/message/{name} livewire.message › Livewire\Controllers › Htt…
  GET|HEAD        livewire/preview-file/{filename} livewire.preview-file › Livewire\Con…
  POST            livewire/upload-file livewire.upload-file › Livewire\Controllers › Fi…
  GET|HEAD        login ..................... login › Auth\LoginController@showLoginForm
  POST            login ..................................... Auth\LoginController@login
  POST            logout .......................... logout › Auth\LoginController@logout
  GET|HEAD        logout wave.logout › Wave\Http\Controllers\Auth\LoginController@logout
  POST            notification/read/{id} wave.notification.read › Wave\Http\Controllers…
  GET|HEAD        notifications wave.notifications › Wave\Http\Controllers\Notification…
  GET|HEAD        p/{page} ................... Wave\Http\Controllers\PageController@page
  POST            paddle/webhook .. Wave\Http\Controllers\SubscriptionController@webhook
  POST            password/email password.email › Auth\ForgotPasswordController@sendRes…
  GET|HEAD        password/reset password.request › Auth\ForgotPasswordController@showL…
  POST            password/reset .. password.update › Auth\ResetPasswordController@reset
  GET|HEAD        password/reset/{token} password.reset › Auth\ResetPasswordController@…
  GET|HEAD        pricing ................................................. wave.pricing
  GET|HEAD        register ..... register › Auth\RegisterController@showRegistrationForm
  POST            register ............................ Auth\RegisterController@register
  POST            register/complete wave.register-complete › Wave\Http\Controllers\Auth…
  GET|HEAD        sanctum/csrf-cookie sanctum.csrf-cookie › Laravel\Sanctum › CsrfCooki…
  POST            settings/api wave.settings.api.post › Wave\Http\Controllers\SettingsC…
  PUT             settings/api/{id?} wave.settings.api.put › Wave\Http\Controllers\Sett…
  DELETE          settings/api/{id?} wave.settings.api.delete › Wave\Http\Controllers\S…
  GET|HEAD        settings/invoices/{invoice} wave.invoice › Wave\Http\Controllers\Sett…
  POST            settings/profile wave.settings.profile.put › Wave\Http\Controllers\Se…
  PUT             settings/security wave.settings.security.put › Wave\Http\Controllers\…
  GET|HEAD        settings/{section?} wave.settings › Wave\Http\Controllers\SettingsCon…
  GET|HEAD        stores .......................... stores.index › StoreController@index
  GET|HEAD        stores/{store} .................... stores.show › StoreController@show
  GET|HEAD        stores/{store}/featured-product stores.featured-product › StoreContro…
  POST            subscribe wave.subscribe › Wave\Http\Controllers\SubscriptionControll…
  POST            switch-plans wave.switch-plans › Wave\Http\Controllers\SubscriptionCo…
  POST            tails/webhook .......................... Devdojo\Tails › Tails@webhook
  GET|HEAD        test ............... Wave\Http\Controllers\SubscriptionController@test
  GET|HEAD        trial_over ........................................... wave.trial_over
  GET|HEAD        user/verify/{verification_code} verify › Wave\Http\Controllers\Auth\R…
  POST            {locale}/livewire/message/{name} livewire.message-localized › Livewir…

I believe the issue is that I am already using the stores.index and stores.show in another route on the front end called '/stores'. The routes are grouped and prefixed with /stores. I noticed in the routes list voyager is attempting to use stores.index and stores.show and assume when clicking browse on the bread, its using stores.index because it takes you to the route /stores automatically.

StoreController

<?php

namespace App\Http\Controllers;

use App\Models\Store;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Models\Category;
use TCG\Voyager\Facades\Voyager;



class StoreController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $stores = Store::all();
        $stores = Store::join('category_id', 'stores.category_id', '=', 'category_id.id')
            ->select('stores.*', 'category_id.name as category_name')
            ->get();

        return view('themes.tailwind.stores.index', ['stores' => $stores]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Models\Store  $store
     * @return \Illuminate\Http\Response
     */
    public function show($programName)
    {

        $store = Store::join('category_id', 'stores.category_id', '=', 'category_id.id')
            ->select('stores.*', 'category_id.name as category_name')
            ->where('stores.program_name', $programName)
            ->firstOrFail();


        return view('themes.tailwind.stores.show', compact('store'));
    }
	
	public function showFeaturedProduct($programName)
{
    // Retrieve the store based on the program name
    $store = Store::where('program_name', $programName)->firstOrFail();

    // Add any logic here to retrieve data for the featured product

    // You can pass any data needed for the featured product page to the view
    return view('themes.tailwind.stores.featured-product', compact('store'));
}




    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Models\Store  $store
     * @return \Illuminate\Http\Response
     */
    public function edit(Store $store)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Store  $store
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        // Validate the request and handle any validation errors

        // Find the store record to update
        $store = Store::findOrFail($id);

        // Handle image upload
        if ($request->hasFile('image')) {
            // Store the uploaded image file using the 'public' disk
            $imagePath = $request->file('image')->store('images', 'public');

            // Update the image attribute
            $store->image = $imagePath;
            $store->save();
        }

        // Redirect or perform any additional actions

        return redirect()->route('stores.index');
    }
    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\Store  $store
     * @return \Illuminate\Http\Response
     */
    public function destroy(Store $store)
    {
        //
    }

}

Store Routes

Route::prefix('stores')->group(function () {
    Route::get('/', [StoreController::class, 'index'])->name('stores.index');
    Route::get('{store:program_name}', [StoreController::class, 'show'])->name('stores.show');
	Route::get('{store:program_name}/featured-product', [StoreController::class, 'showFeaturedProduct'])->name('stores.featured-product');

});
bobbyiliev

Sep 25th, 2023 08:59 AM

Best Answer

As far as I can tell from the output, in the Voyager admin you've defined a custom controller for the Stores BREAD. That way rather than using the default Voyger BREAD Controller, it uses the StoreController.

If you want to use the default Voyger BREAD Controller in Voyager for the Stores BREAD, what you could do is:

  • Login to Voyager
  • Go to the BREAD at /admin/bread
  • Click 'Edit' for the Stores bread
  • Then under the 'Controller Name' remove the StoreController definition
  • Save the BREAD

That way in Voyager you will be able to use the standard Voyager BREAD functionality rather than the custom StoreController.

And you can still use the StoreController for your frontend on the /stores/* routes, the above change will only affect the /admin/store/* routes.

Let me know if this is what you are after!

kaprinkey1

Sep 25th, 2023 09:20 AM

You were right. Thank you. The moment I removed the custom controller, it browsed to the proper page. I really appreciate your help. I was stumped for a while over that lol.

While I know Laravel quite well, I am still learning Voyager a bit and was not aware entering a controller name when creating bread, creates a custom controller for the bread. I thought it wanted the controller associated with the stores table. I understand it now. Thank you again.

bobbyiliev

Sep 26th, 2023 12:50 AM

No problem at all! Happy to hear that this is all working now! Good luck with your project!