更新代码
This commit is contained in:
53
app/Providers/AppServiceProvider.php
Normal file
53
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// \DB::listen(
|
||||
// function ($sql) {
|
||||
// foreach ($sql->bindings as $i => $binding) {
|
||||
// if ($binding instanceof \DateTime) {
|
||||
// $sql->bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
|
||||
// } else {
|
||||
// if (is_string($binding)) {
|
||||
// $sql->bindings[$i] = "'$binding'";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Insert bindings into query
|
||||
// $query = str_replace(array('%', '?'), array('%%', '%s'), $sql->sql);
|
||||
|
||||
// $query = vsprintf($query, $sql->bindings);
|
||||
|
||||
// // Save the query to file
|
||||
// $logFile = fopen(
|
||||
// storage_path('logs' . DIRECTORY_SEPARATOR . date('Y-m-d') . '_query.log'),
|
||||
// 'a+'
|
||||
// );
|
||||
// fwrite($logFile, date('Y-m-d H:i:s') . ': ' . $query . PHP_EOL);
|
||||
// fclose($logFile);
|
||||
// }
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
30
app/Providers/AuthServiceProvider.php
Normal file
30
app/Providers/AuthServiceProvider.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
'App\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
21
app/Providers/BroadcastServiceProvider.php
Normal file
21
app/Providers/BroadcastServiceProvider.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
74
app/Providers/EventServiceProvider.php
Normal file
74
app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
// 用户注册成功事件
|
||||
'Illuminate\Auth\Events\Registered' => [
|
||||
'App\Listeners\LogRegisteredUser',
|
||||
],
|
||||
// 用户登录成功,事件处理
|
||||
'Illuminate\Auth\Events\Login' => [
|
||||
'App\Listeners\LogSuccessfulLogin',
|
||||
],
|
||||
|
||||
//订单创建完成,事件处理
|
||||
'RuLong\Order\Events\OrderCreated' => [
|
||||
'App\Listeners\OrderCreatedListener',
|
||||
],
|
||||
|
||||
//订单关闭完成,事件处理
|
||||
'RuLong\Order\Events\OrderClosed' => [
|
||||
'App\Listeners\OrderClosedListener',
|
||||
],
|
||||
|
||||
//订单支付完成,事件处理
|
||||
'RuLong\Order\Events\OrderPaid' => [
|
||||
'App\Listeners\OrderPaidListener',
|
||||
],
|
||||
|
||||
//订单发货完成,事件处理
|
||||
'RuLong\Order\Events\OrderDelivered' => [
|
||||
'App\Listeners\OrderDeliveredListener',
|
||||
],
|
||||
|
||||
//订单签收完成,事件处理
|
||||
'RuLong\Order\Events\OrderSignined' => [
|
||||
'App\Listeners\OrderSigninedListener',
|
||||
],
|
||||
|
||||
//账户变动,事件处理
|
||||
'RuLong\UserAccount\Events\AccountRuleExecuted' => [
|
||||
'App\Listeners\AccountRuleExecutedListener',
|
||||
],
|
||||
|
||||
//抽奖成功事件
|
||||
'App\Events\Lottery' => [
|
||||
'App\Listeners\LotterySuccessListener',
|
||||
],
|
||||
|
||||
//提现审核完成事件
|
||||
'App\Events\WithdrawCompleted' => [
|
||||
'App\Listeners\WithdrawListener',
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
73
app/Providers/RouteServiceProvider.php
Normal file
73
app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user