You can easily do this by doing the following before running the installation.
1.- Run php artisan vendor:publish to get the migrations published, then you can modify the migrations of your needs. In this case it is only 2016_02_15_204651_create_categories_table.php. You can change the database table to be voyager_categories.
2.- To make Voyager work with this new table, make a VoyagerCategory model like this:
<?php
namespace App;
class VoyagerCategory extends \TCG\Voyager\Models\Category
{
protected $table = 'voyager_categories';
}
Then in you AppServiceProvider add Voyager::useModel('Category', VoyagerCategory::class);
Thanks Mark, but i'm getting "Non-static method TCG\Voyager\Voyager::useModel() should not be called statically" using "Voyager::useModel('Category', VoyagerCategory::class);" in the AppServiceProvider.
Use the facade TCG\Voyager\Facades\Voyager.
Ok, I tried the facade. I was unsure which method in AppServiceProvider to use it in but with boot() I get "Class App\ProvidersVoyagerCategory does not exist" and using register() I get "Class voyager does not exist". The Model is supposed to go under App/ isn't it?
Use \AppVoyagerCategory.
On 19. feb. 2017 22.06 +0100, Bulmer notifications@github.com, wrote:
>
Ok, I tried the facade. I was unsure which method in AppServiceProvider to use it in but with boot() I get "Class App\ProvidersVoyagerCategory does not exist" and using register() I get "Class voyager does not exist". The Model is supposed to go under App/ isn't it?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub (https://github.com/the-control-group/voyager/issues/777#issuecomment-280949057), or mute the thread (https://github.com/notifications/unsubscribe-auth/ACIQ2w-FHwZuV1o8CJoXks5xNYs2gSjJks5reK7tgaJpZM4MFb7q).
Thanks again. I did work that out earlier, then got stuck on some problems
with previous migrations and existing tables etc. All working now though.
Cheers.
On Mon, Feb 20, 2017 at 7:46 PM, Mark Topper notifications@github.com
wrote:
Use \AppVoyagerCategory.
On 19. feb. 2017 22.06 +0100, Bulmer notifications@github.com, wrote:
>Ok, I tried the facade. I was unsure which method in AppServiceProvider
to use it in but with boot() I get "Class App\ProvidersVoyagerCategory
does not exist" and using register() I get "Class voyager does not exist".
The Model is supposed to go under App/ isn't it?—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub (https://github.com/the-
control-group/voyager/issues/777#issuecomment-280949057), or mute the
thread (https://github.com/notifications/unsubscribe-auth/ACIQ2w-
FHwZuV1o8CJoXks5xNYs2gSjJks5reK7tgaJpZM4MFb7q).—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/the-control-group/voyager/issues/777#issuecomment-281019592,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABw0RqRy5CJASqH1QoCMZXVVOgO0rHNyks5reVLqgaJpZM4MFb7q
.
Glad to hear 🎉
Have the same problem. I think it's quite common to already have a table names "categories", "translations" etc.. Voyager should not use generic tables names like that by default.
This has been closed for nearly a year. Please don't revive long-dead issues. You can open your own or post in our Slack group. But in short, https://media1.giphy.com/media/RL0xU1daTlMoE/giphy.gif This has been requested/complained about numerous times. We're looking for the best way to fix it, and just haven't found it yet.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.