Closed fusiondesign closed 9 years ago
So routes.php has two hard-coded variables: $main_route and $admin_route.
For some reason Cache:: does not work in routes. It's PHP so I'm 100% sure there is a way to bootstrap the Cache or fix this. The rest of the app uses a 60minute cached database setting.
To test and help with this: Please pull "git reset --hard fusiondesign/0.2"
The commit diff log is far too long to digest.
Ill look into this after work tonight.
Great work Brian :+1:
About the main_route and admin_route settings, I thought about that earlier when we first talked about moving settings to database, How user will access the settings admin panel the first time in order to adjust the routes and master template information?
Even if we made it defaults to url/tickets and url/tickets-admin .. what about the master template name? Most cases will end up with errors and won't be able to access the admin panel, so it was very practical that you checked first the config file there for settings, that is essential. Well done
I get this error:
figured out now that ticketit_settings table is empty
is there a seed?
It is there, but I did not run the seeder :)
php artisan db:seed --class=Kordy\Ticketit\Seeds\SettingsTableSeeder
I always run this after pull requests to clear stored views,
php artisan view:clear
So when do we get and admin interface for config?/ lol
Yeah I have the route issue, cannot access any admin areas.
Hmm... do you guys both have empty settings tables?
It should see config/ticketit.php, merge the config from that file into the defaults, then sync the database with the config (just run the migration then the seeder)
@fishmad it is "dashboard" instead of "tickets-admin"
@FusionDesign I still get an error when i try to access any admin page
I'm doing a fresh install now. I'll let you know where the issue is and patch it :)
Also in Setting.php, did you uncomment the Cache:forget('settings') to clear your cache? Don't worry, I'll fix all these problems.
I don't use Cache .. so for time being I just modified Models/Setting.php
From
$settings = Cache::remember('settings', 60, function () {
return Table::all();
});
to
$settings = Table::all();
Cache is file-based by default and turned on. Are you sure you don't use it?
Or do you mean that you changed the code and it still doesn't work?
@FusionDesign If I do not do that, i get the error
Hmm it looks like it's not finding an "admin_ids" in the database under the Slug column. Can you confirm that row exists?
@FusionDesign When i dump $settings value Models/Settings.php
// Cache::forget('settings');
$settings = Cache::remember('settings', 60, function () {
return Table::all();
});
dd($settings);
I get this
Collection {#268 ▼
#items: []
}
I ran the seeder and it populated fine, Ill check /dashboard
Did you run
php artisan db:seed --class=Kordy\\Ticketit\\Seeds\\SettingsTableSeeder
@thekordy ^^
The command replaces the old "publish config" command.
Essentially it's the new "check for old config, merge into new config, and merge into database command" so it supports upgrades and old versions.
Yes, and It is populated fine and I checked it has all needed data
Yet it returns an empty array? Give me 20min to troubleshoot. I'm doing a fresh install now
my views are hardcoded to use /tickets-admin so I need to update. I ran: php artisan db:seed --class=Kordy\Ticketit\Seeds\SettingsTableSeeder
Oh @thekordy did you check routes.php and change the hard-coded values?
Oops sorry I'm falling asleep. You already answered that lol
values are derived from the constants in config.php 'admin_route' => 'tickets-admin', does this need to be changed in config so database is populated correctly?
Nah, that's why I opened this PR in the first place was to find a better solution to the routes.php hardcoded values. Every other reference to admin_route and main_route uses the DB cache.
I duplicated the error. I'm trying to fix it now.
I changed both config and DB to /dashboard and cleared views cache but its still looking for /tickets-admin its not really harcoded because its using this $setting->grab('main_route')
Ok I fixed this error by un-commenting // Cache::forget('settings')
to clear the cache.
Let me know if that works @fishmad
where? is it
@FusionDesign After I changed the hardcoded admin route .. the backend works fine creating new values. However the front won't load until I comment out the Cache line as i mentioned before
Setting.php
@thekordy I think during first install it boots an empty $settings and keeps it like that for 60 minutes because it was originally a cached instance maybe?
Ok that's working now.
@fishmad in the routes.php
$router = $this->app['router'];
$main_route = 'tickets';
$admin_route = 'tickets-admin';
Ok so we have a problem with Cache lifetime on first install and hard-coded routes.php
I'll add in a catch to clear the cache.... if $settings is empty. That will fix that.
Main focus is on somehow removing $admin_route and $main_route from routes.php
This is for tracking, please do not merge.
I need help with figuring out routes.php. Everything else seems to work perfect.