我正在尝试将PragmaRX跟踪器添加到我的Laravel 5.1应用程序中但是在遵循github上的安装说明后它无效并且在我尝试访问的每个页面上都得到了这个:
Whoops, looks like something went wrong.
1/1
ErrorException in RepositoryManager.php line 244:
Trying to get property of non-object
in RepositoryManager.php line 244
at HandleExceptions->handleError('8', 'Trying to get property of non-object', '/home/vagrant/Code/Laravel/vendor/pragmarx/tracker/src/Data/RepositoryManager.php', '244')
at call_user_func(array(object(HandleExceptions), 'handleError'), '8', 'Trying to get property of non-object', '/home/vagrant/Code/Laravel/vendor/pragmarx/tracker/src/Data/RepositoryManager.php', '244') in Handler.php line 63
at Handler->handleError('8', 'Trying to get property of non-object', '/home/vagrant/Code/Laravel/vendor/pragmarx/tracker/src/Data/RepositoryManager.php', '244', array()) in RepositoryManager.php line 244
at RepositoryManager->getCurrentUserAgent() in Tracker.php line 90
at Tracker->getSessionData() in Tracker.php line 420
at Tracker->checkCurrentUser() in ServiceProvider.php line 576
at ServiceProvider->PragmaRX\Tracker\Vendor\Laravel\{closure}(object(Request), null)
at call_user_func_array(object(Closure), array(object(Request), null)) in Dispatcher.php line 221
at Dispatcher->fire('router.before', array(object(Request), null), true) in Dispatcher.php line 164
at Dispatcher->until('router.before', array(object(Request), null)) in Router.php line 1033
at Router->callFilter('before', object(Request)) in Router.php line 628
at Router->dispatch(object(Request)) in Kernel.php line 229
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 54
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 118
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 86
at Kernel->handle(object(Request)) in index.php line 54
这是我的config / tracker.php文件:
return [
/**
* Enable it?
*/
'enabled' => true,
/**
* Robots should be tracked?
*/
'do_not_track_robots' => false,
/**
* Which environments are not trackable?
*/
'do_not_track_environments' => [
// defaults to none
],
/**
* Which routes names are not trackable?
*/
'do_not_track_routes' => [
'tracker.stats.*',
],
/**
* The Do Not Track Ips is used to disable Tracker for some IP addresses:
*
* '127.0.0.1', '192.168.1.1'
*
* You can set ranges of IPs
* '192.168.0.1-192.168.0.100'
*
* And use net masks
* '10.0.0.0/32'
* '172.17.0.0/255.255.0.0'
*/
'do_not_track_ips' => [
//'127.0.0.0/24' /// range 127.0.0.1 - 127.0.0.255
],
/**
* Log every single access?
*
* The log table can become huge if your site is popular, but...
*
* Log table is also responsible for storing information on:
*
* - Routes and controller actions accessed
* - HTTP method used (GET, POST...)
* - Error log
* - URL queries (including values)
*/
'log_enabled' => true,
/**
* Log SQL queries?
*
* Log must be enabled for this option to work.
*/
'log_sql_queries' => false,
/**
* If you prefer to store Tracker data on a different database or connection,
* you can set it here.
*
* To avoid SQL queries log recursion, create a different connection for Tracker,
* point it to the same database (or not) and forbid logging of this connection in
* do_not_log_sql_queries_connections.
*/
'connection' => 'tracker',
/**
* Forbid logging of SQL queries for some connections.
*
* To avoid recursion, you better ignore Tracker connection here.
*
* Please create a separate database connection for Tracker. It can hit
* the same database of your application, but the connection itself
* has to have a different name, so the package can ignore its own queries
* and avoid recursion.
*
*/
'do_not_log_sql_queries_connections' => [
'tracker'
],
/**
* Also log SQL query bindings?
*
* Log must be enabled for this option to work.
*/
'log_sql_queries_bindings' => false,
/**
* Log events?
*/
'log_events' => false,
/**
* Which events do you want to log exactly?
*/
'log_only_events' => [
// defaults to logging all events
],
/**
* What are the names of the id columns on your system?
*
* 'id' is the most common, but if you have one or more different,
* please add them here in your preference order.
*/
'id_columns_names' => [
'id'
],
/**
* Do not log events for the following patterns.
* Strings accepts wildcards:
*
* eloquent.*
*
*/
'do_not_log_events' => [
'illuminate.log',
'eloquent.*',
'router.*',
'composing: *',
'creating: *',
],
/**
* Do you wish to log Geo IP data?
*
* You will need to install the geoip package
*
* composer require "geoip/geoip":"~1.14"
*
* And remove the PHP module
*
* sudo apt-get purge php5-geoip
*
*/
'log_geoip' => false,
/**
* Do you wish to log the user agent?
*/
'log_user_agents' => false,
/**
* Do you wish to log your users?
*/
'log_users' => true,
/**
* Do you wish to log devices?
*/
'log_devices' => false,
/**
* Do you wish to log HTTP referers?
*/
'log_referers' => true,
/**
* Do you wish to log url paths?
*/
'log_paths' => true,
/**
* Do you wish to log url queries and query arguments?
*/
'log_queries' => false,
/**
* Do you wish to log routes and route parameters?
*/
'log_routes' => true,
/**
* Log errors and exceptions?
*/
'log_exceptions' => true,
/**
* A cookie may be created on your visitor device, so you can have information
* on everything made using that device on your site. *
*/
'store_cookie_tracker' => true,
/**
* If you are storing cookies, you better change it to a name you of your own.
*/
'tracker_cookie_name' => 'mywebsite_it',
/**
* Internal tracker session name.
*/
'tracker_session_name' => 'tracker_session',
/**
* ** IMPORTANT **
* Change the user model to your own.
*/
'user_model' => 'App\User',
/**
* You can use your own model for every single table Tracker has.
*/
'session_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Session',
'log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Log',
'path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Path',
'query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Query',
'query_argument_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\QueryArgument',
'agent_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Agent',
'device_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Device',
'cookie_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Cookie',
'domain_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Domain',
'referer_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Referer',
'route_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Route',
'route_path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePath',
'route_path_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePathParameter',
'error_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Error',
'geoip_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\GeoIp',
'sql_query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQuery',
'sql_query_binding_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBinding',
'sql_query_binding_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBindingParameter',
'sql_query_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryLog',
'connection_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Connection',
'event_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Event',
'event_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\EventLog',
'system_class_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SystemClass',
/**
* Laravel internal variables on user authentication and login.
*/
'authentication_ioc_binding' => 'auth', // defaults to 'auth' in Illuminate\Support\Facades\Auth
'authenticated_check_method' => 'check', // to Auth::check()
'authenticated_user_method' => 'user', // to Auth::user()
'authenticated_user_id_column' => 'id', // to Auth::user()->id
'authenticated_user_username_column' => 'email', // to Auth::user()->email
/**
* Enable the Stats Panel?
*/
'stats_panel_enabled' => true,
/**
* Stats Panel routes before filter
*
*/
'stats_routes_before_filter' => '',
/**
* Stats Panel routes after filter
*
*/
'stats_routes_after_filter' => '',
/**
* Stats Panel routes middleware
*
*/
'stats_routes_middleware' => '',
/**
* Stats Panel template path
*/
'stats_template_path' => '/templates/sb-admin-2',
/**
* Stats Panel base uri.
*
* If your site url is http://wwww.mysite.com, then your stats page will be:
*
* http://wwww.mysite.com/stats
*
*/
'stats_base_uri' => 'stats',
/**
* Stats Panel layout view
*/
'stats_layout' => 'pragmarx/tracker::layout',
/**
* Stats Panel controllers namespace
*/
'stats_controllers_namespace' => 'PragmaRX\Tracker\Vendor\Laravel\Controllers',
];
这是我的config / database.php:
return [
/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
|
*/
'fetch' => PDO::FETCH_CLASS,
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
'tracker' => 'tracker',
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => storage_path('database.sqlite'),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
'tracker' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'cluster' => false,
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
],
];
答案 0 :(得分:0)
php artisan tracker:updateparser
这对我有用。