创建版本
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may register all of the event broadcasting channels that your
|
||||
| application supports. The given channel authorization callbacks are
|
||||
| used to check if an authenticated user can listen to the channel.
|
||||
|
|
||||
*/
|
||||
|
||||
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
||||
return (int) $user->id === (int) $id;
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Console Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is where you may define all of your Closure based console
|
||||
| commands. Each Closure is bound to a command instance allowing a
|
||||
| simple approach to interacting with each command's IO methods.
|
||||
|
|
||||
*/
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
// 设置用户错误处理器
|
||||
function exception_error_handler($errno, $errstr, $errfile, $errline) {
|
||||
}
|
||||
set_error_handler("exception_error_handler");
|
||||
|
||||
require __DIR__.'/../app/macros.php';
|
||||
|
||||
$uris = [];
|
||||
|
||||
foreach (['module', 'controller', 'action'] as $key => $uri) {
|
||||
$uris[$uri] = Request::segment($key + 1, 'index');
|
||||
}
|
||||
|
||||
// 初始化所有模块
|
||||
Gdoo\Model\Services\ModuleService::allWithDetails();
|
||||
|
||||
$path = Request::path();
|
||||
|
||||
if (strpos($path, 'caldav') === 0) {
|
||||
App\Support\DAV::caldav('caldav');
|
||||
}
|
||||
|
||||
if (strpos($path, 'calendar/caldav') === 0) {
|
||||
App\Support\DAV::caldav('calendar/caldav');
|
||||
}
|
||||
|
||||
if (strpos($path, 'common') === 0) {
|
||||
app('Gdoo\Index\Controllers\ApiController')->commonAction();
|
||||
}
|
||||
|
||||
// 首字母大写
|
||||
$controller = Str::studly($uris['controller']);
|
||||
$action = 'Gdoo\\'.ucfirst($uris['module']).'\\Controllers\\'.$controller.'Controller@'.$uris['action'].'Action';
|
||||
|
||||
$method = Request::method();
|
||||
|
||||
if ($method == 'GET') {
|
||||
Route::get($path, $action);
|
||||
}
|
||||
|
||||
if ($method == 'POST') {
|
||||
Route::post($path, $action);
|
||||
}
|
||||
|
||||
if ($method == 'OPTIONS') {
|
||||
Route::options($path, $action);
|
||||
}
|
||||
|
||||
View::addLocation(base_path('app/Gdoo/'.ucfirst(Request::module()).'/views'));
|
||||
Reference in New Issue
Block a user