teamtnt / tnt-analytics-issues

0 stars 0 forks source link

Routes doesn't work #1

Open code23-isaac opened 2 years ago

code23-isaac commented 2 years ago

Hi there,

I just purchased the package and I'm not able to access the dashboard at all.

I installed it according to your docs without any errors, I've set TNT_ANALYTICS_PATH="search-analytics" in my .env file and removed the middleware in the tnt-analytics config file.

After that I suppose I should be able to access https://myurl.test/search-analytics, but i get 404.

The searches are making entries to the tnt_analytics_entries table.

I use: Laravel 6.2 PHP 7.4 Laravel Voyager (tcg/voyager) 1.5.2 pvtl/voyager-frontend 1.0.2 teamtnt/laravel-scout-tntsearch-driver 11.6.0 teamtnt/tnt-analytics 1.4.0 laravel/scout 7.2.1

When I do php artisan route:list --path=search-analytics i get this:

+--------+-----------+----------------------------------------------------+----------------------------------+-----------------------------------------------------------------------------+---------------+
| Domain | Method    | URI                                                | Name                             | Action                                                                      | Middleware    |
+--------+-----------+----------------------------------------------------+----------------------------------+-----------------------------------------------------------------------------+---------------+
|        | GET|HEAD  | search-analytics                                   |                                  | TeamTNT\TNTAnalytics\Http\Controllers\TNTAnalyticsController@index          | tnt-analytics |
|        | GET|HEAD  | search-analytics/chart/query-per-period.json       |                                  | TeamTNT\TNTAnalytics\Http\Controllers\TNTAnalyticsController@queryPerPeriod | tnt-analytics |
|        | GET|HEAD  | search-analytics/model/{model}                     |                                  | TeamTNT\TNTAnalytics\Http\Controllers\ModelsController@index                | tnt-analytics |
|        | GET|HEAD  | search-analytics/query-details/{query}             |                                  | TeamTNT\TNTAnalytics\Http\Controllers\TNTAnalyticsController@queryDetails   | tnt-analytics |
|        | POST      | search-analytics/query/expansions                  | expansions.store                 | TeamTNT\TNTAnalytics\Http\Controllers\QueryExpansionsController@store       | tnt-analytics |
|        | GET|HEAD  | search-analytics/query/expansions                  | expansions.index                 | TeamTNT\TNTAnalytics\Http\Controllers\QueryExpansionsController@index       | tnt-analytics |
|        | GET|HEAD  | search-analytics/query/expansions/create           | expansions.create                | TeamTNT\TNTAnalytics\Http\Controllers\QueryExpansionsController@create      | tnt-analytics |
|        | PUT|PATCH | search-analytics/query/expansions/{expansion}      | expansions.update                | TeamTNT\TNTAnalytics\Http\Controllers\QueryExpansionsController@update      | tnt-analytics |
|        | GET|HEAD  | search-analytics/query/expansions/{expansion}      | expansions.show                  | TeamTNT\TNTAnalytics\Http\Controllers\QueryExpansionsController@show        | tnt-analytics |
|        | DELETE    | search-analytics/query/expansions/{expansion}      | expansions.destroy               | TeamTNT\TNTAnalytics\Http\Controllers\QueryExpansionsController@destroy     | tnt-analytics |
|        | GET|HEAD  | search-analytics/query/expansions/{expansion}/edit | expansions.edit                  | TeamTNT\TNTAnalytics\Http\Controllers\QueryExpansionsController@edit        | tnt-analytics |
|        | GET|HEAD  | search-analytics/query/overview                    | tnt-analytics-query-overview     | TeamTNT\TNTAnalytics\Http\Controllers\TNTAnalyticsController@queryDetails   | tnt-analytics |
|        | GET|HEAD  | search-analytics/query/overview/all                | tnt-analytics-query-overview-all | TeamTNT\TNTAnalytics\Http\Controllers\QueryDetailsController@all            | tnt-analytics |
|        | POST      | search-analytics/reports                           | reports.store                    | TeamTNT\TNTAnalytics\Http\Controllers\ReportsController@store               | tnt-analytics |
|        | GET|HEAD  | search-analytics/reports                           | reports.index                    | TeamTNT\TNTAnalytics\Http\Controllers\ReportsController@index               | tnt-analytics |
|        | GET|HEAD  | search-analytics/reports/create                    | reports.create                   | TeamTNT\TNTAnalytics\Http\Controllers\ReportsController@create              | tnt-analytics |
|        | GET|HEAD  | search-analytics/reports/graph/week                |                                  | TeamTNT\TNTAnalytics\Http\Controllers\ReportsController@graphWeek           | tnt-analytics |
|        | PUT|PATCH | search-analytics/reports/{report}                  | reports.update                   | TeamTNT\TNTAnalytics\Http\Controllers\ReportsController@update              | tnt-analytics |
|        | DELETE    | search-analytics/reports/{report}                  | reports.destroy                  | TeamTNT\TNTAnalytics\Http\Controllers\ReportsController@destroy             | tnt-analytics |
|        | GET|HEAD  | search-analytics/reports/{report}                  | reports.show                     | TeamTNT\TNTAnalytics\Http\Controllers\ReportsController@show                | tnt-analytics |
|        | GET|HEAD  | search-analytics/reports/{report}/edit             | reports.edit                     | TeamTNT\TNTAnalytics\Http\Controllers\ReportsController@edit                | tnt-analytics |
|        | GET|HEAD  | search-analytics/search                            | search.index                     | TeamTNT\TNTAnalytics\Http\Controllers\SearchController@index                | tnt-analytics |
+--------+-----------+----------------------------------------------------+----------------------------------+-----------------------------------------------------------------------------+---------------+

PS: it doesn't change anything if I delete my custom path from the .env file, still 404.

Can you please help?

nticaric commented 2 years ago

Thanks for trying out the package! Does it work for you when you try the route /tnt-analytics?

https://myurl.test/tnt-analytics

Also, do you maybe have a wildcard route, something like Route::get('/{any}', ...

code23-barna commented 2 years ago

Hi @nticaric,

Sorry, I raised the issue, but I was logged in with my colleague's github account accidentally.

Thanks for the quick response.

Yes, I have a wildcard route: Route::get('{slug?}', '\App\Http\Controllers\PageController@getPage')->where('slug', '.+')->name('page');

That's the last in the web.php file.

What is you suggestion to overcome that issue?

Could you maybe do something similar when Voyager does and create a entry in the web.php like Voyager::rotes() (https://github.com/the-control-group/voyager/blob/1.5/src/Voyager.php#L270)

code23-barna commented 2 years ago

Or should I try to exclude it with a regex here: ->where('slug', '.+')

code23-barna commented 2 years ago

For example that works: ->where('slug', '^(?!'.str_replace('/', '\/', config('tnt-analytics.url_prefix')).').*$') in my case

nticaric commented 2 years ago

I will see if we can do something on the package level, for now, I guess a quick fix would be to set the route to /search/analytics or something similar

TNT_ANALYTICS_PATH="/search/analytics"