husseinsayed / links
laravel的链接统计
dev-main
2024-01-21 21:16 UTC
Requires
- php: *
- husseinsayed/charts: *
- husseinsayed/identify: *
- laravel/framework: *
This package is auto-updated.
Last update: 2024-09-21 21:16:56 UTC
README
laravel 5的链接统计
目录
安装
使用composer安装charts
下载
composer require husseinsayed/links
添加服务提供者及别名
在config/app.php
中将以下服务提供者添加到数组中:
HusseinSayed\Links\LinksServiceProvider::class,
在config/app.php
中将以下别名添加到数组中:
'Links' => HusseinSayed\Links\Facades\Links::class,
发布资源
php artisan vendor:publish
迁移
php artisan migrate
配置
默认设置
位于config/links.php
的文件包含一个设置数组,您可以在其中找到默认设置。
<?php return [ /* Middleware that will be applied to the statistic pages */ 'middleware' => HusseinSayed\Links\Middleware\LinksMiddleware::class, /* Password to use if HusseinSayed\Links\Middleware\LinksMiddleware is beeing used */ 'password' => 'LinksRocks', /* The views layout */ 'layout' => 'links::template', /* The route prefix, will be applied to all of the routes. */ 'prefix' => 'links', ];
如果您愿意使用默认中间件,现在应该修改密码。
中间件
中间件应用于统计页面,此中间件可以更改,并且您可以将自己的访问规则应用于它。
默认: HusseinSayed\Links\Middleware\LinksMiddleware::class
默认中间件需要简单的密码登录。
密码(仅限默认中间件)
如果您使用默认中间件,则需要设置密码。这将允许您登录。
默认: LinksRocks
布局
布局可以更改,但请注意,当前页面是使用Bootstrap 4设计的。
默认: links::template
前缀
前缀将在所有路由中使用。它决定了包中所有路由的根。
默认: links
使用
创建链接
要创建链接,请进入您想要添加跟踪链接的视图,而不是使用典型的url操作
{{ url('http://google.com') }} {{ route('google') }}
使用包外观
{{ Links::url('http://google.com') }} {{ Links::route('google') }}
跟踪页面
如果您想跟踪当前页面,只需这样做
注意:它使用jQuery!
// If jQuery .js is already included and you don't want conflits: {!! Links::track() !!} // If jQuery .js is not included in your view, this will also add it. {!! Links::track(true) !!}
快捷提示:将跟踪添加到视图布局将跟踪使用该布局的所有页面,一旦访问过!
查看统计信息
要查看所有链接统计信息,请转到包的根目录(前缀)。默认前缀是:links
。
一旦您进入链接应用。如果您使用默认中间件,您需要登录。默认密码是:LinksRocks
一旦您进入Web应用,您就可以探索统计信息了。