刘远航 4 年之前
父节点
当前提交
2b02ca1b95
共有 4 个文件被更改,包括 59 次插入0 次删除
  1. 9 0
      routes/api.php
  2. 16 0
      routes/channels.php
  3. 18 0
      routes/console.php
  4. 16 0
      routes/web.php

+ 9 - 0
routes/api.php

xqd
@@ -0,0 +1,9 @@
+<?php
+
+Route::any('/{version}/{controller}/{action}', function ($version, $controller, $action) {
+    $namespace = 'App\Http\Controllers\Api\\'.ucfirst($version).'\\';
+
+    $className = $namespace . ucfirst($controller . "Controller");
+    $tempObj = new $className();
+    return call_user_func(array($tempObj, $action));
+});

+ 16 - 0
routes/channels.php

xqd
@@ -0,0 +1,16 @@
+<?php
+
+/*
+|--------------------------------------------------------------------------
+| 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.User.{id}', function ($user, $id) {
+    return (int) $user->id === (int) $id;
+});

+ 18 - 0
routes/console.php

xqd
@@ -0,0 +1,18 @@
+<?php
+
+use Illuminate\Foundation\Inspiring;
+
+/*
+|--------------------------------------------------------------------------
+| 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());
+})->describe('Display an inspiring quote');

+ 16 - 0
routes/web.php

xqd
@@ -0,0 +1,16 @@
+<?php
+
+/*
+|--------------------------------------------------------------------------
+| Web Routes
+|--------------------------------------------------------------------------
+|
+| Here is where you can register web routes for your application. These
+| routes are loaded by the RouteServiceProvider within a group which
+| contains the "web" middleware group. Now create something great!
+|
+*/
+
+Route::get('/', function () {
+    return view('welcome');
+});