Browse Source

使用最新的5.5版本的laravel框架

baijunyao 7 years ago
parent
commit
0a0897cf83
100 changed files with 1176 additions and 7897 deletions
  1. 8 27
      .env.example
  2. 2 0
      .gitattributes
  3. 4 4
      .gitignore
  4. 0 297
      app/Console/Commands/Migration/FromThinkPHPBjyBlog.php
  5. 0 61
      app/Console/Commands/Seeder/Clear.php
  6. 4 3
      app/Console/Kernel.php
  7. 12 24
      app/Exceptions/Handler.php
  8. 0 194
      app/Http/Controllers/Admin/ArticleController.php
  9. 0 165
      app/Http/Controllers/Admin/CategoryController.php
  10. 0 126
      app/Http/Controllers/Admin/ChatController.php
  11. 0 75
      app/Http/Controllers/Admin/CommentController.php
  12. 0 53
      app/Http/Controllers/Admin/ConfigController.php
  13. 0 165
      app/Http/Controllers/Admin/FriendshipLinkController.php
  14. 0 168
      app/Http/Controllers/Admin/GitProjectController.php
  15. 0 47
      app/Http/Controllers/Admin/IndexController.php
  16. 0 40
      app/Http/Controllers/Admin/LoginController.php
  17. 0 98
      app/Http/Controllers/Admin/OauthUserController.php
  18. 0 138
      app/Http/Controllers/Admin/TagController.php
  19. 0 97
      app/Http/Controllers/Admin/UserController.php
  20. 0 40
      app/Http/Controllers/Auth/AdminController.php
  21. 1 1
      app/Http/Controllers/Auth/LoginController.php
  22. 0 137
      app/Http/Controllers/Auth/OAuthController.php
  23. 4 4
      app/Http/Controllers/Auth/RegisterController.php
  24. 0 263
      app/Http/Controllers/Home/IndexController.php
  25. 0 21
      app/Http/Controllers/Hook/OschinaController.php
  26. 5 2
      app/Http/Kernel.php
  27. 0 24
      app/Http/Middleware/AdminAuth.php
  28. 2 2
      app/Http/Middleware/EncryptCookies.php
  29. 18 0
      app/Http/Middleware/TrimStrings.php
  30. 29 0
      app/Http/Middleware/TrustProxies.php
  31. 3 4
      app/Http/Middleware/VerifyCsrfToken.php
  32. 0 64
      app/Http/Requests/Article/Store.php
  33. 0 46
      app/Http/Requests/Category/Store.php
  34. 0 46
      app/Http/Requests/Category/Update.php
  35. 0 42
      app/Http/Requests/Chat/Store.php
  36. 0 46
      app/Http/Requests/Comment/Store.php
  37. 0 44
      app/Http/Requests/FriendshipLink/Store.php
  38. 0 42
      app/Http/Requests/GitProject/Store.php
  39. 0 42
      app/Http/Requests/Tag/Store.php
  40. 0 68
      app/Jobs/SendCommentEmail.php
  41. 0 411
      app/Libraries/Functions/helpers.php
  42. 0 44
      app/Listeners/LoginStoreSession.php
  43. 0 139
      app/Models/Article.php
  44. 0 53
      app/Models/ArticleTag.php
  45. 0 220
      app/Models/Base.php
  46. 0 30
      app/Models/Category.php
  47. 0 8
      app/Models/Chat.php
  48. 0 266
      app/Models/Comment.php
  49. 0 8
      app/Models/Config.php
  50. 0 53
      app/Models/FriendshipLink.php
  51. 0 8
      app/Models/GitProject.php
  52. 0 8
      app/Models/OauthUser.php
  53. 0 50
      app/Models/Tag.php
  54. 0 33
      app/Models/User.php
  55. 2 107
      app/Providers/AppServiceProvider.php
  56. 1 6
      app/Providers/BroadcastServiceProvider.php
  57. 2 6
      app/Providers/EventServiceProvider.php
  58. 9 15
      app/Providers/RouteServiceProvider.php
  59. 4 2
      artisan
  60. 0 34
      bootstrap/autoload.php
  61. 29 51
      composer.json
  62. 924 2375
      composer.lock
  63. 12 43
      config/app.php
  64. 0 6
      config/bjyblog.php
  65. 2 2
      config/broadcasting.php
  66. 5 2
      config/cache.php
  67. 0 35
      config/compile.php
  68. 16 30
      config/database.php
  69. 0 192
      config/debugbar.php
  70. 7 6
      config/filesystems.php
  71. 0 168
      config/ide-helper.php
  72. 0 20
      config/image.php
  73. 20 12
      config/mail.php
  74. 0 41
      config/purifier.php
  75. 6 6
      config/queue.php
  76. 0 19
      config/services.php
  77. 20 2
      config/session.php
  78. 1 1
      config/view.php
  79. 0 24
      database/factories/ModelFactory.php
  80. 23 0
      database/factories/UserFactory.php
  81. 0 1
      database/migrations/2014_10_12_000000_create_users_table.php
  82. 1 1
      database/migrations/2014_10_12_100000_create_password_resets_table.php
  83. 0 35
      database/migrations/2017_07_11_225347_create_article_tags_table.php
  84. 0 44
      database/migrations/2017_07_11_225347_create_articles_table.php
  85. 0 39
      database/migrations/2017_07_11_225347_create_categories_table.php
  86. 0 35
      database/migrations/2017_07_11_225347_create_chats_table.php
  87. 0 40
      database/migrations/2017_07_11_225347_create_comments_table.php
  88. 0 36
      database/migrations/2017_07_11_225347_create_configs_table.php
  89. 0 37
      database/migrations/2017_07_11_225347_create_friendship_links_table.php
  90. 0 43
      database/migrations/2017_07_11_225347_create_oauth_users_table.php
  91. 0 35
      database/migrations/2017_07_11_225347_create_tags_table.php
  92. 0 37
      database/migrations/2017_08_26_211441_create_jobs_table.php
  93. 0 35
      database/migrations/2017_08_26_212556_create_failed_jobs_table.php
  94. 0 35
      database/migrations/2017_10_18_203752_create_git_projects_table.php
  95. 0 25
      database/seeds/ArticleTagsTableSeeder.php
  96. 0 79
      database/seeds/ArticlesTableSeeder.php
  97. 0 29
      database/seeds/CategoriesTableSeeder.php
  98. 0 25
      database/seeds/ChatsTableSeeder.php
  99. 0 30
      database/seeds/CommentsTableSeeder.php
  100. 0 0
      database/seeds/ConfigsTableSeeder.php

+ 8 - 27
.env.example

@@ -1,3 +1,4 @@
+APP_NAME=Laravel
 APP_ENV=local
 APP_KEY=
 APP_DEBUG=true
@@ -11,15 +12,10 @@ DB_DATABASE=homestead
 DB_USERNAME=homestead
 DB_PASSWORD=secret
 
-OLD_DB_HOST=127.0.0.1
-OLD_DB_PORT=3306
-OLD_DB_DATABASE=old
-OLD_DB_USERNAME=homestead
-OLD_DB_PASSWORD=secret
-
 BROADCAST_DRIVER=log
 CACHE_DRIVER=file
 SESSION_DRIVER=file
+SESSION_LIFETIME=120
 QUEUE_DRIVER=sync
 
 REDIS_HOST=127.0.0.1
@@ -27,27 +23,12 @@ REDIS_PASSWORD=null
 REDIS_PORT=6379
 
 MAIL_DRIVER=smtp
-MAIL_HOST=
-MAIL_PORT=
-MAIL_USERNAME=
-MAIL_PASSWORD=
+MAIL_HOST=smtp.mailtrap.io
+MAIL_PORT=2525
+MAIL_USERNAME=null
+MAIL_PASSWORD=null
 MAIL_ENCRYPTION=null
-MAIL_FROM_NAME=
-MAIL_FROM_ADDRESS=
 
 PUSHER_APP_ID=
-PUSHER_KEY=
-PUSHER_SECRET=
-
-QQ_KEY=
-QQ_SECRET=
-
-WEIBO_KEY=
-WEIBO_SECRET=
-
-GITHUB_KEY=
-GITHUB_SECRET=
-
-OSCHINA_HOOK_PASSWORD=
-
-DEBUGBAR_ENABLED=true
+PUSHER_APP_KEY=
+PUSHER_APP_SECRET=

+ 2 - 0
.gitattributes

@@ -1,3 +1,5 @@
 * text=auto
 *.css linguist-vendored
 *.scss linguist-vendored
+*.js linguist-vendored
+CHANGELOG.md export-ignore

+ 4 - 4
.gitignore

@@ -1,12 +1,12 @@
 /node_modules
+/public/hot
 /public/storage
 /storage/*.key
 /vendor
 /.idea
+/.vagrant
 Homestead.json
 Homestead.yaml
+npm-debug.log
+yarn-error.log
 .env
-.phpstorm.meta.php
-_ide_helper.php
-.user.ini
-/public/Demo/*

+ 0 - 297
app/Console/Commands/Migration/FromThinkPHPBjyBlog.php

@@ -1,297 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Migration;
-
-use App\Models\Category;
-use App\Models\Tag;
-use Illuminate\Console\Command;
-use DB;
-use App\Models\Chat;
-use HyperDown\Parser;
-use App\Models\Config;
-use App\Models\Article;
-use App\Models\Comment;
-use App\Models\OauthUser;
-use App\Models\ArticleTag;
-use App\Models\FriendshipLink;
-use League\HTMLToMarkdown\HtmlConverter;
-use Artisan;
-
-class FromThinkPHPBjyBlog extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'migration:fromThinkPHPBjyBlog';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * 从 thinkphp-bjyblog 迁移数据
-     */
-    public function handle()
-    {
-        $articleModel = new Article();
-        $articleTagModel = new ArticleTag();
-        $commentModel = new Comment();
-        $friendshipLinkModel = new FriendshipLink();
-        $configModel = new Config();
-        $oauthUserModel = new OauthUser();
-        $chatModel = new Chat();
-        $categoryModel = new Category();
-        $tagModel = new Tag();
-        // 防止误操作清空数据库
-        if (file_exists(storage_path('lock/migration.lock'))) {
-            die('已经迁移过,如需重新迁移,请先删除/storage/lock/migration.lock文件');
-        }
-        Artisan::call('seeder:clear');
-
-        // 从旧系统中迁移分类表
-        $data = DB::connection('old')->table('category')->get()->toArray();
-        foreach ($data as $v) {
-            $category = [
-                'id' => $v->cid,
-                'name' => $v->cname,
-                'keywords' => $v->keywords,
-                'description' => $v->description,
-                'sort' => $v->sort,
-                'pid' => $v->pid,
-            ];
-            $categoryModel->storeData($category);
-        }
-
-        // 从旧系统中迁移标签表
-        $data = DB::connection('old')->table('tag')->get()->toArray();
-        foreach ($data as $v) {
-            $category = [
-                'id' => $v->tid,
-                'name' => $v->tname,
-            ];
-            $tagModel->storeData($category);
-        }
-
-        // 从旧系统中迁移文章
-        $htmlConverter = new HtmlConverter();
-        $parser = new Parser();
-        $data = DB::connection('old')
-            ->table('article')
-            ->get()
-            ->toArray();
-        $articleModel->where('id', '<', 87)->forceDelete();
-        foreach ($data as $k => $v) {
-            $content = htmlspecialchars_decode($v->content);
-            $content = str_replace('<br style="box-sizing: inherit; margin-bottom: 0px;"/>', '', $content);
-            $content = str_replace('/Upload/image/ueditor', '/uploads/article', $content);
-            $content = str_replace(['<pre class="brush:', '</pre>', ';toolbar:false">',  '<p><br/></p>'], ["\r\n```", "\r\n```\r\n", "\r\n", "\r\n"], $content);
-            $content = str_replace('```js', '```javascript', $content);
-            $content = str_replace("\r\n", '|rn|', $content);
-            $content = str_replace('<p>', '', $content);
-            $content = str_replace('</p>', '|rn|', $content);
-            $content = str_replace('&nbsp;', '|nbsp|', $content);
-            $markdown = $htmlConverter->convert($content);
-            $markdown = htmlspecialchars($markdown);
-            $markdown = str_replace(['|rn|', '\*', '\_', "\n "], ["\r\n", '*', '_', "\n    "], $markdown);
-            $markdown = str_replace("\r\n\r\n", "\r\n", $markdown);
-            $markdown = str_replace('http://www.baijunyao.com/uploads/article', 'uploads/article', $markdown);
-            $markdown = str_replace('|nbsp|', '&nbsp;', $markdown);
-            preg_match_all("/\/\/\*+.*\*+/", $markdown, $arr);
-            $tmp = [];
-            foreach ($arr[0] as $m => $n) {
-                $tmp[$m] = str_replace('*', '\*', $n);
-            }
-            $markdown = str_replace($arr[0], $tmp, $markdown);
-            // markdown 转html
-            $html = $parser->makeHtml($markdown);
-            $html = html_entity_decode($html);
-            $html = str_replace(['<code class="', '\\\\'], ['<code class="lang-', '\\'], $html);
-            $article = [
-                'id' => $v->aid,
-                'category_id' => $v->cid,
-                'title' => $v->title,
-                'author' => $v->author,
-                'markdown' => $markdown,
-                'html' => $html,
-                'description' => $v->description,
-                'keywords' => $v->keywords,
-                'cover' => $articleModel->getCover($markdown),
-                'is_top' => $v->is_top,
-                'click' => $v->click,
-            ];
-            $articleModel->create($article);
-            $editArticleMap = [
-                'id' => $v->aid
-            ];
-
-            $editArticleData = [
-                'created_at' => date('Y-m-d H:i:s', $v->addtime)
-            ];
-            $articleModel->updateData($editArticleMap, $editArticleData);
-        }
-
-        // 从旧系统中迁移文章标签中间表
-        $data = DB::connection('old')->table('article_tag')->get()->toArray();
-        foreach ($data as $v) {
-            $article_tag = [
-                'article_id' => $v->aid,
-                'tag_id' => $v->tid
-            ];
-            $articleTagModel->storeData($article_tag);
-        }
-
-        // 从旧系统中迁移评论
-        $data = DB::connection('old')
-            ->table('comment')
-            // ->where('cmtid', 1614)
-            ->orderBy('cmtid', 'desc')
-            ->get()
-            ->toArray();
-        foreach ($data as $v) {
-            // 把img标签反转义
-            $content = html_entity_decode(htmlspecialchars_decode($v->content));
-            // 匹配图片
-            preg_match_all('/<img.*?title="(.*?)".*?>/i', $content, $img);
-            $search = $img[0];
-            $replace = array_map(function ($v) {
-                return '['.$v.']';
-            }, $img[1]);
-            $content = str_replace($search, $replace, $content);
-            $content = strip_tags($content);
-            $comment_data = [
-                'id' => $v->cmtid,
-                'oauth_user_id' => $v->ouid,
-                'type' => $v->type,
-                'pid' => $v->pid,
-                'article_id' => $v->aid,
-                'content' => $content,
-                'status' => $v->status,
-            ];
-            $commentModel->create($comment_data);
-            $editCommentMap = [
-                'id' => $v->cmtid,
-            ];
-            $editCommentData = [
-                'created_at' => date('Y-m-d H:i:s', $v->date)
-            ];
-            $commentModel->updateData($editCommentMap, $editCommentData);
-        }
-
-        // 迁移友情链接
-        $data = DB::connection('old')->table('link')->get()->toArray();
-        foreach ($data as $v) {
-            $link_data = [
-                'id' => $v->lid,
-                'name' => $v->lname,
-                'url' => $v->url,
-                'sort' => $v->sort
-            ];
-            if ($v->is_show === 0) {
-                $link_data['deleted_at'] = date('Y-m-d H:i:s', time());
-            }
-            $friendshipLinkModel->storeData($link_data);
-        }
-
-        // 迁移配置项
-        $data = DB::connection('old')->table('config')->get()->toArray();
-        foreach ($data as $v) {
-            $updateMap = [
-                'name' => $v->name
-            ];
-            $updateData = [
-                'name' => $v->name,
-                'value' => $v->value
-            ];
-            // 判断是否有此配置项;如果有;则修改;如果没有则新增
-            $count = $configModel->whereMap($updateMap)->count();
-            if ($count) {
-                $configModel->updateData($updateMap, $updateData);
-            } else {
-                $configModel->storeData($updateData);
-            }
-        }
-
-        // 迁移第三方登录用户表
-        $data = DB::connection('old')->table('oauth_user')->get()->toArray();
-        foreach ($data as $v) {
-            $oauthUserData = [
-                'id' => $v->id,
-                'type' => $v->type,
-                'name' => $v->nickname,
-                'avatar' => $v->head_img,
-                'openid' => $v->openid,
-                'access_token' => $v->access_token,
-                'last_login_ip' => $v->last_login_ip,
-                'login_times' => $v->login_times,
-                'email' => $v->email,
-                'is_admin' => $v->is_admin
-            ];
-            $oauthUserModel->storeData($oauthUserData);
-            $editOauthUserMap = [
-                'id' => $v->id,
-            ];
-            $editOauthUserData = [
-                'created_at' => date('Y-m-d H:i:s', $v->create_time)
-            ];
-            $oauthUserModel->updateData($editOauthUserMap, $editOauthUserData);
-        }
-
-        // 迁移随言碎语表
-        $data = DB::connection('old')->table('chat')->get()->toArray();
-        foreach ($data as $v) {
-            $chatData = [
-                'id' => $v->chid,
-                'content' => $v->content,
-            ];
-            $chatModel->storeData($chatData);
-            $editChatMap = [
-                'id' => $v->chid,
-            ];
-            $editChatData = [
-                'created_at' => date('Y-m-d H:i:s', $v->date)
-            ];
-            $chatModel->updateData($editChatMap, $editChatData);
-        }
-        $this->info('从旧系统迁移数据完成');
-        // 迁移完成创建锁文件
-        file_put_contents(storage_path('lock/migration.lock'), '');
-    }
-
-    /**
-     * 把用户的头像保存到本地
-     *
-     * @param OauthUser $oauthUserModel
-     */
-    public function avatar(OauthUser $oauthUserModel)
-    {
-        $data = $oauthUserModel->select('id', 'avatar')->get();
-        foreach ($data as $k => $v) {
-            $editMap = [
-                'id' => $v->id
-            ];
-            if (strpos($v->avatar, 'http') !== false) {
-                $avatarPath = 'uploads/avatar/'.$v->id.'.jpg';
-                file_put_contents(public_path($avatarPath), curl_get_contents($v->avatar));
-                $editData = [
-                    'avatar' => '/'.$avatarPath
-                ];
-                $oauthUserModel->updateData($editMap, $editData);
-            }
-        }
-    }
-}

+ 0 - 61
app/Console/Commands/Seeder/Clear.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Seeder;
-
-use App\Models\Article;
-use App\Models\ArticleTag;
-use App\Models\Category;
-use App\Models\Chat;
-use App\Models\Comment;
-use App\Models\Config;
-use App\Models\FriendshipLink;
-use App\Models\GitProject;
-use App\Models\OauthUser;
-use App\Models\Tag;
-use Illuminate\Console\Command;
-
-class Clear extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'seeder:clear';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Clear seeder data';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ArticleTag::truncate();
-        Article::truncate();
-        Category::truncate();
-        Chat::truncate();
-        Comment::truncate();
-        OauthUser::truncate();
-        Tag::truncate();
-        GitProject::truncate();
-        FriendshipLink::truncate();
-        $this->info('successfully');
-    }
-}

+ 4 - 3
app/Console/Kernel.php

@@ -13,8 +13,7 @@ class Kernel extends ConsoleKernel
      * @var array
      */
     protected $commands = [
-        Commands\Seeder\Clear::class,
-        Commands\Migration\FromThinkPHPBjyBlog::class,
+        //
     ];
 
     /**
@@ -30,12 +29,14 @@ class Kernel extends ConsoleKernel
     }
 
     /**
-     * Register the Closure based commands for the application.
+     * Register the commands for the application.
      *
      * @return void
      */
     protected function commands()
     {
+        $this->load(__DIR__.'/Commands');
+
         require base_path('routes/console.php');
     }
 }

+ 12 - 24
app/Exceptions/Handler.php

@@ -3,23 +3,27 @@
 namespace App\Exceptions;
 
 use Exception;
-use Illuminate\Auth\AuthenticationException;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 
 class Handler extends ExceptionHandler
 {
     /**
-     * A list of the exception types that should not be reported.
+     * A list of the exception types that are not reported.
      *
      * @var array
      */
     protected $dontReport = [
-        \Illuminate\Auth\AuthenticationException::class,
-        \Illuminate\Auth\Access\AuthorizationException::class,
-        \Symfony\Component\HttpKernel\Exception\HttpException::class,
-        \Illuminate\Database\Eloquent\ModelNotFoundException::class,
-        \Illuminate\Session\TokenMismatchException::class,
-        \Illuminate\Validation\ValidationException::class,
+        //
+    ];
+
+    /**
+     * A list of the inputs that are never flashed for validation exceptions.
+     *
+     * @var array
+     */
+    protected $dontFlash = [
+        'password',
+        'password_confirmation',
     ];
 
     /**
@@ -46,20 +50,4 @@ class Handler extends ExceptionHandler
     {
         return parent::render($request, $exception);
     }
-
-    /**
-     * Convert an authentication exception into an unauthenticated response.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \Illuminate\Auth\AuthenticationException  $exception
-     * @return \Illuminate\Http\Response
-     */
-    protected function unauthenticated($request, AuthenticationException $exception)
-    {
-        if ($request->expectsJson()) {
-            return response()->json(['error' => 'Unauthenticated.'], 401);
-        }
-
-        return redirect()->guest('login');
-    }
 }

+ 0 - 194
app/Http/Controllers/Admin/ArticleController.php

@@ -1,194 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Http\Requests\Article\Store;
-use App\Models\Article;
-use App\Models\ArticleTag;
-use App\Models\Category;
-use App\Models\Config;
-use App\Models\Tag;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Cache;
-
-class ArticleController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @param Article $article
-     * @return \Illuminate\Http\Response
-     */
-    public function index(Article $article)
-    {
-        $article = $article->getAdminList();
-        $assign = compact('article');
-        return view('admin.article.index', $assign);
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        $category = Category::all();
-        $tag = Tag::all();
-        $author = Config::where('name', 'AUTHOR')->value('value');
-        $assign = compact('category', 'tag', 'author');
-        return view('admin.article.create', $assign);
-    }
-
-    /**
-     * 配合editormd上传图片的方法
-     *
-     * @return \Illuminate\Http\JsonResponse
-     */
-    public function uploadImage()
-    {
-        $result = upload('editormd-image-file', 'uploads/article');
-        if ($result['status_code'] === 200) {
-            $data = [
-                'success' => 1,
-                'message' => $result['message'],
-                'url' => $result['data']['path'].$result['data']['new_name']
-            ];
-        } else {
-            $data = [
-                'success' => 0,
-                'message' => $result['message'],
-                'url' => ''
-            ];
-        }
-        return response()->json($data);
-    }
-
-    /**
-     * 添加文章
-     *
-     * @param Store $request
-     * @param Article $article
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function store(Store $request, Article $article)
-    {
-        $data = $request->except('_token');
-        $result = $article->storeData($data);
-        if ($result) {
-            // 更新热门推荐文章缓存
-            Cache::forget('common:topArticle');
-            // 更新标签统计缓存
-            Cache::forget('common:tag');
-        }
-        return redirect('admin/article/index');
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id)
-    {
-        $article = Article::withTrashed()->find($id);
-        $article->tag_ids = ArticleTag::where('article_id', $id)->pluck('tag_id')->toArray();
-        $category = Category::all();
-        $tag = Tag::all();
-        $assign = compact('article', 'category', 'tag');
-        return view('admin.article.edit', $assign);
-    }
-
-    /**
-     * 编辑文章
-     *
-     * @param Store $request
-     * @param Article $articleModel
-     * @param ArticleTag $articleTagModel
-     * @param $id
-     * @return \Illuminate\Http\RedirectResponse
-     */
-    public function update(Store $request, Article $articleModel, ArticleTag $articleTagModel, $id)
-    {
-        $data = $request->except('_token');
-        $markdown = $articleModel->where('id', $id)->value('markdown');
-        preg_match_all('/!\[.*\]\((.*.[jpg|jpeg|png|gif]).*\)/i', $markdown, $images);
-        // 获取封面并添加水印
-        $data['cover'] = $articleModel->getCover($data['markdown'], $images[1]);
-        // 为文章批量添加标签
-        $tag_ids = $data['tag_ids'];
-        // 把markdown转html
-        $data['html'] = markdown_to_html($data['markdown']);
-        unset($data['tag_ids']);
-        $articleTagModel->addTagIds($id, $tag_ids);
-        // 编辑文章
-        $map = [
-            'id' => $id
-        ];
-        $result = $articleModel->updateData($map, $data);
-        if ($result) {
-            // 更新热门推荐文章缓存
-            Cache::forget('common:topArticle');
-            // 更新标签统计缓存
-            Cache::forget('common:tag');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * 删除文章
-     *
-     * @param $id
-     * @param Article $articleModel
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function destroy($id, Article $articleModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $result = $articleModel->destroyData($map);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:topArticle');
-        }
-        return redirect('admin/article/index');
-    }
-
-    /**
-     * 恢复删除的文章
-     *
-     * @param         $id
-     * @param Article $articleModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function restore($id, Article $articleModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $result = $articleModel->restoreData($map);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:topArticle');
-        }
-        return redirect('admin/article/index');
-    }
-
-    /**
-     * 彻底删除文章
-     *
-     * @param         $id
-     * @param Article $articleModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function forceDelete($id, Article $articleModel)
-    {
-        $articleModel->where('id', $id)->forceDelete();
-        return redirect('admin/article/index');
-    }
-}

+ 0 - 165
app/Http/Controllers/Admin/CategoryController.php

@@ -1,165 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Http\Requests\Category\Store;
-use App\Http\Requests\Category\Update;
-use App\Models\Category;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Cache;
-
-class CategoryController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        $data = Category::withTrashed()->get();
-        $assign = compact('data');
-        return view('admin.category.index', $assign);
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        return view('admin.category.create');
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Store $request, Category $categoryModel)
-    {
-        $data = $request->except('_token');
-        $result = $categoryModel->storeData($data);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:category');
-        }
-        return redirect('admin/category/index');
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id)
-    {
-        $data = Category::find($id);
-        $assign = compact('data');
-        return view('admin.category.edit', $assign);
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Update $request, $id, Category $categoryModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $data = $request->except('_token');
-        $result = $categoryModel->updateData($map, $data);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:category');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id, Category $categoryModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $result = $categoryModel->destroyData($map);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:category');
-        }
-        return redirect('admin/category/index');
-    }
-
-    /**
-     * 分类排序
-     *
-     * @param Request $request
-     * @param Category $categoryModel
-     * @return \Illuminate\Http\RedirectResponse
-     */
-    public function sort(Request  $request, Category $categoryModel)
-    {
-        $data = $request->except('_token');
-        $sortData = [];
-        foreach ($data as $k => $v) {
-            $sortData[] = [
-                'id' => $k,
-                'sort' => $v
-            ];
-        }
-        $result = $categoryModel->updateBatch($sortData);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:category');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * 恢复删除的分类
-     *
-     * @param          $id
-     * @param Category $categoryModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function restore($id, Category $categoryModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $result = $categoryModel->restoreData($map);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:category');
-        }
-        return redirect('admin/category/index');
-    }
-
-    /**
-     * 彻底删除分类
-     *
-     * @param          $id
-     * @param Category $categoryModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function forceDelete($id, Category $categoryModel)
-    {
-        $categoryModel->where('id', $id)->forceDelete();
-        return redirect('admin/category/index');
-    }
-}

+ 0 - 126
app/Http/Controllers/Admin/ChatController.php

@@ -1,126 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Http\Requests\Chat\Store;
-use App\Models\Chat;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class ChatController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index(Chat $chatModel)
-    {
-        $data = $chatModel
-            ->orderBy('created_at', 'desc')
-            ->withTrashed()
-            ->paginate(50);
-        $assign = compact('data');
-        return view('admin.chat.index', $assign);
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        return view('admin.chat.create');
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Store $request, Chat $chatModel)
-    {
-        $data = $request->only('content');
-        $chatModel->storeData($data);
-        return redirect('admin/chat/index');
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id)
-    {
-        $data = Chat::find($id);
-        $assign = compact('data');
-        return view('admin.chat.edit', $assign);
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, $id, Chat $chatModel)
-    {
-        $data = $request->except('_token');
-        $map = [
-            'id' => $id
-        ];
-        $chatModel->updateData($map, $data);
-        return redirect()->back();
-
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id, Chat $chatModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $chatModel->destroyData($map);
-        return redirect('admin/chat/index');
-    }
-
-    /**
-     * 恢复删除的随言碎语
-     *
-     * @param      $id
-     * @param Chat $chatModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function restore($id, Chat $chatModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $chatModel->restoreData($map);
-        return redirect('admin/chat/index');
-    }
-
-    /**
-     * 彻底删除随言碎语
-     *
-     * @param      $id
-     * @param Chat $chatModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function forceDelete($id, Chat $chatModel)
-    {
-        $chatModel->where('id', $id)->forceDelete();
-        return redirect('admin/chat/index');
-    }
-}

+ 0 - 75
app/Http/Controllers/Admin/CommentController.php

@@ -1,75 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Models\Comment;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Cache;
-
-class CommentController extends Controller
-{
-    /**
-     * 评论列表
-     *
-     * @param Comment $commentModel
-     * @return mixed
-     */
-    public function index(Comment $commentModel)
-    {
-        $data = $commentModel->getAdminList();
-        $assign = compact('data');
-        return view('admin.comment.index', $assign);
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id, Comment $commentModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $result = $commentModel->destroyData($map);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:newComment');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * 恢复删除的评论
-     *
-     * @param         $id
-     * @param Comment $commentModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function restore($id, Comment $commentModel)
-    {
-        $result = $commentModel->where('id', $id)->restore();
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:newComment');
-        }
-        return redirect('admin/comment/index');
-    }
-
-    /**
-     * 彻底删除评论
-     *
-     * @param         $id
-     * @param Comment $commentModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function forceDelete($id, Comment $commentModel)
-    {
-        $commentModel->where('id', $id)->forceDelete();
-        return redirect('admin/tag/index');
-    }
-}

+ 0 - 53
app/Http/Controllers/Admin/ConfigController.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use Artisan;
-use App\Models\Config;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Cache;
-
-class ConfigController extends Controller
-{
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit()
-    {
-        return view('admin.config.edit');
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, Config $configModel)
-    {
-        $data = $request->except('_token');
-        if ($request->hasFile('QQ_QUN_OR_CODE')) {
-            $file = upload('QQ_QUN_OR_CODE', 'uploads/images', false);
-            $result = $file['status_code'] === 200 ? '/uploads/images/'.$file['data']['new_name']: '';
-            $data['QQ_QUN_OR_CODE'] = $result;
-        }
-        $editData = [];
-        foreach ($data as $k => $v) {
-            $editData[] = [
-                'name' => $k,
-                'value' => $v
-            ];
-        }
-        $result = $configModel->updateBatch($editData);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('config');
-        }
-        return redirect('admin/config/edit');
-    }
-}

+ 0 - 165
app/Http/Controllers/Admin/FriendshipLinkController.php

@@ -1,165 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use DB;
-use App\Http\Requests\FriendshipLink\Store;
-use App\Models\FriendshipLink;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Cache;
-
-class FriendshipLinkController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        $data = FriendshipLink::orderBy(DB::raw('sort is null,sort'))
-            ->withTrashed()
-            ->get();
-        $assign = compact('data');
-        return view('admin.friendshipLink.index', $assign);
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        return view('admin.friendshipLink.create');
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Store $request, FriendshipLink $friendshipLinkModel)
-    {
-        $data = $request->except('_token');
-        $result = $friendshipLinkModel->storeData($data);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:friendshipLink');
-        }
-        return redirect('admin/friendshipLink/index');
-
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id)
-    {
-        $data = FriendshipLink::find($id);
-        $assign = compact('data');
-        return view('admin.friendshipLink.edit', $assign);
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Store $request, $id, FriendshipLink $friendshipLinkModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $data = $request->except('_token');
-        $result = $friendshipLinkModel->updateData($map, $data);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:friendshipLink');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * 排序
-     *
-     * @param Request $request
-     * @param FriendshipLink $friendshipLinkModel
-     * @return \Illuminate\Http\RedirectResponse
-     */
-    public function sort(Request $request, FriendshipLink $friendshipLinkModel)
-    {
-        $data = $request->except('_token');
-        $editData = [];
-        foreach ($data as $k => $v) {
-            $editData[] = [
-                'id' => $k,
-                'sort' => $v
-            ];
-        }
-        $result = $friendshipLinkModel->updateBatch($editData);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:friendshipLink');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id, FriendshipLink $friendshipLinkModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $result = $friendshipLinkModel->destroyData($map);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:friendshipLink');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * 恢复删除的友情链接
-     *
-     * @param                $id
-     * @param FriendshipLink $friendshipLinkModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function restore($id, FriendshipLink $friendshipLinkModel)
-    {
-        $result = $friendshipLinkModel->where('id', $id)->restore();
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:friendshipLink');
-        }
-        return redirect('admin/friendshipLink/index');
-    }
-
-    /**
-     * 彻底删除友情链接
-     *
-     * @param                $id
-     * @param FriendshipLink $friendshipLinkModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function forceDelete($id, FriendshipLink $friendshipLinkModel)
-    {
-        $friendshipLinkModel->where('id', $id)->forceDelete();
-        return redirect('admin/friendshipLink/index');
-    }
-}

+ 0 - 168
app/Http/Controllers/Admin/GitProjectController.php

@@ -1,168 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Http\Requests\GitProject\Store;
-use App\Models\GitProject;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Cache;
-
-class GitProjectController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        $data = GitProject::orderBy('sort')
-            ->withTrashed()
-            ->get();
-        $gitProjectType = [
-            1 => 'github',
-            2 => 'gitee'
-        ];
-        $assign = compact('data', 'gitProjectType');
-        return view('admin.gitProject.index', $assign);
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        return view('admin.gitProject.create');
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Store $request, GitProject $gitProjectModel)
-    {
-        $data = $request->except('_token');
-        $result = $gitProjectModel->storeData($data);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:gitProject');
-        }
-        return redirect('admin/gitProject/index');
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id)
-    {
-        $data = GitProject::find($id);
-        $assign = compact('data');
-        return view('admin.gitProject.edit', $assign);
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, $id, GitProject $gitProjectModel)
-    {
-        $data = $request->except('_token');
-        $map = [
-            'id' => $id
-        ];
-        $result = $gitProjectModel->updateData($map, $data);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:gitProject');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * 排序
-     *
-     * @param Request    $request
-     * @param GitProject $gitProjectModel
-     *
-     * @return \Illuminate\Http\RedirectResponse
-     */
-    public function sort(Request $request, GitProject $gitProjectModel)
-    {
-        $data = $request->except('_token');
-        $editData = [];
-        foreach ($data as $k => $v) {
-            $editData[] = [
-                'id' => $k,
-                'sort' => $v
-            ];
-        }
-        $result = $gitProjectModel->updateBatch($editData);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:gitProject');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id, GitProject $gitProjectModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $result = $gitProjectModel->destroyData($map);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:gitProject');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * 恢复删除的开源项目
-     *
-     * @param            $id
-     * @param GitProject $gitProjectModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function restore($id, GitProject $gitProjectModel)
-    {
-        $result = $gitProjectModel->where('id', $id)->restore();
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:gitProject');
-        }
-        return redirect('admin/gitProject/index');
-    }
-
-    /**
-     * 彻底删除开源项目
-     *
-     * @param            $id
-     * @param GitProject $gitProjectModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function forceDelete($id, GitProject $gitProjectModel)
-    {
-        $gitProjectModel->where('id', $id)->forceDelete();
-        return redirect('admin/gitProject/index');
-    }
-}

+ 0 - 47
app/Http/Controllers/Admin/IndexController.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use DB;
-use App\Models\Article;
-use App\Models\Chat;
-use App\Models\Comment;
-use App\Models\OauthUser;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class IndexController extends Controller
-{
-    /**
-     * 后台首页
-     *
-     * @return mixed
-     */
-    public function index(Comment $commentModel)
-    {
-        // 文章总数
-        $articleCount = Article::count();
-        // 评论总数
-        $commentCount = Comment::count();
-        // 随言碎语总数
-        $chatCount = Chat::count();
-        // 用户总数
-        $oauthUserCount = OauthUser::count();
-        // 最新登录的5个用户
-        $oauthUserData = OauthUser::select('name', 'avatar', 'login_times', 'updated_at')
-            ->orderBy('updated_at', 'desc')
-            ->limit(5)
-            ->get();
-        // 最新的5条评论
-        $commentData = $commentModel->getNewData(5);
-        $version = [
-            'system' => PHP_OS,
-            'webServer' => $_SERVER['SERVER_SOFTWARE'],
-            'php' => PHP_VERSION,
-            'mysql' => DB::select('SHOW VARIABLES LIKE "version"')[0]->Value
-        ];
-        $assign = compact('articleCount', 'commentCount', 'chatCount', 'oauthUserCount', 'oauthUserData', 'commentData', 'version');
-        return view('admin.index.index', $assign);
-    }
-
-}

+ 0 - 40
app/Http/Controllers/Admin/LoginController.php

@@ -1,40 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Models\OauthUser;
-use Auth;
-use App\Http\Controllers\Controller;
-
-class LoginController extends Controller
-{
-    /**
-     * 登录页面
-     *
-     * @return mixed
-     */
-    public function index(OauthUser $oauthUserModel)
-    {
-        // 获取是否有第三方用户被设置为管理员
-        $count = $oauthUserModel->where('is_admin', 1)->count();
-        // 如果有第三方账号管理员;则通过第三方账号登录
-        if ($count) {
-            die('请通过第三方账号登录');
-        } else {
-            return view('admin.login.index');
-        }
-    }
-
-    /**
-     * 退出登录
-     *
-     * @return mixed
-     */
-    public function logout()
-    {
-        Auth::logout();
-        return redirect('admin/login/index');
-    }
-
-
-}

+ 0 - 98
app/Http/Controllers/Admin/OauthUserController.php

@@ -1,98 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Models\OauthUser;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class OauthUserController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        $data = OauthUser::orderBy('updated_at', 'desc')
-            ->select('id', 'name', 'type', 'email', 'login_times', 'is_admin', 'created_at', 'updated_at')
-            ->paginate(50);
-        $assign = compact('data');
-        return view('admin.oauthUser.index', $assign);
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        //
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function show($id)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id)
-    {
-        $data = OauthUser::find($id);
-        $assign = compact('data');
-        return view('admin.oauthUser.edit', $assign);
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, $id, OauthUser $oauthUserModel)
-    {
-        $data = $request->except('_token');
-        $data['is_admin'] = $request->input('is_admin', 0);
-        $map = [
-            'id' => $id
-        ];
-        $oauthUserModel->updateData($map, $data);
-        return redirect()->back();
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id)
-    {
-        //
-    }
-}

+ 0 - 138
app/Http/Controllers/Admin/TagController.php

@@ -1,138 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Http\Requests\Tag\Store;
-use App\Models\Tag;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Cache;
-
-class TagController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index(Tag $tagModel)
-    {
-        $data = $tagModel::withTrashed()->get();
-        $assign = compact('data');
-        return view('admin.tag.index', $assign);
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        return view('admin.tag.create');
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Store $request, Tag $tagModel)
-    {
-        $data = [
-            'name' => $request->input('name')
-        ];
-        $result = $tagModel->storeData($data);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:tag');
-        }
-        return redirect('admin/tag/index');
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id, Tag $tagModel)
-    {
-        $data = $tagModel->find($id);
-        $assign = compact('data');
-        return view('admin.tag.edit', $assign);
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, $id, Tag $tagModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $data = $request->except('_token');
-        $result = $tagModel->updateData($map, $data);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:tag');
-        }
-        return redirect()->back();
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id, Tag $tagModel)
-    {
-        $map = [
-            'id' => $id
-        ];
-        $result = $tagModel->destroyData($map);
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:tag');
-        }
-        return redirect('admin/tag/index');
-    }
-
-    /**
-     * 恢复删除的标签
-     *
-     * @param         $id
-     * @param Tag     $tagModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function restore($id, Tag $tagModel)
-    {
-        $result = $tagModel->where('id', $id)->restore();
-        if ($result) {
-            // 更新缓存
-            Cache::forget('common:tag');
-        }
-        return redirect('admin/tag/index');
-    }
-
-    /**
-     * 彻底删除标签
-     *
-     * @param         $id
-     * @param Tag     $tagModel
-     *
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function forceDelete($id, Tag $tagModel)
-    {
-        $tagModel->where('id', $id)->forceDelete();
-        return redirect('admin/tag/index');
-    }
-}

+ 0 - 97
app/Http/Controllers/Admin/UserController.php

@@ -1,97 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use App\Models\User;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class UserController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index(User $userModel)
-    {
-        $data = $userModel->get();
-        $assign = compact('data');
-        return view('admin.user.index', $assign);
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        //
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function show($id)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id)
-    {
-        $data = User::find($id);
-        $assign = compact('data');
-        return view('admin.user.edit', $assign);
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, $id, User $userModel)
-    {
-        $data = $request->except('_token');
-        // 如果不修改密码 则去掉password字段
-        $data = array_filter($data);
-        $map = [
-            'id' => $id
-        ];
-        $userModel->updateData($map, $data);
-        return redirect()->back();
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id)
-    {
-        //
-    }
-}

+ 0 - 40
app/Http/Controllers/Auth/AdminController.php

@@ -1,40 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\AuthenticatesUsers;
-
-class AdminController extends Controller
-{
-    /*
-      |--------------------------------------------------------------------------
-      | Login Controller
-      |--------------------------------------------------------------------------
-      |
-      | This controller handles authenticating users for the application and
-      | redirecting them to your home screen. The controller uses a trait
-      | to conveniently provide its functionality to your applications.
-      |
-      */
-
-    use AuthenticatesUsers;
-
-    /**
-     * Where to redirect users after login.
-     *
-     * @var string
-     */
-    protected $redirectTo = '/admin/index/index';
-
-    /**
-     * 显示登录页面
-     *
-     * @return mixed
-     */
-    public function index()
-    {
-        return view('login.public.index');
-    }
-}

+ 1 - 1
app/Http/Controllers/Auth/LoginController.php

@@ -34,6 +34,6 @@ class LoginController extends Controller
      */
     public function __construct()
     {
-        $this->middleware('guest', ['except' => 'logout']);
+        $this->middleware('guest')->except('logout');
     }
 }

+ 0 - 137
app/Http/Controllers/Auth/OAuthController.php

@@ -1,137 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use Auth;
-use App\Models\OauthUser;
-use Socialite;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class OAuthController extends Controller
-{
-    /**
-     * oauth跳转
-     *
-     * @param Request $request
-     * @param $service
-     * @return mixed
-     */
-    public function redirectToProvider(Request $request, $service)
-    {
-        // 记录登录前的url
-        $data = [
-            'targetUrl' => $_SERVER['HTTP_REFERER']
-        ];
-        session($data);
-        return Socialite::driver($service)->redirect();
-    }
-
-    /**
-     * 获取用户资料并登录
-     *
-     * @param Request $request
-     * @param OauthUser $oauthUserModel
-     * @param $service
-     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
-     */
-    public function handleProviderCallback(Request $request, OauthUser $oauthUserModel, $service)
-    {
-        // 定义各种第三方登录的type对应的数字
-        $type = [
-            'qq' => 1,
-            'weibo' => 2,
-            'github' => 3
-        ];
-        // 获取用户资料
-        $user = Socialite::driver($service)->user();
-
-        // 组合存入session中的值
-        $sessionData = [
-            'user' => [
-                'name' => $user->nickname,
-                'type' => $type[$service],
-            ]
-        ];
-        // 查找此用户是否已经登录过
-        $countMap = [
-            'type' => $type[$service],
-            'openid' => $user->id
-        ];
-        $oldUserData = $oauthUserModel->select('id', 'login_times', 'is_admin', 'email')
-            ->where($countMap)
-            ->first();
-        // 如果已经存在;则更新用户资料  如果不存在;则插入数据
-        if ($oldUserData) {
-            $userId = $oldUserData->id;
-            $editMap = [
-                'id' => $userId
-            ];
-            $editData = [
-                'name' => $user->nickname,
-                'access_token' => $user->token,
-                'last_login_ip' => $request->getClientIp(),
-                'login_times' => $oldUserData->login_times+1,
-            ];
-            // 更新数据
-            $oauthUserModel->updateData($editMap, $editData);
-            // 组合session中要用到的数据
-            $sessionData['user']['id'] = $userId;
-            $sessionData['user']['email'] = $oldUserData->email;
-            $sessionData['user']['is_admin'] = $oldUserData->is_admin;
-        } else {
-            $data = [
-                'type' => $type[$service],
-                'name' => $user->nickname,
-                'openid' => $user->id,
-                'access_token' => $user->token,
-                'last_login_ip' => $request->getClientIp(),
-                'login_times' => 1,
-                'is_admin' => 0,
-                'email' => ''
-            ];
-            // 新增数据
-            $userId = $oauthUserModel->storeData($data);
-            // 组合头像地址
-            $avatarPath = '/uploads/avatar/'.$userId.'.jpg';
-            // 更新头像
-            $editMap = [
-                'id' => $userId
-            ];
-            $editData = [
-                'avatar' => $avatarPath
-            ];
-            $oauthUserModel->updateData($editMap, $editData);
-            // 组合session中要用到的数据
-            $sessionData['user']['id'] = $userId;
-            $sessionData['user']['email'] = '';
-            $sessionData['user']['is_admin'] = 0;
-        }
-        // 下载最新的头像到本地
-        $avatarContent = curl_get_contents($user->avatar);
-        $avatarPath = public_path('uploads/avatar/'.$userId.'.jpg');
-        // 如果下载失败;则使用默认图片
-        if (empty($avatarContent)) {
-            copy(public_path('uploads/avatar/default.jpg'), $avatarPath);
-        } else {
-            file_put_contents($avatarPath, $avatarContent);
-        }
-        $sessionData['user']['avatar'] = url('uploads/avatar/'.$userId.'.jpg');
-        // 将数据存入session
-        session($sessionData);
-        // 如果session没有存储登录前的页面;则直接返回到首页
-        return redirect(session('targetUrl', url('/')));
-    }
-
-    /**
-     * 退出登录
-     *
-     * @return \Illuminate\Http\RedirectResponse
-     */
-    public function logout()
-    {
-        Auth::logout();
-        session()->forget('user');
-        return redirect()->back();
-    }
-}

+ 4 - 4
app/Http/Controllers/Auth/RegisterController.php

@@ -48,9 +48,9 @@ class RegisterController extends Controller
     protected function validator(array $data)
     {
         return Validator::make($data, [
-            'name' => 'required|max:255',
-            'email' => 'required|email|max:255|unique:users',
-            'password' => 'required|min:6|confirmed',
+            'name' => 'required|string|max:255',
+            'email' => 'required|string|email|max:255|unique:users',
+            'password' => 'required|string|min:6|confirmed',
         ]);
     }
 
@@ -58,7 +58,7 @@ class RegisterController extends Controller
      * Create a new user instance after a valid registration.
      *
      * @param  array  $data
-     * @return User
+     * @return \App\User
      */
     protected function create(array $data)
     {

+ 0 - 263
app/Http/Controllers/Home/IndexController.php

@@ -1,263 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Home;
-
-use App\Http\Requests\Comment\Store;
-use App\Models\Category;
-use App\Models\Article;
-use App\Models\ArticleTag;
-use App\Models\Chat;
-use App\Models\Comment;
-use App\Models\Config;
-use App\Models\OauthUser;
-use App\Models\Tag;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Cache;
-
-class IndexController extends Controller
-{
-    /**
-     * 首页
-     *
-     * @param Article $articleModel
-     * @return mixed
-     */
-    public function index(Article $articleModel)
-	{
-	    // 获取文章列表数据
-        $article = $articleModel->getHomeList();
-        $assign = [
-            'category_id' => 'index',
-            'article' => $article,
-            'tagName' => ''
-        ];
-		return view('home.index.index', $assign);
-	}
-
-    /**
-     * 文章详情
-     *
-     * @param         $id
-     * @param Article $articleModel
-     * @param Comment $commentModel
-     *
-     * @return $this
-     */
-    public function article($id, Request $request, Article $articleModel, Comment $commentModel)
-    {
-        // 获取文章数据
-        $data = $articleModel->getDataById($id);
-        // 去掉描述中的换行
-        $data->description = str_replace(["\r", "\n", "\r\n"], '', $data->description);
-        // 同一个用户访问同一篇文章每天只增加1个访问量  使用 ip+id 作为 key 判别
-        $ipAndId = 'articleRequestList'.$request->ip().':'.$id;
-        if (!Cache::has($ipAndId)) {
-            cache([$ipAndId => ''], 1440);
-            // 文章点击量+1
-            $data->increment('click');
-        }
-
-        // 获取上一篇
-        $prev = $articleModel
-            ->select('id', 'title')
-            ->orderBy('created_at', 'asc')
-            ->where('id', '>', $id)
-            ->limit(1)
-            ->first();
-
-        // 获取下一篇
-        $next = $articleModel
-            ->select('id', 'title')
-            ->orderBy('created_at', 'desc')
-            ->where('id', '<', $id)
-            ->limit(1)
-            ->first();
-
-        // 获取评论
-        $comment = $commentModel->getDataByArticleId($id);
-        $category_id = $data->category_id;
-        $assign = compact('category_id', 'data', 'prev', 'next', 'comment');
-        return view('home.index.article', $assign);
-    }
-
-    /**
-     * 获取栏目下的文章
-     *
-     * @param Article $articleModel
-     * @param $id
-     * @return mixed
-     */
-    public function category(Article $articleModel, $id)
-    {
-        $map = [
-            'articles.category_id' => $id
-        ];
-        $article = $articleModel->getHomeList($map);
-        $categoryName = Category::where('id', $id)->value('name');
-        $assign = [
-            'category_id' => $id,
-            'article' => $article,
-            'tagName' => '',
-            'title' => $categoryName
-        ];
-        return view('home.index.index', $assign);
-    }
-
-    /**
-     * 获取标签下的文章
-     *
-     * @param $id
-     * @param Article $articleModel
-     * @return mixed
-     */
-    public function tag($id, Article $articleModel)
-    {
-        // 获取标签名
-        $tagName = Tag::where('id', $id)->value('name');
-        // 获取此标签下的文章id
-        $articleIds = ArticleTag::where('tag_id', $id)
-            ->pluck('article_id')
-            ->toArray();
-        // 获取文章数据
-        $map = [
-            'articles.id' => ['in', $articleIds]
-        ];
-        $article = $articleModel->getHomeList($map);
-        $assign = [
-            'category_id' => 'index',
-            'article' => $article,
-            'tagName' => $tagName,
-            'title' => $tagName
-        ];
-        return view('home.index.index', $assign);
-
-    }
-
-    /**
-     * 随言碎语
-     *
-     * @return mixed
-     */
-    public function chat()
-    {
-        $chat = Chat::orderBy('created_at', 'desc')->get();
-        $assign =[
-            'category_id' => 'chat',
-            'chat' => $chat
-        ];
-        return view('home.index.chat', $assign);
-    }
-
-    /**
-     * 开源项目
-     *
-     * @return mixed
-     */
-    public function git()
-    {
-        $assign = [
-            'category_id' => 'git'
-        ];
-        return view('home.index.git', $assign);
-    }
-
-    /**
-     * 文章评论
-     *
-     * @param Comment $commentModel
-     */
-    public function comment(Store $request, Comment $commentModel, OauthUser $oauthUserModel)
-    {
-        $data = $request->all();
-        if (ctype_alnum($data['content']) || in_array($data['content'], ['test', '测试'])) {
-            return ajax_return(200, '禁止无意义评论');
-        }
-        // 获取用户id
-        $userId = session('user.id');
-        // 是否是管理员
-        $isAdmin = session('user.is_admin');
-        // 获取当前时间戳
-        $time = time();
-        // 获取最近一次评论时间
-        $lastCommentDate = $commentModel->where('oauth_user_id', $userId)
-            ->orderBy('created_at', 'desc')
-            ->value('created_at');
-        $lastCommentTime = strtotime($lastCommentDate);
-        // 限制1分钟内只许评论1次
-        if ($isAdmin !=1 && $time-$lastCommentTime < 60) {
-            return ajax_return(200, '评论太过频繁,请稍后再试.');
-        }
-        // 限制用户每天最多评论10条
-        $date = date('Y-m-d', $time);
-        $count = $commentModel
-            ->where('oauth_user_id', session('user.id'))
-            ->whereBetween('created_at', [$date.' 00:00:00', $date.' 23:59:59'])
-            ->count();
-        if ($isAdmin !=1 && $count > 10) {
-            return ajax_return(200, '每天做多评论10条');
-        }
-        // 如果用户输入邮箱;则将邮箱记录入oauth_user表中
-        $pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";
-        if (preg_match($pattern, $data['email'])) {
-            // 修改邮箱
-            $oauthUserMap = [
-                'id' => $userId
-            ];
-            $oauthUserData = [
-                'email' => $data['email']
-            ];
-            $oauthUserModel->updateData($oauthUserMap, $oauthUserData);
-            session(['user.email' => $data['email']]);
-            unset($data['email']);
-        }
-        // 存储评论
-        $id = $commentModel->storeData($data);
-        // 更新缓存
-        Cache::forget('common:newComment');
-        return ajax_return(200, ['id' => $id]);
-    }
-
-    /**
-     * 检测是否登录
-     */
-    public function checkLogin()
-    {
-        if (empty(session('user.id'))) {
-            return 0;
-        } else {
-            return 1;
-        }
-    }
-
-    /**
-     * 搜索文章
-     *
-     * @param Article $articleModel
-     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
-     */
-    public function search(Article $articleModel){
-        $wd = request()->input('wd');
-        $map = [
-            'title' => ['like', '%'.$wd.'%']
-        ];
-        $article = $articleModel->getHomeList($map);
-        $assign = [
-            'category_id' => 'index',
-            'article' => $article,
-            'tagName' => '',
-            'title' => $wd
-        ];
-        return view('home.index.index', $assign);
-    }
-
-    /**
-     * 用于做测试的方法
-     */
-    public function test()
-    {
-        
-    }
-
-
-}

+ 0 - 21
app/Http/Controllers/Hook/OschinaController.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Hook;
-
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class OschinaController extends Controller
-{
-    /**
-     * 接受git push 后的hook事件
-     */
-    public function push()
-    {
-        $data = request()->all();
-        if ($data['password'] === env('OSCHINA_HOOK_PASSWORD')) {
-            // 拉取并 composer update
-            shell_exec('cd '.base_path().' && git pull && composer install');
-        }
-    }
-}

+ 5 - 2
app/Http/Kernel.php

@@ -2,7 +2,6 @@
 
 namespace App\Http;
 
-use App\Http\Middleware\AdminAuth;
 use Illuminate\Foundation\Http\Kernel as HttpKernel;
 
 class Kernel extends HttpKernel
@@ -16,6 +15,10 @@ class Kernel extends HttpKernel
      */
     protected $middleware = [
         \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
+        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
+        \App\Http\Middleware\TrimStrings::class,
+        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
+        \App\Http\Middleware\TrustProxies::class,
     ];
 
     /**
@@ -28,6 +31,7 @@ class Kernel extends HttpKernel
             \App\Http\Middleware\EncryptCookies::class,
             \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
             \Illuminate\Session\Middleware\StartSession::class,
+            // \Illuminate\Session\Middleware\AuthenticateSession::class,
             \Illuminate\View\Middleware\ShareErrorsFromSession::class,
             \App\Http\Middleware\VerifyCsrfToken::class,
             \Illuminate\Routing\Middleware\SubstituteBindings::class,
@@ -53,6 +57,5 @@ class Kernel extends HttpKernel
         'can' => \Illuminate\Auth\Middleware\Authorize::class,
         'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
         'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
-        'admin.auth' => \App\Http\Middleware\AdminAuth::class,
     ];
 }

+ 0 - 24
app/Http/Middleware/AdminAuth.php

@@ -1,24 +0,0 @@
-<?php
-
-namespace App\Http\Middleware;
-
-use Closure;
-
-class AdminAuth
-{
-    /**
-     * Handle an incoming request.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \Closure  $next
-     * @return mixed
-     */
-    public function handle($request, Closure $next)
-    {
-        // 如果不是管理员或者没有登录;则重定向到登录页面
-        if (session('user.is_admin') !== 1) {
-            return redirect('admin/login/index');
-        }
-        return $next($request);
-    }
-}

+ 2 - 2
app/Http/Middleware/EncryptCookies.php

@@ -2,9 +2,9 @@
 
 namespace App\Http\Middleware;
 
-use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
+use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
 
-class EncryptCookies extends BaseEncrypter
+class EncryptCookies extends Middleware
 {
     /**
      * The names of the cookies that should not be encrypted.

+ 18 - 0
app/Http/Middleware/TrimStrings.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
+
+class TrimStrings extends Middleware
+{
+    /**
+     * The names of the attributes that should not be trimmed.
+     *
+     * @var array
+     */
+    protected $except = [
+        'password',
+        'password_confirmation',
+    ];
+}

+ 29 - 0
app/Http/Middleware/TrustProxies.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Illuminate\Http\Request;
+use Fideloper\Proxy\TrustProxies as Middleware;
+
+class TrustProxies extends Middleware
+{
+    /**
+     * The trusted proxies for this application.
+     *
+     * @var array
+     */
+    protected $proxies;
+
+    /**
+     * The current proxy header mappings.
+     *
+     * @var array
+     */
+    protected $headers = [
+        Request::HEADER_FORWARDED => 'FORWARDED',
+        Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
+        Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
+        Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
+        Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
+    ];
+}

+ 3 - 4
app/Http/Middleware/VerifyCsrfToken.php

@@ -2,9 +2,9 @@
 
 namespace App\Http\Middleware;
 
-use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
+use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
 
-class VerifyCsrfToken extends BaseVerifier
+class VerifyCsrfToken extends Middleware
 {
     /**
      * The URIs that should be excluded from CSRF verification.
@@ -12,7 +12,6 @@ class VerifyCsrfToken extends BaseVerifier
      * @var array
      */
     protected $except = [
-        'admin/article/uploadImage',
-        'hook/*'
+        //
     ];
 }

+ 0 - 64
app/Http/Requests/Article/Store.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace App\Http\Requests\Article;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Store extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        return [
-            'category_id'=>'required',
-            'title'=>'required',
-            'author'=>'required',
-            'keywords'=>'required',
-            'tag_ids'=>'required',
-            'markdown'=>'required'
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function attributes()
-    {
-        return [
-            'category_id'=>'分类',
-            'title'=>'标题',
-            'author'=>'作者',
-            'tag_ids'=>'标签',
-            'keywords'=>'关键词',
-            'markdown'=>'内容'
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function messages()
-    {
-        return [
-            'tag_ids.required'=>'必须选择标签',
-        ];
-    }
-}

+ 0 - 46
app/Http/Requests/Category/Store.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Http\Requests\Category;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Store extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        return [
-            'name'=>'required|unique:categories',
-            'keywords'=>'required',
-            'description'=>'required',
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function attributes()
-    {
-        return [
-            'name'=>'分类名',
-            'keywords'=>'关键字',
-            'description'=>'描述',
-        ];
-    }
-}

+ 0 - 46
app/Http/Requests/Category/Update.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Http\Requests\Category;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Update extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        return [
-            'name'=>'required|unique:categories,name,'.$this->route()->id,
-            'keywords'=>'required',
-            'description'=>'required',
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function attributes()
-    {
-        return [
-            'name'=>'分类名',
-            'keywords'=>'关键字',
-            'description'=>'描述',
-        ];
-    }
-}

+ 0 - 42
app/Http/Requests/Chat/Store.php

@@ -1,42 +0,0 @@
-<?php
-
-namespace App\Http\Requests\Chat;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Store extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        return [
-            'content'=>'required'
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function attributes()
-    {
-        return [
-            'content'=>'内容',
-        ];
-    }
-}

+ 0 - 46
app/Http/Requests/Comment/Store.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Http\Requests\Comment;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Store extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        return [
-            'article_id'=>'required|integer',
-            'pid'=>'required|integer',
-            'content'=>'required',
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function attributes()
-    {
-        return [
-            'article_id'=>'文章id',
-            'pid'=>'父级id',
-            'content'=>'内容',
-        ];
-    }
-}

+ 0 - 44
app/Http/Requests/FriendshipLink/Store.php

@@ -1,44 +0,0 @@
-<?php
-
-namespace App\Http\Requests\FriendshipLink;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Store extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        return [
-            'name'=>'required|unique:friendship_links,name,'.$this->route()->id,
-            'url'=>'required|unique:friendship_links,url,'.$this->route()->id,
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function attributes()
-    {
-        return [
-            'name'=>'名称',
-            'url'=>'链接',
-        ];
-    }
-}

+ 0 - 42
app/Http/Requests/GitProject/Store.php

@@ -1,42 +0,0 @@
-<?php
-
-namespace App\Http\Requests\GitProject;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Store extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        return [
-            'name'=>'required|unique:friendship_links,name,'.$this->route()->id,
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function attributes()
-    {
-        return [
-            'name'=>'项目',
-        ];
-    }
-}

+ 0 - 42
app/Http/Requests/Tag/Store.php

@@ -1,42 +0,0 @@
-<?php
-
-namespace App\Http\Requests\Tag;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Store extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        return [
-            'name'=>'required|unique:categories',
-        ];
-    }
-
-    /**
-     * 定义字段名中文
-     *
-     * @return array
-     */
-    public function attributes()
-    {
-        return [
-            'name'=>'分类名',
-        ];
-    }
-}

+ 0 - 68
app/Jobs/SendCommentEmail.php

@@ -1,68 +0,0 @@
-<?php
-
-namespace App\Jobs;
-
-use App\Models\OauthUser;
-use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Contracts\Queue\ShouldQueue;
-
-class SendCommentEmail implements ShouldQueue
-{
-    use InteractsWithQueue, Queueable, SerializesModels;
-
-    /**
-     * 收件人邮箱地址
-     *
-     * @var
-     */
-    protected $email;
-
-    /**
-     * 收件人名称
-     *
-     * @var
-     */
-    protected $name;
-
-    /**
-     * 邮件标题
-     *
-     * @var
-     */
-    protected $subject;
-
-    /**
-     * 评论内容
-     *
-     * @var $content
-     */
-    protected $content;
-
-    /**
-     * SendCommentEmail constructor.
-     *
-     * @param       $email
-     * @param       $name
-     * @param       $subject
-     * @param array $content
-     */
-    public function __construct($email, $name, $subject, array $content)
-    {
-        $this->email = $email;
-        $this->name = $name;
-        $this->subject = $subject;
-        $this->content = $content;
-    }
-
-    /**
-     * Execute the job.
-     *
-     * @return void
-     */
-    public function handle()
-    {
-        send_email($this->email, $this->name, $this->subject, $this->content, 'emails.commentArticle');
-    }
-}

+ 0 - 411
app/Libraries/Functions/helpers.php

@@ -1,411 +0,0 @@
-<?php
-
-use HyperDown\Parser;
-use Intervention\Image\Facades\Image;
-use Illuminate\Support\Facades\Mail;
-use Illuminate\Support\Facades\Auth;
-
-if (!function_exists('p')) {
-	// 传递数据以易于阅读的样式格式化后输出
-	function p($data, $toArray = true)
-	{
-		// 定义样式
-		$str = '<pre style="display: block;padding: 9.5px;margin: 44px 0 0 0;font-size: 13px;line-height: 1.42857;color: #333;word-break: break-all;word-wrap: break-word;background-color: #F5F5F5;border: 1px solid #CCC;border-radius: 4px;">';
-		// 如果是 boolean 或者 null 直接显示文字;否则 print
-		if (is_bool($data)) {
-			$show_data = $data ? 'true' : 'false';
-		} elseif (is_null($data)) {
-			// 如果是null 直接显示null
-			$show_data = 'null';
-		} elseif (is_object($data) && in_array(get_parent_class($data), ['Illuminate\Support\Collection', 'App\Models\Base']) && $toArray) {
-			// 把一些集合转成数组形式来查看
-			$data_array = $data->toArray();
-			$show_data = '这是被转成数组的Collection:<br>' . print_r($data_array, true);
-		} elseif (is_object($data) && in_array(get_class($data), ['Maatwebsite\Excel\Readers\LaravelExcelReader']) && $toArray) {
-			// 把一些集合转成数组形式来查看
-			$data_array = $data->toArray();
-			$show_data = '这是被转成数组的Collection:<br>' . print_r($data_array, true);
-		} elseif (is_object($data) && in_array(get_class($data), ['Illuminate\Database\Eloquent\Builder'])) {
-			// 直接调用dd 查看
-			dd($data);
-		} else {
-			$show_data = print_r($data, true);
-		}
-		$str .= $show_data;
-		$str .= '</pre>';
-		echo $str;
-	}
-}
-
-if (!function_exists('pd')) {
-    // 传递数据以易于阅读的样式格式化后输出并die掉
-    function pd($data, $toArray = true)
-    {
-        p($data, $toArray);die;
-    }
-
-}
-
-if ( !function_exists('ajax_return') ) {
-	/**
-	 * ajax返回数据
-	 *
-	 * @param string $data 需要返回的数据
-	 * @param int $status_code
-	 * @return \Illuminate\Http\JsonResponse
-	 */
-	function ajax_return($status_code = 200, $data = '')
-	{
-		//如果如果是错误 返回错误信息
-		if ($status_code != 200) {
-			//增加status_code
-			$data = ['status_code' => $status_code, 'message' => $data,];
-			return response()->json($data, $status_code);
-		}
-		//如果是对象 先转成数组
-		if (is_object($data)) {
-			$data = $data->toArray();
-		}
-		/**
-		 * 将数组递归转字符串
-		 * @param  array $arr 需要转的数组
-		 * @return array       转换后的数组
-		 */
-		function to_string($arr)
-		{
-			// app 禁止使用和为了统一字段做的判断
-			$reserved_words = [];
-			foreach ($arr as $k => $v) {
-				//如果是对象先转数组
-				if (is_object($v)) {
-					$v = $v->toArray();
-				}
-				//如果是数组;则递归转字符串
-				if (is_array($v)) {
-					$arr[$k] = to_string($v);
-				} else {
-					//判断是否有移动端禁止使用的字段
-					in_array($k, $reserved_words, true) && die('不允许使用【' . $k . '】这个键名 —— 此提示是helper.php 中的ajaxReturn函数返回的');
-					//转成字符串类型
-					$arr[$k] = strval($v);
-				}
-			}
-			return $arr;
-		}
-
-		//判断是否有返回的数据
-		if (is_array($data)) {
-			//先把所有字段都转成字符串类型
-			$data = to_string($data);
-		}
-		return response()->json($data, $status_code);
-	}
-}
-
-if ( !function_exists('send_email') ) {
-	/**
-	 * 发送邮件函数
-	 *
-	 * @param $email            收件人邮箱  如果群发 则传入数组
-	 * @param $name             收件人名称
-	 * @param $subject          标题
-	 * @param array  $data      邮件模板中用的变量 示例:['name'=>'帅白','phone'=>'110']
-	 * @param string $template  邮件模板
-	 * @return array            发送状态
-	 */
-	function send_email($email, $name, $subject, $data = [], $template = 'emails.test')
-	{
-		Mail::send($template, $data, function ($message) use ($email, $name, $subject) {
-			//如果是数组;则群发邮件
-			if (is_array($email)) {
-				foreach ($email as $k => $v) {
-					$message->to($v, $name)->subject($subject);
-				}
-			} else {
-				$message->to($email, $name)->subject($subject);
-			}
-		});
-		if (count(Mail::failures()) > 0) {
-			$data = array('status_code' => 500, 'message' => '邮件发送失败');
-		} else {
-			$data = array('status_code' => 200, 'message' => '邮件发送成功');
-		}
-		return $data;
-	}
-}
-
-if ( !function_exists('upload') ) {
-	/**
-	 * 上传文件函数
-	 *
-	 * @param $file             表单的name名
-	 * @param string $path 上传的路径
-	 * @param bool $childPath 是否根据日期生成子目录
-	 * @return array            上传的状态
-	 */
-	function upload($file, $path = 'upload', $childPath = true)
-	{
-		//判断请求中是否包含name=file的上传文件
-		if (!request()->hasFile($file)) {
-			$data = ['status_code' => 500, 'message' => '上传文件为空'];
-			return $data;
-		}
-		$file = request()->file($file);
-		//判断文件上传过程中是否出错
-		if (!$file->isValid()) {
-			$data = ['status_code' => 500, 'message' => '文件上传出错'];
-			return $data;
-		}
-		//兼容性的处理路径的问题
-		if ($childPath == true) {
-			$path = './' . trim($path, './') . '/' . date('Ymd') . '/';
-		} else {
-			$path = './' . trim($path, './') . '/';
-		}
-		if (!is_dir($path)) {
-			mkdir($path, 0755, true);
-		}
-		//获取上传的文件名
-		$oldName = $file->getClientOriginalName();
-		//组合新的文件名
-		$newName = uniqid() . '.' . $file->getClientOriginalExtension();
-		//上传失败
-		if (!$file->move($path, $newName)) {
-			$data = ['status_code' => 500, 'message' => '保存文件失败'];
-			return $data;
-		}
-		//上传成功
-		$data = ['status_code' => 200, 'message' => '上传成功', 'data' => ['old_name' => $oldName, 'new_name' => $newName, 'path' => trim($path, '.')]];
-		return $data;
-	}
-}
-
-if ( !function_exists('get_uid') ) {
-	/**
-	 * 返回登录的用户id
-	 *
-	 * @return mixed 用户id
-	 */
-	function get_uid()
-	{
-		return Auth::id();
-	}
-}
-
-if (!function_exists('save_to_file')) {
-	/**
-	 * 将数组已json格式写入文件
-	 * @param  string $fileName 文件名
-	 * @param  array $data 数组
-	 */
-	function save_to_file($fileName = 'test', $data = array())
-	{
-		$path = storage_path('tmp' . DIRECTORY_SEPARATOR);
-		is_dir($path) || mkdir($path);
-		$fileName = str_replace('.php', '', $fileName);
-		$fileName = $path . $fileName . '_' . date('Y-m-d_H-i-s', time()) . '.php';
-		file_put_contents($fileName, json_encode($data));
-	}
-}
-
-if ( !function_exists('re_substr') ) {
-	/**
-	 * 字符串截取,支持中文和其他编码
-	 *
-	 * @param string  $str 需要转换的字符串
-	 * @param integer $start 开始位置
-	 * @param string  $length 截取长度
-	 * @param boolean $suffix 截断显示字符
-	 * @param string  $charset 编码格式
-	 * @return string
-	 */
-	function re_substr($str, $start = 0, $length, $suffix = true, $charset = "utf-8") {
-		$slice = mb_substr($str, $start, $length, $charset);
-		$omit = mb_strlen($str) >= $length ? '...' : '';
-		return $suffix ? $slice.$omit : $slice;
-	}
-}
-
-if ( !function_exists('Add_text_water') ) {
-    /**
-     * 给图片添加文字水印
-     *
-     * @param $file
-     * @param $text
-     * @param string $color
-     * @return mixed
-     */
-    function Add_text_water($file, $text, $color = '#0B94C1') {
-        $image = Image::make($file);
-        $image->text($text, $image->width()-20, $image->height()-30, function($font) use($color) {
-            $font->file(public_path('fonts/msyh.ttf'));
-            $font->size(15);
-            $font->color($color);
-            $font->align('right');
-            $font->valign('bottom');
-        });
-        $image->save($file);
-        return $image;
-    }
-}
-
-if ( !function_exists('word_time') ) {
-    /**
-     * 把日期或者时间戳转为距离现在的时间
-     *
-     * @param $time
-     * @return bool|string
-     */
-    function word_time($time) {
-        // 如果是日期格式的时间;则先转为时间戳
-        if (!is_integer($time)) {
-            $time = strtotime($time);
-        }
-        $int = time() - $time;
-        if ($int <= 2){
-            $str = sprintf('刚刚', $int);
-        }elseif ($int < 60){
-            $str = sprintf('%d秒前', $int);
-        }elseif ($int < 3600){
-            $str = sprintf('%d分钟前', floor($int / 60));
-        }elseif ($int < 86400){
-            $str = sprintf('%d小时前', floor($int / 3600));
-        }elseif ($int < 1728000){
-            $str = sprintf('%d天前', floor($int / 86400));
-        }else{
-            $str = date('Y-m-d H:i:s', $time);
-        }
-        return $str;
-    }
-}
-
-if ( !function_exists('markdown_to_html') ) {
-	/**
-	 * 把markdown转为html
-	 *
-	 * @param $markdown
-	 * @return mixed|string
-	 */
-	function markdown_to_html($markdown)
-	{
-		// 正则匹配到全部的iframe
-		preg_match_all('/&lt;iframe.*iframe&gt;/', $markdown, $iframe);
-		// 如果有iframe 则先替换为临时字符串
-		if (!empty($iframe[0])) {
-			$tmp = [];
-			// 组合临时字符串
-			foreach ($iframe[0] as $k => $v) {
-				$tmp[] = '【iframe'.$k.'】';
-			}
-			// 替换临时字符串
-			$markdown = str_replace($iframe[0], $tmp, $markdown);
-			// 讲iframe转义
-			$replace = array_map(function ($v){
-				return htmlspecialchars_decode($v);
-			}, $iframe[0]);
-		}
-		// markdown转html
-		$parser = new Parser();
-		$html = $parser->makeHtml($markdown);
-		$html = str_replace('<code class="', '<code class="lang-', $html);
-		// 将临时字符串替换为iframe
-		if (!empty($iframe[0])) {
-			$html = str_replace($tmp, $replace, $html);
-		}
-		return $html;
-	}
-}
-
-if ( !function_exists('strip_html_tags') ) {
-	/**
-	 * 删除指定标签
-	 *
-	 * @param array $tags     删除的标签  数组形式
-	 * @param string $str     html字符串
-	 * @param bool $content   true保留标签的内容text
-	 * @return mixed
-	 */
-	function strip_html_tags($tags, $str, $content = true)
-	{
-		$html = [];
-		// 是否保留标签内的text字符
-		if($content){
-			foreach ($tags as $tag) {
-				$html[] = '/(<' . $tag . '.*?>(.|\n)*?<\/' . $tag . '>)/is';
-			}
-		}else{
-			foreach ($tags as $tag) {
-				$html[] = "/(<(?:\/" . $tag . "|" . $tag . ")[^>]*>)/is";
-			}
-		}
-		$data = preg_replace($html, '', $str);
-		return $data;
-	}
-}
-
-if (!function_exists('flash_message')){
-    /**
-     * 添加成功或者失败的提示
-     *
-     * @param string $message
-     * @param bool $success
-     */
-    function flash_message($message = '成功', $success = true)
-    {
-        $className = $success ? 'alert-success' : 'alert-danger';
-        session()->flash('alert-message', $message);
-        session()->flash('alert-class', $className);
-    }
-}
-
-if (!function_exists('curl_get_contents')) {
-    /**
-     * 使用curl获取远程数据
-     * @param  string $url url连接
-     * @return string      获取到的数据
-     */
-    function curl_get_contents($url){
-        set_time_limit(0);
-        $ch=curl_init();
-        curl_setopt($ch, CURLOPT_URL, $url);                //设置访问的url地址
-        curl_setopt($ch, CURLOPT_TIMEOUT, 5);               //设置超时
-        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);   //用户访问代理 User-Agent
-        curl_setopt($ch, CURLOPT_REFERER,$_SERVER['HTTP_HOST']);        //设置 referer
-        curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);          //跟踪301
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);        //返回结果
-        $r=curl_exec($ch);
-        curl_close($ch);
-        return $r;
-    }
-}
-
-if (! function_exists('redis')) {
-    /**
-     * redis的便捷操作方法
-     *
-     * @param $key
-     * @param null $value
-     * @param null $expire
-     * @return bool|string
-     */
-    function redis($key = null, $value = null, $expire = null)
-    {
-        if (is_null($key)) {
-            return app('redis');
-        }
-
-        if (is_null($value)) {
-            $content = Redis::get($key);
-            if (is_null($content)) {
-                return null;
-            }
-            return is_null($content) ? null : unserialize($content);
-        }
-
-        Redis::set($key, serialize($value));
-        if (! is_null($expire)) {
-            Redis::expire($key, $expire);
-        }
-    }
-}
-

+ 0 - 44
app/Listeners/LoginStoreSession.php

@@ -1,44 +0,0 @@
-<?php
-
-namespace App\Listeners;
-
-use Illuminate\Auth\Events\Login;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Contracts\Queue\ShouldQueue;
-
-class LoginStoreSession
-{
-    /**
-     * Create the event listener.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-
-    }
-
-    /**
-     * Handle the event.
-     *
-     * @param  Login  $event
-     * @return void
-     */
-    public function handle(Login $event)
-    {
-        $user = $event->user;
-        // 组合存入session中的值
-        $sessionData = [
-            'user' => [
-                'id' => $user->id,
-                'name' => $user->name,
-                'avatar' => asset('statics/gentelella/production/images/img.jpg'),
-                'type' => 0,
-                'is_admin' => 1,
-                'email' => $user->email
-            ]
-        ];
-        // 将数据存入数据库
-        session($sessionData);
-    }
-}

+ 0 - 139
app/Models/Article.php

@@ -1,139 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class Article extends Base
-{
-    /**
-     * 添加文章
-     *
-     * @param array $data
-     * @return bool|mixed
-     */
-    public function storeData($data)
-    {
-        // 如果没有描述;则截取文章内容的前200字作为描述
-        if (empty($data['description'])) {
-            $description = preg_replace(array('/[~*>#-]*/', '/!?\[.*\]\(.*\)/', '/\[.*\]/'), '', $data['markdown']);
-            $data['description'] = re_substr($description, 0, 200, true);
-        }
-
-        // 给文章的插图添加水印;并取第一张图片作为封面图
-        $data['cover'] = $this->getCover($data['markdown']);
-        // 把markdown转html
-        $data['html'] = markdown_to_html($data['markdown']);
-        $tag_ids = $data['tag_ids'];
-        unset($data['tag_ids']);
-
-        //添加数据
-        $result=$this
-            ->create($data)
-            ->id;
-        if ($result) {
-            session()->flash('alert-message','添加成功');
-            session()->flash('alert-class','alert-success');
-
-            // 给文章添加标签
-            $articleTag = new ArticleTag();
-            $articleTag->addTagIds($result, $tag_ids);
-
-            return $result;
-        }else{
-            return false;
-        }
-    }
-
-    /**
-     * 给文章的插图添加水印;并取第一张图片作为封面图
-     *
-     * @param $content        markdown格式的文章内容
-     * @param array $except   忽略加水印的图片
-     * @return string
-     */
-    public function getCover($content, $except = [])
-    {
-        // 获取文章中的全部图片
-        preg_match_all('/!\[.*\]\((\S*).*\)/i', $content, $images);
-        if (empty($images[1])) {
-            $cover = 'uploads/article/default.jpg';
-        } else {
-            // 循环给图片添加水印
-            foreach ($images[1] as $k => $v) {
-                $image = explode(' ', $v);
-                $file = public_path().$image[0];
-                if (file_exists($file) && !in_array($v, $except)) {
-                    Add_text_water($file, 'baijunyao.com');
-                }
-
-                // 取第一张图片作为封面图
-                if ($k == 0) {
-                    $cover = $image[0];
-                }
-            }
-        }
-        return $cover;
-    }
-
-    /**
-     * 后台文章列表
-     *
-     * @return mixed
-     */
-    public function getAdminList()
-    {
-        $data = $this
-            ->select('articles.*', 'c.name as category_name')
-            ->join('categories as c', 'articles.category_id', 'c.id')
-            ->orderBy('created_at', 'desc')
-            ->withTrashed()
-            ->paginate(15);
-        return $data;
-    }
-
-    /**
-     * 获取前台文章列表
-     *
-     * @return mixed
-     */
-    public function getHomeList($map = [])
-    {
-        // 获取文章分页
-        $data = $this
-            ->whereMap($map)
-            ->select('articles.id', 'articles.title', 'articles.cover', 'articles.author', 'articles.description', 'articles.category_id', 'articles.created_at', 'c.name as category_name')
-            ->join('categories as c', 'articles.category_id', 'c.id')
-            ->orderBy('articles.created_at', 'desc')
-            ->paginate(10);
-        // 提取文章id组成一个数组
-        $dataArray = $data->toArray();
-        $article_id = array_column($dataArray['data'], 'id');
-        // 传递文章id数组获取标签数据
-        $articleTagModel = new ArticleTag();
-        $tag = $articleTagModel->getTagNameByArticleIds($article_id);
-        foreach ($data as $k => $v) {
-            $data[$k]->tag = isset($tag[$v->id]) ? $tag[$v->id] : [];
-        }
-        return $data;
-    }
-
-    /**
-     * 通过文章id获取数据
-     *
-     * @param $id
-     * @return mixed
-     */
-    public function getDataById($id)
-    {
-        $data = $this->select('articles.*', 'c.name as category_name')
-            ->join('categories as c', 'articles.category_id', 'c.id')
-            ->where('articles.id', $id)
-            ->withTrashed()
-            ->first();
-        $articleTag = new ArticleTag();
-        $tag = $articleTag->getTagNameByArticleIds([$id]);
-        // 处理标签可能为空的情况
-        $data['tag'] = empty($tag) ? [] : current($tag);
-        return $data;
-    }
-
-}

+ 0 - 53
app/Models/ArticleTag.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class ArticleTag extends Base
-{
-    /**
-     * 为文章批量插入标签
-     *
-     * @param $article_id
-     * @param $tag_ids
-     */
-    public function addTagIds($article_id, $tag_ids)
-    {
-        // 先删除此文章下的所有标签
-        $map = [
-            'article_id' => $article_id
-        ];
-        $this->whereMap($map)->forceDelete();
-        // 循环插入
-        foreach ($tag_ids as $v) {
-            $data = [
-                'article_id' => $article_id,
-                'tag_id' => $v
-            ];
-            $this->storeData($data);
-        }
-    }
-
-    /**
-     * 传递一个文章id数组;获取标签名
-     *
-     * @param $ids
-     * @return array
-     */
-    public function getTagNameByArticleIds($ids)
-    {
-        // 获取标签数据
-        $tag = $this
-            ->select('article_tags.article_id as id', 't.id as tag_id', 't.name')
-            ->join('tags as t', 'article_tags.tag_id', 't.id')
-            ->whereIn('article_tags.article_id', $ids)
-            ->get();
-        $data = [];
-        // 组合成键名是文章id 键值是 标签数组
-        foreach ($tag as $k => $v) {
-            $data[$v->id][] = $v;
-        }
-        return $data;
-    }
-
-
-}

+ 0 - 220
app/Models/Base.php

@@ -1,220 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use DB;
-use Artisan;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Database\Eloquent\SoftDeletes;
-
-class Base extends Model
-{
-    // 软删除
-    use SoftDeletes;
-    /**
-     * 禁止被批量赋值的字段
-     *
-     * @var array
-     */
-    protected $guarded = [];
-
-    /**
-     * 添加数据
-     *
-     * @param  array $data 需要添加的数据
-     * @return bool        是否成功
-     */
-    public function storeData($data)
-    {
-        //添加数据
-        $result=$this
-            ->create($data)
-            ->id;
-        if ($result) {
-            flash_message('添加成功');
-            return $result;
-        }else{
-            return false;
-        }
-    }
-
-    /**
-     * 修改数据
-     *
-     * @param  array $map  where条件
-     * @param  array $data 需要修改的数据
-     * @return bool        是否成功
-     */
-    public function updateData($map, $data)
-    {
-        $model = $this
-            ->whereMap($map)
-            ->withTrashed()
-            ->get();
-        // 可能有查不到数据的情况
-        if ($model->isEmpty()) {
-            flash_message('无需要添加的数据', false);
-            return false;
-        }
-        foreach ($model as $k => $v) {
-            $result = $v->forceFill($data)->save();
-        }
-        if ($result) {
-            flash_message('修改成功');
-            return $result;
-        }else{
-            return false;
-        }
-    }
-
-    /**
-     * 删除数据
-     *
-     * @param  array $map   where 条件数组形式
-     * @return bool         是否成功
-     */
-    public function destroyData($map)
-    {
-        //软删除
-        $result=$this
-            ->where($map)
-            ->delete();
-        if ($result) {
-            flash_message('操作成功');
-            return $result;
-        }else{
-            return false;
-        }
-    }
-
-    /**
-     * 恢复数据
-     *
-     * @param $map
-     *
-     * @return bool
-     */
-    public function restoreData($map)
-    {
-        // 恢复
-        $result=$this
-            ->where($map)
-            ->restore();
-        if ($result) {
-            flash_message('操作成功');
-            return $result;
-        }else{
-            return false;
-        }
-    }
-
-
-    /**
-     * 使用作用域扩展 Builder 链式操作
-     *
-     * 示例:
-     * $map = [
-     *     'id' => ['in', [1,2,3]],
-     *     'category_id' => ['<>', 9],
-     *     'tag_id' => 10
-     * ]
-     *
-     * @param $query
-     * @param $map
-     * @return mixed
-     */
-    public function scopeWhereMap($query, $map)
-    {
-        // 如果是空直接返回
-        if (empty($map)) {
-            return $query;
-        }
-
-        // 判断各种方法
-        foreach ($map as $k => $v) {
-            if (is_array($v)) {
-                $sign = strtolower($v[0]);
-                switch ($sign) {
-                    case 'in':
-                        $query->whereIn($k, $v[1]);
-                        break;
-                    case 'notin':
-                        $query->whereNotIn($k, $v[1]);
-                        break;
-                    case 'between':
-                        $query->whereBetween($k, $v[1]);
-                        break;
-                    case 'notbetween':
-                        $query->whereNotBetween($k, $v[1]);
-                        break;
-                    case 'null':
-                        $query->whereNull($k);
-                        break;
-                    case 'notnull':
-                        $query->whereNotNull($k);
-                        break;
-                    case '=':
-                    case '>':
-                    case '<':
-                    case '<>':
-                    case 'like':
-                        $query->where($k, $sign, $v[1]);
-                        break;
-                }
-            } else {
-                $query->where($k, $v);
-            }
-
-        }
-        return $query;
-    }
-
-    /**
-     * 批量更新的方法
-     * 示例参数
-     * $multipleData = [
-     *    [
-     *        'name' => 'name 1' ,
-     *        'date' => 'date 1'
-     *     ],
-     *     [
-     *        'name' => 'name 2' ,
-     *        'date' => 'date 2'
-     *      ]
-     *   ]
-     *
-     * @param array $multipleData
-     * @return bool|int
-     */
-    function updateBatch($multipleData = []){
-        if (empty($multipleData)) {
-            return false;
-        }
-        // 获取表名
-        $tableName = config('database.connections.mysql.prefix').$this->getTable();
-        $updateColumn = array_keys($multipleData[0]);
-        $referenceColumn = $updateColumn[0];
-        unset($updateColumn[0]);
-        $whereIn = "";
-        // 组合sql语句
-        $sql = "UPDATE ".$tableName." SET ";
-        foreach ( $updateColumn as $uColumn ) {
-            $sql .=  $uColumn." = CASE ";
-            foreach( $multipleData as $data ) {
-                $sql .= "WHEN ".$referenceColumn." = '".$data[$referenceColumn]."' THEN '".$data[$uColumn]."' ";
-            }
-            $sql .= "ELSE ".$uColumn." END, ";
-        }
-        foreach( $multipleData as $data ) {
-            $whereIn .= "'".$data[$referenceColumn]."', ";
-        }
-        $sql = rtrim($sql, ", ")." WHERE ".$referenceColumn." IN (".  rtrim($whereIn, ', ').")";
-        // 更新
-        $result = DB::update(DB::raw($sql));
-        if ($result) {
-            flash_message('添加成功');
-        }
-        return $result;
-
-    }
-}

+ 0 - 30
app/Models/Category.php

@@ -1,30 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class Category extends Base
-{
-    /**
-     * 删除数据
-     *
-     * @param array $map
-     * @return bool
-     */
-    public function destroyData($map)
-    {
-        // 先获取分类id
-        $categoryIdArray = $this
-            ->whereMap($map)
-            ->pluck('id')
-            ->toArray();
-        // 获取分类下的文章数
-        $articleCount = Article::whereIn('category_id', $categoryIdArray)->count();
-        // 如果分类下存在文章;则需要下删除文章
-        if ($articleCount !== 0) {
-            flash_message('请先删除此分类下的文章', false);
-            return false;
-        }
-        // 删除分类
-        return parent::destroyData($map);
-    }
-}

+ 0 - 8
app/Models/Chat.php

@@ -1,8 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class Chat extends Base
-{
-    //
-}

File diff suppressed because it is too large
+ 0 - 266
app/Models/Comment.php


+ 0 - 8
app/Models/Config.php

@@ -1,8 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class Config extends Base
-{
-
-}

+ 0 - 53
app/Models/FriendshipLink.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class FriendshipLink extends Base
-{
-
-    /**
-     * 添加数据
-     *
-     * @param array $data
-     * @return bool
-     */
-    public function storeData($data)
-    {
-        // 如果排序是空;则设置为null
-        $data['sort'] = empty($data['sort']) ? null : $data['sort'];
-        return parent::storeData($data);
-    }
-
-    /**
-     * 修改数据
-     *
-     * @param array $map
-     * @param array $data
-     * @return bool
-     */
-    public function updateData($map, $data)
-    {
-        // 如果要修改sort;且sort是空;则设置为null
-        if (isset($data['sort']) && empty($data['sort'])) {
-            $data['sort'] = null;
-        }
-        return parent::updateData($map, $data);
-    }
-
-    /**
-     * 给url添加http 或者删除/
-     *
-     * @param  string  $value
-     * @return string
-     */
-    public function setFirstNameAttribute($value)
-    {
-        // 如果没有http 则补上http
-        if (strpos($value, 'http') === false) {
-            $value = 'http://'.$value;
-        }
-        // 删除右侧的/
-        $value = rtrim($value, '/');
-        $this->attributes['first_name'] = strtolower($value);
-    }
-}

+ 0 - 8
app/Models/GitProject.php

@@ -1,8 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class GitProject extends Base
-{
-    //
-}

+ 0 - 8
app/Models/OauthUser.php

@@ -1,8 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class OauthUser extends Base
-{
-    
-}

+ 0 - 50
app/Models/Tag.php

@@ -1,50 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use DB;
-
-class Tag extends Base
-{
-    /**
-     * 获取标签下的文章数统计
-     *
-     * @return mixed
-     */
-    public function getArticleCount()
-    {
-        $prefix = config('database.connections.mysql.prefix');
-        $data = $this->select(DB::raw($prefix.'tags.*, count('.$prefix.'at.article_id) as article_count'))
-            ->join('article_tags as at', 'at.tag_id', 'tags.id')
-            ->rightJoin('articles as a', 'a.id', 'at.article_id')
-            ->where('a.deleted_at', null)
-            ->groupBy('tags.id')
-            ->get();
-        return $data;
-    }
-
-    /**
-     * 删除数据
-     *
-     * @param array $map
-     * @return bool
-     */
-    public function destroyData($map)
-    {
-        // 先获取分类id
-        $tagIdArray = $this
-            ->whereMap($map)
-            ->pluck('id')
-            ->toArray();
-        // 获取分类下的文章数
-        $articleCount = ArticleTag::whereIn('tag_id', $tagIdArray)->count();
-        // 如果分类下存在文章;则需要下删除文章
-        if ($articleCount !== 0) {
-            flash_message('请先删除此标签下的文章', false);
-            return false;
-        }
-        return parent::destroyData($map);
-    }
-
-
-}

+ 0 - 33
app/Models/User.php

@@ -1,33 +0,0 @@
-<?php
-
-namespace App\Models;
-
-class User extends Base
-{
-    /**
-     * The attributes that should be hidden for arrays.
-     *
-     * @var array
-     */
-    protected $hidden = [
-        'password', 'remember_token',
-    ];
-
-    /**
-     * 修改数据
-     *
-     * @param $map  where条件
-     * @param $data 需要修改的数据
-     * @return bool 是否成功
-     */
-    public function updateData($map, $data)
-    {
-        //如果传password 则加密
-        if (!empty($data['password'])) {
-            $data['password']=bcrypt($data['password']);
-        }
-        return parent::updateData($map, $data);
-    }
-
-
-}

+ 2 - 107
app/Providers/AppServiceProvider.php

@@ -2,20 +2,7 @@
 
 namespace App\Providers;
 
-use App\Models\Article;
-use App\Models\Category;
-use App\Models\Comment;
-use App\Models\Config;
-use App\Models\FriendshipLink;
-use App\Models\GitProject;
-use App\Models\Tag;
-use File;
-use Cache;
-use App\Observers\CacheClearObserver;
 use Illuminate\Support\ServiceProvider;
-use DB;
-use Illuminate\Database\QueryException;
-use Artisan;
 
 class AppServiceProvider extends ServiceProvider
 {
@@ -26,93 +13,7 @@ class AppServiceProvider extends ServiceProvider
      */
     public function boot()
     {
-        //分配前台通用的数据
-        view()->composer('home/*', function($view){
-            $category = Cache::remember('common:category', 10080, function () {
-                // 获取分类导航
-                return Category::select('id', 'name')->get();
-            });
-
-            $tag = Cache::remember('common:tag', 10080, function () {
-                // 获取标签下的文章数统计
-                $tagModel = new Tag();
-                return $tagModel->getArticleCount();
-            });
-
-            $topArticle = Cache::remember('common:topArticle', 10080, function () {
-                // 获取置顶推荐文章
-                return Article::select('id', 'title')
-                    ->where('is_top', 1)
-                    ->orderBy('created_at', 'desc')
-                    ->get();
-            });
-
-            $newComment = Cache::remember('common:newComment', 10080, function () {
-                // 获取最新评论
-                $commentModel = new Comment();
-                return $commentModel->getNewData();
-            });
-
-            $friendshipLink = Cache::remember('common:friendshipLink', 10080, function () {
-                // 获取友情链接
-                return FriendshipLink::select('name', 'url')
-                    ->orderBy('sort')
-                    ->get();
-            });
-
-            $gitProject = Cache::remember('common:gitProject', 10080, function () {
-                // 获取开源项目
-                return GitProject::select('name', 'type')->orderBy('sort')->get();
-            });
-
-            // 分配数据
-            $assign = compact('category', 'tag', 'topArticle', 'newComment', 'friendshipLink', 'gitProject');
-            $view->with($assign);
-        });
-
-        // 使用 try catch 是为了解决 composer install 时候触发 php artisan optimize 但此时无数据库的问题
-        try {
-            // 获取配置项
-            $config = Cache::remember('config', 10080, function () {
-                return Config::pluck('value','name');
-            });
-            // 解决初次安装时候没有数据引起报错
-            if ($config->isEmpty()) {
-                Artisan::call('cache:clear');
-            } else {
-                // 用 config 表中的配置项替换 /config/ 目录下文件中的配置项
-                $serviceConfig = [
-                    'services.github.client_id' => $config['GITHUB_CLIENT_ID'],
-                    'services.github.client_secret' => $config['GITHUB_CLIENT_SECRET'],
-
-                    'services.qq.client_id' => $config['QQ_APP_ID'],
-                    'services.qq.client_secret' => $config['QQ_APP_KEY'],
-
-                    'services.weibo.client_id' => $config['SINA_API_KEY'],
-                    'services.weibo.client_secret' => $config['SINA_SECRET'],
-                ];
-                config($serviceConfig);
-            }
-        } catch (QueryException $e) {
-            // 此处清除缓存是为了解决上面无数据库时缓存时 config 缓存了空数据 db:seed 后 config 走了缓存为空的问题
-            Artisan::call('cache:clear');
-            $config = [];
-        }
-        // 分配全站通用的数据
-        view()->composer('*', function ($view) use($config) {
-            $assign = [
-                'config' => $config
-            ];
-            // 获取赞赏捐款文章
-            if (!empty($config['QQ_QUN_ARTICLE_ID'])) {
-                $qqQunArticle = Cache::remember('qqQunArticle', 10080, function () use($config) {
-                    return Article::select('id', 'title')->where('id', $config['QQ_QUN_ARTICLE_ID'])->first();
-                });
-                $assign['qqQunArticle'] = $qqQunArticle;
-            }
-            $view->with($assign);
-
-        });
+        //
     }
 
     /**
@@ -122,12 +23,6 @@ class AppServiceProvider extends ServiceProvider
      */
     public function register()
     {
-        // 逆向迁移
-        if ($this->app->environment() !== 'production') {
-            $this->app->register(\Way\Generators\GeneratorsServiceProvider::class);
-            $this->app->register(\Xethron\MigrationsGenerator\MigrationsGeneratorServiceProvider::class);
-            // laravel-ide-helper ide支持
-            $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
-        }
+        //
     }
 }

+ 1 - 6
app/Providers/BroadcastServiceProvider.php

@@ -16,11 +16,6 @@ class BroadcastServiceProvider extends ServiceProvider
     {
         Broadcast::routes();
 
-        /*
-         * Authenticate the user's personal channel...
-         */
-        Broadcast::channel('App.User.*', function ($user, $userId) {
-            return (int) $user->id === (int) $userId;
-        });
+        require base_path('routes/channels.php');
     }
 }

+ 2 - 6
app/Providers/EventServiceProvider.php

@@ -13,13 +13,9 @@ class EventServiceProvider extends ServiceProvider
      * @var array
      */
     protected $listen = [
-        'SocialiteProviders\Manager\SocialiteWasCalled' => [
-            'SocialiteProviders\Weibo\WeiboExtendSocialite@handle',
-            'SocialiteProviders\QQ\QqExtendSocialite@handle',
+        'App\Events\Event' => [
+            'App\Listeners\EventListener',
         ],
-        'Illuminate\Auth\Events\Login' => [
-            'App\Listeners\LoginStoreSession'
-        ]
     ];
 
     /**

+ 9 - 15
app/Providers/RouteServiceProvider.php

@@ -23,8 +23,8 @@ class RouteServiceProvider extends ServiceProvider
      */
     public function boot()
     {
-        // 全局路由约束;限制id必须为数字
-        Route::pattern('id', '[0-9]+');
+        //
+
         parent::boot();
     }
 
@@ -51,12 +51,9 @@ class RouteServiceProvider extends ServiceProvider
      */
     protected function mapWebRoutes()
     {
-        Route::group([
-            'middleware' => 'web',
-            'namespace' => $this->namespace,
-        ], function ($router) {
-            require base_path('routes/web.php');
-        });
+        Route::middleware('web')
+             ->namespace($this->namespace)
+             ->group(base_path('routes/web.php'));
     }
 
     /**
@@ -68,12 +65,9 @@ class RouteServiceProvider extends ServiceProvider
      */
     protected function mapApiRoutes()
     {
-        Route::group([
-            'middleware' => 'api',
-            'namespace' => $this->namespace,
-            'prefix' => 'api',
-        ], function ($router) {
-            require base_path('routes/api.php');
-        });
+        Route::prefix('api')
+             ->middleware('api')
+             ->namespace($this->namespace)
+             ->group(base_path('routes/api.php'));
     }
 }

+ 4 - 2
artisan

@@ -1,6 +1,8 @@
 #!/usr/bin/env php
 <?php
 
+define('LARAVEL_START', microtime(true));
+
 /*
 |--------------------------------------------------------------------------
 | Register The Auto Loader
@@ -13,7 +15,7 @@
 |
 */
 
-require __DIR__.'/bootstrap/autoload.php';
+require __DIR__.'/vendor/autoload.php';
 
 $app = require_once __DIR__.'/bootstrap/app.php';
 
@@ -40,7 +42,7 @@ $status = $kernel->handle(
 | Shutdown The Application
 |--------------------------------------------------------------------------
 |
-| Once Artisan has finished running. We will fire off the shutdown events
+| Once Artisan has finished running, we will fire off the shutdown events
 | so that any final work may be done by the application before we shut
 | down the process. This is the last thing to happen to the request.
 |

+ 0 - 34
bootstrap/autoload.php

@@ -1,34 +0,0 @@
-<?php
-
-define('LARAVEL_START', microtime(true));
-
-/*
-|--------------------------------------------------------------------------
-| Register The Composer Auto Loader
-|--------------------------------------------------------------------------
-|
-| Composer provides a convenient, automatically generated class loader
-| for our application. We just need to utilize it! We'll require it
-| into the script here so that we do not have to worry about the
-| loading of any our classes "manually". Feels great to relax.
-|
-*/
-
-require __DIR__.'/../vendor/autoload.php';
-
-/*
-|--------------------------------------------------------------------------
-| Include The Compiled Class File
-|--------------------------------------------------------------------------
-|
-| To dramatically increase your application's performance, you may use a
-| compiled class file which contains all of the classes commonly used
-| by a request. The Artisan "optimize" is used to create this file.
-|
-*/
-
-$compiledPath = __DIR__.'/cache/compiled.php';
-
-if (file_exists($compiledPath)) {
-    require $compiledPath;
-}

+ 29 - 51
composer.json

@@ -1,78 +1,56 @@
 {
-    "name": "baijunyao/laravel-bjyblog",
-    "description": "Laravel blog.",
-    "keywords": ["framework", "laravel", "bjyblog"],
-    "authors": [
-        {
-            "name": "baijunyao",
-            "email": "baijunyao@baijunyao.com",
-            "homepage": "http://baijunyao.com",
-            "role": "Developer"
-        }
-    ],
+    "name": "laravel/laravel",
+    "description": "The Laravel Framework.",
+    "keywords": ["framework", "laravel"],
     "license": "MIT",
     "type": "project",
     "require": {
-        "php": ">=5.6.4",
-        "appstract/laravel-opcache": "^1.2",
-        "barryvdh/laravel-debugbar": "^2.4",
-        "erusev/parsedown": "^1.6",
-        "intervention/image": "^2.3",
-        "joyqi/hyper-down": "dev-master",
-        "laravel/framework": "5.3.*",
-        "laravel/socialite": "~2.0",
-        "league/html-to-markdown": "^4.4",
-        "mews/purifier": "^2.0",
-        "orangehill/iseed": "dev-master",
-        "pixel418/markdownify": "^2.2",
-        "predis/predis": "^1.1",
-        "socialiteproviders/qq": "~2.0",
-        "socialiteproviders/weibo": "~2.0"
+        "php": ">=7.0.0",
+        "fideloper/proxy": "~3.3",
+        "laravel/framework": "5.5.*",
+        "laravel/tinker": "~1.0"
     },
     "require-dev": {
+        "filp/whoops": "~2.0",
         "fzaninotto/faker": "~1.4",
-        "mockery/mockery": "0.9.*",
-        "phpunit/phpunit": "~5.0",
-        "symfony/css-selector": "3.1.*",
-        "symfony/dom-crawler": "3.1.*",
-        "xethron/migrations-generator": "^2.0",
-        "barryvdh/laravel-ide-helper": "^2.3"
+        "mockery/mockery": "~1.0",
+        "phpunit/phpunit": "~6.0"
     },
     "autoload": {
         "classmap": [
-            "database"
+            "database/seeds",
+            "database/factories"
         ],
         "psr-4": {
             "App\\": "app/"
-        },
-        "files": [
-            "app/Libraries/Functions/helpers.php"
-        ]
+        }
     },
     "autoload-dev": {
-        "classmap": [
-            "tests/TestCase.php"
-        ]
+        "psr-4": {
+            "Tests\\": "tests/"
+        }
+    },
+    "extra": {
+        "laravel": {
+            "dont-discover": [
+            ]
+        }
     },
     "scripts": {
         "post-root-package-install": [
-            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
+            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
         ],
         "post-create-project-cmd": [
-            "php artisan key:generate"
-        ],
-        "post-install-cmd": [
-            "Illuminate\\Foundation\\ComposerScripts::postInstall",
-            "php artisan optimize"
+            "@php artisan key:generate"
         ],
-        "post-update-cmd": [
-            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
-            "php artisan ide-helper:generate",
-            "php artisan optimize"
+        "post-autoload-dump": [
+            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
+            "@php artisan package:discover"
         ]
     },
     "config": {
         "preferred-install": "dist",
-        "sort-packages": true
+        "sort-packages": true,
+        "optimize-autoloader": true
     }
 }

File diff suppressed because it is too large
+ 924 - 2375
composer.lock


+ 12 - 43
config/app.php

@@ -10,9 +10,10 @@ return [
     | This value is the name of your application. This value is used when the
     | framework needs to place the application's name in a notification or
     | any other location as required by the application or its packages.
+    |
     */
 
-    'name' => 'Laravel',
+    'name' => env('APP_NAME', 'Laravel'),
 
     /*
     |--------------------------------------------------------------------------
@@ -64,7 +65,7 @@ return [
     |
     */
 
-    'timezone' => 'PRC',
+    'timezone' => 'UTC',
 
     /*
     |--------------------------------------------------------------------------
@@ -77,7 +78,7 @@ return [
     |
     */
 
-    'locale' => 'zh-CN',
+    'locale' => 'en',
 
     /*
     |--------------------------------------------------------------------------
@@ -120,12 +121,10 @@ return [
     |
     */
 
-    'log' => env('APP_LOG', 'daily'),
+    'log' => env('APP_LOG', 'single'),
 
     'log_level' => env('APP_LOG_LEVEL', 'debug'),
 
-    'log_max_files' => 365,
-
     /*
     |--------------------------------------------------------------------------
     | Autoloaded Service Providers
@@ -166,6 +165,10 @@ return [
         Illuminate\View\ViewServiceProvider::class,
 
         /*
+         * Package Service Providers...
+         */
+
+        /*
          * Application Service Providers...
          */
         App\Providers\AppServiceProvider::class,
@@ -174,39 +177,6 @@ return [
         App\Providers\EventServiceProvider::class,
         App\Providers\RouteServiceProvider::class,
 
-        /**
-         * Package Service Providers...
-         */
-
-        /**
-         * mewebstudio/Purifier 过滤xss攻击
-         */
-        Mews\Purifier\PurifierServiceProvider::class,
-
-        /**
-         * Intervention/image 处理图片
-         */
-        Intervention\Image\ImageServiceProvider::class,
-
-        /**
-         * socialiteproviders/weibo 微博登录
-         */
-        SocialiteProviders\Manager\ServiceProvider::class,
-
-        /**
-         * 逆向填充
-         */
-        Orangehill\Iseed\IseedServiceProvider::class,
-
-        /**
-         * barryvdh/laravel-debugbar  debug工具条
-         */
-        Barryvdh\Debugbar\ServiceProvider::class,
-
-        /**
-         * appstract/laravel-opcache 命令行操作opcache缓存
-         */
-        Appstract\Opcache\OpcacheServiceProvider::class,
     ],
 
     /*
@@ -221,10 +191,12 @@ return [
     */
 
     'aliases' => [
+
         'App' => Illuminate\Support\Facades\App::class,
         'Artisan' => Illuminate\Support\Facades\Artisan::class,
         'Auth' => Illuminate\Support\Facades\Auth::class,
         'Blade' => Illuminate\Support\Facades\Blade::class,
+        'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
         'Bus' => Illuminate\Support\Facades\Bus::class,
         'Cache' => Illuminate\Support\Facades\Cache::class,
         'Config' => Illuminate\Support\Facades\Config::class,
@@ -253,10 +225,7 @@ return [
         'URL' => Illuminate\Support\Facades\URL::class,
         'Validator' => Illuminate\Support\Facades\Validator::class,
         'View' => Illuminate\Support\Facades\View::class,
-        'Purifier' => Mews\Purifier\Facades\Purifier::class,
-        'Image' => Intervention\Image\Facades\Image::class,
-        'Socialite' => Laravel\Socialite\Facades\Socialite::class,
-        'Debugbar' => Barryvdh\Debugbar\Facade::class,
+
     ],
 
 ];

+ 0 - 6
config/bjyblog.php

@@ -1,6 +0,0 @@
-<?php
-
-return [
-    // 博客版本
-    'version' => 'v5.3.0.5'
-];

+ 2 - 2
config/broadcasting.php

@@ -32,8 +32,8 @@ return [
 
         'pusher' => [
             'driver' => 'pusher',
-            'key' => env('PUSHER_KEY'),
-            'secret' => env('PUSHER_SECRET'),
+            'key' => env('PUSHER_APP_KEY'),
+            'secret' => env('PUSHER_APP_SECRET'),
             'app_id' => env('PUSHER_APP_ID'),
             'options' => [
                 //

+ 5 - 2
config/cache.php

@@ -46,7 +46,7 @@ return [
 
         'file' => [
             'driver' => 'file',
-            'path' => storage_path('framework/cache'),
+            'path' => storage_path('framework/cache/data'),
         ],
 
         'memcached' => [
@@ -86,6 +86,9 @@ return [
     |
     */
 
-    'prefix' => 'laravel',
+    'prefix' => env(
+        'CACHE_PREFIX',
+        str_slug(env('APP_NAME', 'laravel'), '_').'_cache'
+    ),
 
 ];

+ 0 - 35
config/compile.php

@@ -1,35 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Additional Compiled Classes
-    |--------------------------------------------------------------------------
-    |
-    | Here you may specify additional classes to include in the compiled file
-    | generated by the `artisan optimize` command. These should be classes
-    | that are included on basically every request into the application.
-    |
-    */
-
-    'files' => [
-        //
-    ],
-
-    /*
-    |--------------------------------------------------------------------------
-    | Compiled File Providers
-    |--------------------------------------------------------------------------
-    |
-    | Here you may list service providers which define a "compiles" function
-    | that returns additional files that should be compiled, providing an
-    | easy way to get common files from any packages you are utilizing.
-    |
-    */
-
-    'providers' => [
-        //
-    ],
-
-];

+ 16 - 30
config/database.php

@@ -4,19 +4,6 @@ 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_OBJ,
-
-    /*
-    |--------------------------------------------------------------------------
     | Default Database Connection Name
     |--------------------------------------------------------------------------
     |
@@ -59,10 +46,11 @@ return [
             'database' => env('DB_DATABASE', 'forge'),
             'username' => env('DB_USERNAME', 'forge'),
             'password' => env('DB_PASSWORD', ''),
-            'charset' => 'utf8',
-            'collation' => 'utf8_unicode_ci',
-            'prefix' => 'bjy_',
-            'strict' => false,
+            'unix_socket' => env('DB_SOCKET', ''),
+            'charset' => 'utf8mb4',
+            'collation' => 'utf8mb4_unicode_ci',
+            'prefix' => '',
+            'strict' => true,
             'engine' => null,
         ],
 
@@ -79,19 +67,17 @@ return [
             'sslmode' => 'prefer',
         ],
 
-        'old' => [
-            'driver' => 'mysql',
-            'host' => env('OLD_DB_HOST', 'localhost'),
-            'port' => env('OLD_DB_PORT', '3306'),
-            'database' => env('OLD_DB_DATABASE', 'old'),
-            'username' => env('OLD_DB_USERNAME', 'forge'),
-            'password' => env('OLD_DB_PASSWORD', ''),
+        'sqlsrv' => [
+            'driver' => 'sqlsrv',
+            'host' => env('DB_HOST', 'localhost'),
+            'port' => env('DB_PORT', '1433'),
+            'database' => env('DB_DATABASE', 'forge'),
+            'username' => env('DB_USERNAME', 'forge'),
+            'password' => env('DB_PASSWORD', ''),
             'charset' => 'utf8',
-            'collation' => 'utf8_unicode_ci',
-            'prefix' => 'bjy_',
-            'strict' => true,
-            'engine' => null,
-        ]
+            'prefix' => '',
+        ],
+
     ],
 
     /*
@@ -120,7 +106,7 @@ return [
 
     'redis' => [
 
-        'cluster' => false,
+        'client' => 'predis',
 
         'default' => [
             'host' => env('REDIS_HOST', '127.0.0.1'),

+ 0 - 192
config/debugbar.php

@@ -1,192 +0,0 @@
-<?php
-
-return [
-
-    /*
-     |--------------------------------------------------------------------------
-     | Debugbar Settings
-     |--------------------------------------------------------------------------
-     |
-     | Debugbar is enabled by default, when debug is set to true in app.php.
-     | You can override the value by setting enable to true or false instead of null.
-     |
-     */
-
-    'enabled' => env('DEBUGBAR_ENABLED', null),
-
-    /*
-     |--------------------------------------------------------------------------
-     | Storage settings
-     |--------------------------------------------------------------------------
-     |
-     | DebugBar stores data for session/ajax requests.
-     | You can disable this, so the debugbar stores data in headers/session,
-     | but this can cause problems with large data collectors.
-     | By default, file storage (in the storage folder) is used. Redis and PDO
-     | can also be used. For PDO, run the package migrations first.
-     |
-     */
-    'storage' => [
-        'enabled'    => true,
-        'driver'     => 'file', // redis, file, pdo, custom
-        'path'       => storage_path('debugbar'), // For file driver
-        'connection' => null,   // Leave null for default connection (Redis/PDO)
-        'provider'   => '' // Instance of StorageInterface for custom driver
-    ],
-
-    /*
-     |--------------------------------------------------------------------------
-     | Vendors
-     |--------------------------------------------------------------------------
-     |
-     | Vendor files are included by default, but can be set to false.
-     | This can also be set to 'js' or 'css', to only include javascript or css vendor files.
-     | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
-     | and for js: jquery and and highlight.js
-     | So if you want syntax highlighting, set it to true.
-     | jQuery is set to not conflict with existing jQuery scripts.
-     |
-     */
-
-    'include_vendors' => true,
-
-    /*
-     |--------------------------------------------------------------------------
-     | Capture Ajax Requests
-     |--------------------------------------------------------------------------
-     |
-     | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
-     | you can use this option to disable sending the data through the headers.
-     |
-     | Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
-     */
-
-    'capture_ajax' => true,
-    'add_ajax_timing' => false,
-
-    /*
-     |--------------------------------------------------------------------------
-     | Custom Error Handler for Deprecated warnings
-     |--------------------------------------------------------------------------
-     |
-     | When enabled, the Debugbar shows deprecated warnings for Symfony components
-     | in the Messages tab.
-     |
-     */
-    'error_handler' => false,
-    
-    /*
-     |--------------------------------------------------------------------------
-     | Clockwork integration
-     |--------------------------------------------------------------------------
-     |
-     | The Debugbar can emulate the Clockwork headers, so you can use the Chrome
-     | Extension, without the server-side code. It uses Debugbar collectors instead.
-     |
-     */
-    'clockwork' => false,
-
-    /*
-     |--------------------------------------------------------------------------
-     | DataCollectors
-     |--------------------------------------------------------------------------
-     |
-     | Enable/disable DataCollectors
-     |
-     */
-
-    'collectors' => [
-        'phpinfo'         => true,  // Php version
-        'messages'        => true,  // Messages
-        'time'            => true,  // Time Datalogger
-        'memory'          => true,  // Memory usage
-        'exceptions'      => true,  // Exception displayer
-        'log'             => true,  // Logs from Monolog (merged in messages if enabled)
-        'db'              => true,  // Show database (PDO) queries and bindings
-        'views'           => true,  // Views with their data
-        'route'           => true,  // Current route information
-        'auth'            => true, // Display Laravel authentication status
-        'gate'            => true, // Display Laravel Gate checks
-        'session'         => true,  // Display session data
-        'symfony_request' => true,  // Only one can be enabled..
-        'mail'            => true,  // Catch mail messages
-        'laravel'         => false, // Laravel version and environment
-        'events'          => false, // All events fired
-        'default_request' => false, // Regular or special Symfony request logger
-        'logs'            => false, // Add the latest log messages
-        'files'           => false, // Show the included files
-        'config'          => false, // Display config settings
-    ],
-
-    /*
-     |--------------------------------------------------------------------------
-     | Extra options
-     |--------------------------------------------------------------------------
-     |
-     | Configure some DataCollectors
-     |
-     */
-
-    'options' => [
-        'auth' => [
-            'show_name' => true,   // Also show the users name/email in the debugbar
-        ],
-        'db' => [
-            'with_params'       => true,   // Render SQL with the parameters substituted
-            'backtrace'         => true,   // Use a backtrace to find the origin of the query in your files.
-            'timeline'          => false,  // Add the queries to the timeline
-            'explain' => [                 // Show EXPLAIN output on queries
-                'enabled' => false,
-                'types' => ['SELECT'],     // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
-            ],
-            'hints'             => true,    // Show hints for common mistakes
-        ],
-        'mail' => [
-            'full_log' => false
-        ],
-        'views' => [
-            'data' => false,    //Note: Can slow down the application, because the data can be quite large..
-        ],
-        'route' => [
-            'label' => true  // show complete route on bar
-        ],
-        'logs' => [
-            'file' => null
-        ],
-    ],
-
-    /*
-     |--------------------------------------------------------------------------
-     | Inject Debugbar in Response
-     |--------------------------------------------------------------------------
-     |
-     | Usually, the debugbar is added just before </body>, by listening to the
-     | Response after the App is done. If you disable this, you have to add them
-     | in your template yourself. See http://phpdebugbar.com/docs/rendering.html
-     |
-     */
-
-    'inject' => true,
-
-    /*
-     |--------------------------------------------------------------------------
-     | DebugBar route prefix
-     |--------------------------------------------------------------------------
-     |
-     | Sometimes you want to set route prefix to be used by DebugBar to load
-     | its resources from. Usually the need comes from misconfigured web server or
-     | from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
-     |
-     */
-    'route_prefix' => '_debugbar',
-
-    /*
-     |--------------------------------------------------------------------------
-     | DebugBar route domain
-     |--------------------------------------------------------------------------
-     |
-     | By default DebugBar route served from the same domain that request served.
-     | To override default domain, specify it as a non-empty value.
-     */
-    'route_domain' => null,
-];

+ 7 - 6
config/filesystems.php

@@ -13,7 +13,7 @@ return [
     |
     */
 
-    'default' => 'local',
+    'default' => env('FILESYSTEM_DRIVER', 'local'),
 
     /*
     |--------------------------------------------------------------------------
@@ -26,7 +26,7 @@ return [
     |
     */
 
-    'cloud' => 's3',
+    'cloud' => env('FILESYSTEM_CLOUD', 's3'),
 
     /*
     |--------------------------------------------------------------------------
@@ -51,15 +51,16 @@ return [
         'public' => [
             'driver' => 'local',
             'root' => storage_path('app/public'),
+            'url' => env('APP_URL').'/storage',
             'visibility' => 'public',
         ],
 
         's3' => [
             'driver' => 's3',
-            'key' => 'your-key',
-            'secret' => 'your-secret',
-            'region' => 'your-region',
-            'bucket' => 'your-bucket',
+            'key' => env('AWS_ACCESS_KEY_ID'),
+            'secret' => env('AWS_SECRET_ACCESS_KEY'),
+            'region' => env('AWS_DEFAULT_REGION'),
+            'bucket' => env('AWS_BUCKET'),
         ],
 
     ],

+ 0 - 168
config/ide-helper.php

@@ -1,168 +0,0 @@
-<?php
-
-return array(
-
-    /*
-    |--------------------------------------------------------------------------
-    | Filename & Format
-    |--------------------------------------------------------------------------
-    |
-    | The default filename (without extension) and the format (php or json)
-    |
-    */
-
-    'filename'  => '_ide_helper',
-    'format'    => 'php',
-
-    /*
-    |--------------------------------------------------------------------------
-    | Fluent helpers
-    |--------------------------------------------------------------------------
-    |
-    | Set to true to generate commonly used Fluent methods
-    |
-    */
-
-    'include_fluent' => false,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Helper files to include
-    |--------------------------------------------------------------------------
-    |
-    | Include helper files. By default not included, but can be toggled with the
-    | -- helpers (-H) option. Extra helper files can be included.
-    |
-    */
-
-    'include_helpers' => false,
-
-    'helper_files' => array(
-        base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
-    ),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Model locations to include
-    |--------------------------------------------------------------------------
-    |
-    | Define in which directories the ide-helper:models command should look
-    | for models.
-    |
-    */
-
-    'model_locations' => array(
-        'app',
-    ),
-
-
-    /*
-    |--------------------------------------------------------------------------
-    | Extra classes
-    |--------------------------------------------------------------------------
-    |
-    | These implementations are not really extended, but called with magic functions
-    |
-    */
-
-    'extra' => array(
-        'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'),
-        'Session' => array('Illuminate\Session\Store'),
-    ),
-
-    'magic' => array(
-        'Log' => array(
-            'debug'     => 'Monolog\Logger::addDebug',
-            'info'      => 'Monolog\Logger::addInfo',
-            'notice'    => 'Monolog\Logger::addNotice',
-            'warning'   => 'Monolog\Logger::addWarning',
-            'error'     => 'Monolog\Logger::addError',
-            'critical'  => 'Monolog\Logger::addCritical',
-            'alert'     => 'Monolog\Logger::addAlert',
-            'emergency' => 'Monolog\Logger::addEmergency',
-        )
-    ),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Interface implementations
-    |--------------------------------------------------------------------------
-    |
-    | These interfaces will be replaced with the implementing class. Some interfaces
-    | are detected by the helpers, others can be listed below.
-    |
-    */
-
-    'interfaces' => array(
-
-    ),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Support for custom DB types
-    |--------------------------------------------------------------------------
-    |
-    | This setting allow you to map any custom database type (that you may have
-    | created using CREATE TYPE statement or imported using database plugin
-    | / extension to a Doctrine type.
-    |
-    | Each key in this array is a name of the Doctrine2 DBAL Platform. Currently valid names are:
-    | 'postgresql', 'db2', 'drizzle', 'mysql', 'oracle', 'sqlanywhere', 'sqlite', 'mssql'
-    |
-    | This name is returned by getName() method of the specific Doctrine/DBAL/Platforms/AbstractPlatform descendant
-    |
-    | The value of the array is an array of type mappings. Key is the name of the custom type,
-    | (for example, "jsonb" from Postgres 9.4) and the value is the name of the corresponding Doctrine2 type (in
-    | our case it is 'json_array'. Doctrine types are listed here:
-    | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html
-    |
-    | So to support jsonb in your models when working with Postgres, just add the following entry to the array below:
-    |
-    | "postgresql" => array(
-    |       "jsonb" => "json_array",
-    |  ),
-    |
-    */
-    'custom_db_types' => array(
-
-    ),
-
-    /*
-     |--------------------------------------------------------------------------
-     | Support for camel cased models
-     |--------------------------------------------------------------------------
-     |
-     | There are some Laravel packages (such as Eloquence) that allow for accessing
-     | Eloquent model properties via camel case, instead of snake case.
-     |
-     | Enabling this option will support these packages by saving all model
-     | properties as camel case, instead of snake case.
-     |
-     | For example, normally you would see this:
-     |
-     |  * @property \Carbon\Carbon $created_at
-     |  * @property \Carbon\Carbon $updated_at
-     |
-     | With this enabled, the properties will be this:
-     |
-     |  * @property \Carbon\Carbon $createdAt
-     |  * @property \Carbon\Carbon $updatedAt
-     |
-     | Note, it is currently an all-or-nothing option.
-     |
-     */
-    'model_camel_case_properties' => false,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Property Casts
-    |--------------------------------------------------------------------------
-    |
-    | Cast the given "real type" to the given "type".
-    |
-    */
-   'type_overrides' => array(
-        'integer' => 'int',
-        'boolean' => 'bool',
-   ),
-);

+ 0 - 20
config/image.php

@@ -1,20 +0,0 @@
-<?php
-
-return array(
-
-    /*
-    |--------------------------------------------------------------------------
-    | Image Driver
-    |--------------------------------------------------------------------------
-    |
-    | Intervention Image supports "GD Library" and "Imagick" to process images
-    | internally. You may choose one of them according to your PHP
-    | configuration. By default PHP's "GD Library" implementation is used.
-    |
-    | Supported: "gd", "imagick"
-    |
-    */
-
-    'driver' => 'gd'
-
-);

+ 20 - 12
config/mail.php

@@ -11,8 +11,8 @@ return [
     | sending of e-mail. You may specify which one you're using throughout
     | your application here. By default, Laravel is setup for SMTP mail.
     |
-    | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill",
-    |            "ses", "sparkpost", "log"
+    | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
+    |            "sparkpost", "log", "array"
     |
     */
 
@@ -86,30 +86,38 @@ return [
 
     'username' => env('MAIL_USERNAME'),
 
+    'password' => env('MAIL_PASSWORD'),
+
     /*
     |--------------------------------------------------------------------------
-    | SMTP Server Password
+    | Sendmail System Path
     |--------------------------------------------------------------------------
     |
-    | Here you may set the password required by your SMTP server to send out
-    | messages from your application. This will be given to the server on
-    | connection so that the application will be able to send messages.
+    | When using the "sendmail" driver to send e-mails, we will need to know
+    | the path to where Sendmail lives on this server. A default path has
+    | been provided here, which will work well on most of your systems.
     |
     */
 
-    'password' => env('MAIL_PASSWORD'),
+    'sendmail' => '/usr/sbin/sendmail -bs',
 
     /*
     |--------------------------------------------------------------------------
-    | Sendmail System Path
+    | Markdown Mail Settings
     |--------------------------------------------------------------------------
     |
-    | When using the "sendmail" driver to send e-mails, we will need to know
-    | the path to where Sendmail lives on this server. A default path has
-    | been provided here, which will work well on most of your systems.
+    | If you are using Markdown based email rendering, you may configure your
+    | theme and component paths here, allowing you to customize the design
+    | of the emails. Or, you may simply stick with the Laravel defaults!
     |
     */
 
-    'sendmail' => '/usr/sbin/sendmail -bs',
+    'markdown' => [
+        'theme' => 'default',
+
+        'paths' => [
+            resource_path('views/vendor/mail'),
+        ],
+    ],
 
 ];

+ 0 - 41
config/purifier.php

@@ -1,41 +0,0 @@
-<?php
-/**
- * Ok, glad you are here
- * first we get a config instance, and set the settings
- * $config = HTMLPurifier_Config::createDefault();
- * $config->set('Core.Encoding', $this->config->get('purifier.encoding'));
- * $config->set('Cache.SerializerPath', $this->config->get('purifier.cachePath'));
- * if ( ! $this->config->get('purifier.finalize')) {
- *     $config->autoFinalize = false;
- * }
- * $config->loadArray($this->getConfig());
- *
- * You must NOT delete the default settings
- * anything in settings should be compacted with params that needed to instance HTMLPurifier_Config.
- *
- * @link http://htmlpurifier.org/live/configdoc/plain.html
- */
-
-return [
-    'encoding'      => 'UTF-8',
-    'finalize'      => true,
-    'cachePath'     => storage_path('app/purifier'),
-    'cacheFileMode' => 0755,
-    'settings'      => [
-        'default' => [
-            'HTML.Doctype'             => 'XHTML 1.0 Strict',
-            'HTML.Allowed'             => 'div,b,strong,i,em,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
-            'CSS.AllowedProperties'    => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
-            'AutoFormat.AutoParagraph' => true,
-            'AutoFormat.RemoveEmpty'   => true,
-        ],
-        'test'    => [
-            'Attr.EnableID' => true
-        ],
-        "youtube" => [
-            "HTML.SafeIframe"      => 'true',
-            "URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%",
-        ],
-    ],
-
-];

+ 6 - 6
config/queue.php

@@ -7,7 +7,7 @@ return [
     | Default Queue Driver
     |--------------------------------------------------------------------------
     |
-    | The Laravel queue API supports a variety of back-ends via an unified
+    | Laravel's queue API supports an assortment of back-ends via a single
     | API, giving you convenient access to each back-end using the same
     | syntax for each one. Here you may set the default queue driver.
     |
@@ -50,11 +50,11 @@ return [
 
         'sqs' => [
             'driver' => 'sqs',
-            'key' => 'your-public-key',
-            'secret' => 'your-secret-key',
-            'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
-            'queue' => 'your-queue-name',
-            'region' => 'us-east-1',
+            'key' => env('SQS_KEY', 'your-public-key'),
+            'secret' => env('SQS_SECRET', 'your-secret-key'),
+            'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
+            'queue' => env('SQS_QUEUE', 'your-queue-name'),
+            'region' => env('SQS_REGION', 'us-east-1'),
         ],
 
         'redis' => [

+ 0 - 19
config/services.php

@@ -35,23 +35,4 @@ return [
         'secret' => env('STRIPE_SECRET'),
     ],
 
-    'weibo' => [
-        'client_id' => env('WEIBO_KEY'),
-        'client_secret' => env('WEIBO_SECRET'),
-        'redirect' => env('APP_URL').'/auth/oauth/handleProviderCallback/weibo'
-    ],
-
-    'qq' => [
-        'client_id' => env('QQ_KEY'),
-        'client_secret' => env('QQ_SECRET'),
-        'redirect' => env('APP_URL').'/auth/oauth/handleProviderCallback/qq'
-    ],
-
-    'github' => [
-        'client_id' => env('GITHUB_KEY'),
-        'client_secret' => env('GITHUB_SECRET'),
-        'redirect' => env('APP_URL').'/auth/oauth/handleProviderCallback/github'
-    ],
-
-
 ];

+ 20 - 2
config/session.php

@@ -29,7 +29,7 @@ return [
     |
     */
 
-    'lifetime' => 60*24*30,
+    'lifetime' => env('SESSION_LIFETIME', 120),
 
     'expire_on_close' => false,
 
@@ -122,7 +122,10 @@ return [
     |
     */
 
-    'cookie' => 'laravel_session',
+    'cookie' => env(
+        'SESSION_COOKIE',
+        str_slug(env('APP_NAME', 'laravel'), '_').'_session'
+    ),
 
     /*
     |--------------------------------------------------------------------------
@@ -176,4 +179,19 @@ return [
 
     'http_only' => true,
 
+    /*
+    |--------------------------------------------------------------------------
+    | Same-Site Cookies
+    |--------------------------------------------------------------------------
+    |
+    | This option determines how your cookies behave when cross-site requests
+    | take place, and can be used to mitigate CSRF attacks. By default, we
+    | do not enable this as other CSRF protection services are in place.
+    |
+    | Supported: "lax", "strict"
+    |
+    */
+
+    'same_site' => null,
+
 ];

+ 1 - 1
config/view.php

@@ -14,7 +14,7 @@ return [
     */
 
     'paths' => [
-        realpath(base_path('resources/views')),
+        resource_path('views'),
     ],
 
     /*

+ 0 - 24
database/factories/ModelFactory.php

@@ -1,24 +0,0 @@
-<?php
-
-/*
-|--------------------------------------------------------------------------
-| Model Factories
-|--------------------------------------------------------------------------
-|
-| Here you may define all of your model factories. Model factories give
-| you a convenient way to create models for testing and seeding your
-| database. Just tell the factory how a default model should look.
-|
-*/
-
-/** @var \Illuminate\Database\Eloquent\Factory $factory */
-$factory->define(App\User::class, function (Faker\Generator $faker) {
-    static $password;
-
-    return [
-        'name' => $faker->name,
-        'email' => $faker->unique()->safeEmail,
-        'password' => $password ?: $password = bcrypt('secret'),
-        'remember_token' => str_random(10),
-    ];
-});

+ 23 - 0
database/factories/UserFactory.php

@@ -0,0 +1,23 @@
+<?php
+
+use Faker\Generator as Faker;
+
+/*
+|--------------------------------------------------------------------------
+| Model Factories
+|--------------------------------------------------------------------------
+|
+| This directory should contain each of the model factory definitions for
+| your application. Factories provide a convenient way to generate new
+| model instances for testing / seeding your application's database.
+|
+*/
+
+$factory->define(App\User::class, function (Faker $faker) {
+    return [
+        'name' => $faker->name,
+        'email' => $faker->unique()->safeEmail,
+        'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
+        'remember_token' => str_random(10),
+    ];
+});

+ 0 - 1
database/migrations/2014_10_12_000000_create_users_table.php

@@ -20,7 +20,6 @@ class CreateUsersTable extends Migration
             $table->string('password');
             $table->rememberToken();
             $table->timestamps();
-            $table->softDeletes();
         });
     }
 

+ 1 - 1
database/migrations/2014_10_12_100000_create_password_resets_table.php

@@ -15,7 +15,7 @@ class CreatePasswordResetsTable extends Migration
     {
         Schema::create('password_resets', function (Blueprint $table) {
             $table->string('email')->index();
-            $table->string('token')->index();
+            $table->string('token');
             $table->timestamp('created_at')->nullable();
         });
     }

+ 0 - 35
database/migrations/2017_07_11_225347_create_article_tags_table.php

@@ -1,35 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateArticleTagsTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('article_tags', function(Blueprint $table)
-		{
-			$table->integer('article_id')->unsigned()->default(0)->comment('文章id');
-			$table->integer('tag_id')->unsigned()->default(0)->comment('标签id');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('article_tags');
-	}
-
-}

+ 0 - 44
database/migrations/2017_07_11_225347_create_articles_table.php

@@ -1,44 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateArticlesTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('articles', function(Blueprint $table)
-		{
-			$table->increments('id')->comment('文章表主键');
-			$table->boolean('category_id')->default(0)->comment('分类id');
-			$table->char('title', 100)->default('')->comment('标题');
-			$table->string('author', 15)->default('')->comment('作者');
-			$table->text('markdown', 16777215)->comment('markdown文章内容');
-			$table->text('html', 16777215)->comment('markdown转的html页面');
-			$table->char('description')->default('')->comment('描述');
-			$table->string('keywords')->default('')->comment('关键词');
-			$table->string('cover')->default('')->comment('封面图');
-			$table->boolean('is_top')->default(0)->comment('是否置顶 1是 0否');
-			$table->integer('click')->unsigned()->default(0)->comment('点击数');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('articles');
-	}
-
-}

+ 0 - 39
database/migrations/2017_07_11_225347_create_categories_table.php

@@ -1,39 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateCategoriesTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('categories', function(Blueprint $table)
-		{
-            $table->increments('id')->comment('分类主键id');
-			$table->string('name', 15)->default('')->comment('分类名称');
-			$table->string('keywords')->default('')->comment('关键词');
-			$table->string('description')->default('')->comment('描述');
-			$table->boolean('sort')->default(0)->comment('排序');
-			$table->boolean('pid')->default(0)->comment('父级栏目id');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('categories');
-	}
-
-}

+ 0 - 35
database/migrations/2017_07_11_225347_create_chats_table.php

@@ -1,35 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateChatsTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('chats', function(Blueprint $table)
-		{
-			$table->increments('id')->comment('主键id');
-			$table->text('content', 65535)->comment('内容');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('chats');
-	}
-
-}

+ 0 - 40
database/migrations/2017_07_11_225347_create_comments_table.php

@@ -1,40 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateCommentsTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('comments', function(Blueprint $table)
-		{
-			$table->increments('id')->comment('主键id');
-			$table->integer('oauth_user_id')->unsigned()->default(0)->comment('评论用户id 关联oauth_user表的id');
-			$table->boolean('type')->default(1)->comment('1:文章评论');
-			$table->integer('pid')->unsigned()->default(0)->comment('父级id');
-			$table->integer('article_id')->unsigned()->comment('文章id');
-			$table->text('content', 65535)->comment('内容');
-			$table->boolean('status')->comment('1:已审核 0:未审核');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('comments');
-	}
-
-}

+ 0 - 36
database/migrations/2017_07_11_225347_create_configs_table.php

@@ -1,36 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateConfigsTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('configs', function(Blueprint $table)
-		{
-			$table->increments('id')->comment('主键');
-			$table->string('name', 100)->default('')->comment('配置项键名');
-			$table->text('value', 65535)->nullable()->comment('配置项键值 1表示开启 0 关闭');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('configs');
-	}
-
-}

+ 0 - 37
database/migrations/2017_07_11_225347_create_friendship_links_table.php

@@ -1,37 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateFriendshipLinksTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('friendship_links', function(Blueprint $table)
-		{
-			$table->increments('id')->comment('主键id');
-			$table->string('name', 50)->default('')->comment('链接名');
-			$table->string('url')->default('')->comment('链接地址');
-			$table->boolean('sort')->nullable()->default(1)->comment('排序');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('friendship_links');
-	}
-
-}

+ 0 - 43
database/migrations/2017_07_11_225347_create_oauth_users_table.php

@@ -1,43 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateOauthUsersTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('oauth_users', function(Blueprint $table)
-		{
-			$table->increments('id')->comment('主键id');
-			$table->boolean('type')->default(1)->comment('类型 1:QQ  2:新浪微博 3:github');
-			$table->string('name', 30)->default('')->comment('第三方昵称');
-			$table->string('avatar')->default('')->comment('头像');
-			$table->string('openid', 40)->default('')->comment('第三方用户id');
-			$table->string('access_token')->default('')->comment('access_token token');
-			$table->string('last_login_ip', 16)->default('')->comment('最后登录ip');
-			$table->integer('login_times')->unsigned()->default(0)->comment('登录次数');
-			$table->string('email')->default('')->comment('邮箱');
-			$table->boolean('is_admin')->default(0)->comment('是否是admin');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('oauth_users');
-	}
-
-}

+ 0 - 35
database/migrations/2017_07_11_225347_create_tags_table.php

@@ -1,35 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-
-class CreateTagsTable extends Migration {
-
-	/**
-	 * Run the migrations.
-	 *
-	 * @return void
-	 */
-	public function up()
-	{
-		Schema::create('tags', function(Blueprint $table)
-		{
-			$table->increments('id')->comment('标签主键');
-			$table->string('name', 10)->default('')->comment('标签名');
-			$table->timestamps();
-			$table->softDeletes();
-		});
-	}
-
-
-	/**
-	 * Reverse the migrations.
-	 *
-	 * @return void
-	 */
-	public function down()
-	{
-		Schema::dropIfExists('tags');
-	}
-
-}

+ 0 - 37
database/migrations/2017_08_26_211441_create_jobs_table.php

@@ -1,37 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateJobsTable extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::create('jobs', function (Blueprint $table) {
-            $table->bigIncrements('id');
-            $table->string('queue');
-            $table->longText('payload');
-            $table->tinyInteger('attempts')->unsigned();
-            $table->unsignedInteger('reserved_at')->nullable();
-            $table->unsignedInteger('available_at');
-            $table->unsignedInteger('created_at');
-            $table->index(['queue', 'reserved_at']);
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::dropIfExists('jobs');
-    }
-}

+ 0 - 35
database/migrations/2017_08_26_212556_create_failed_jobs_table.php

@@ -1,35 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateFailedJobsTable extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::create('failed_jobs', function (Blueprint $table) {
-            $table->increments('id');
-            $table->text('connection');
-            $table->text('queue');
-            $table->longText('payload');
-            $table->longText('exception');
-            $table->timestamp('failed_at')->useCurrent();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::dropIfExists('failed_jobs');
-    }
-}

+ 0 - 35
database/migrations/2017_10_18_203752_create_git_projects_table.php

@@ -1,35 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateGitProjectsTable extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::create('git_projects', function (Blueprint $table) {
-            $table->increments('id')->comment('项目主键');
-            $table->tinyInteger('sort')->default(1)->comment('排序');
-            $table->tinyInteger('type')->default(1)->comment('1:github 2:gitee');
-            $table->string('name')->default('')->comment('项目名');
-            $table->timestamps();
-            $table->softDeletes();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::dropIfExists('git_projects');
-    }
-}

+ 0 - 25
database/seeds/ArticleTagsTableSeeder.php

@@ -1,25 +0,0 @@
-<?php
-
-use Illuminate\Database\Seeder;
-
-class ArticleTagsTableSeeder extends Seeder
-{
-    /**
-     * Run the database seeds.
-     *
-     * @return void
-     */
-    public function run()
-    {
-        DB::table('article_tags')->delete();
-        DB::table('article_tags')->insert([
-            0 =>[
-                'article_id' => 1,
-                'tag_id' => 1,
-                'created_at' => '2017-7-18 07:35:12',
-                'updated_at' => '2016-7-18 07:35:12',
-                'deleted_at' => NULL,
-            ],
-        ]);
-    }
-}

File diff suppressed because it is too large
+ 0 - 79
database/seeds/ArticlesTableSeeder.php


+ 0 - 29
database/seeds/CategoriesTableSeeder.php

@@ -1,29 +0,0 @@
-<?php
-
-use Illuminate\Database\Seeder;
-
-class CategoriesTableSeeder extends Seeder
-{
-    /**
-     * Run the database seeds.
-     *
-     * @return void
-     */
-    public function run()
-    {
-        DB::table('categories')->delete();
-        DB::table('categories')->insert([
-            0 =>[
-                'id' => 1,
-                'name' => 'php',
-                'keywords' => 'php',
-                'description' => 'php相关的文章',
-                'sort' => 1,
-                'pid' => 0,
-                'created_at' => '2017-7-16 07:35:12',
-                'updated_at' => '2016-7-16 07:35:12',
-                'deleted_at' => NULL,
-            ],
-        ]);
-    }
-}

+ 0 - 25
database/seeds/ChatsTableSeeder.php

@@ -1,25 +0,0 @@
-<?php
-
-use Illuminate\Database\Seeder;
-
-class ChatsTableSeeder extends Seeder
-{
-    /**
-     * Run the database seeds.
-     *
-     * @return void
-     */
-    public function run()
-    {
-        DB::table('chats')->delete();
-        DB::table('chats')->insert([
-            0 =>[
-                'id' => 1,
-                'content' => '技术这东西;懂的越多;不懂的就越多;',
-                'created_at' => '2017-7-18 07:35:12',
-                'updated_at' => '2016-7-18 07:35:12',
-                'deleted_at' => NULL,
-            ],
-        ]);
-    }
-}

+ 0 - 30
database/seeds/CommentsTableSeeder.php

@@ -1,30 +0,0 @@
-<?php
-
-use Illuminate\Database\Seeder;
-
-class CommentsTableSeeder extends Seeder
-{
-    /**
-     * Run the database seeds.
-     *
-     * @return void
-     */
-    public function run()
-    {
-        DB::table('comments')->delete();
-        DB::table('comments')->insert([
-            0 =>[
-                'id' => 1,
-                'oauth_user_id' => 1,
-                'type' => 1,
-                'pid' => 0,
-                'article_id' => 1,
-                'content' => '评论的内容',
-                'status' => 1,
-                'created_at' => '2017-7-16 07:35:12',
-                'updated_at' => '2016-7-16 07:35:12',
-                'deleted_at' => NULL,
-            ],
-        ]);
-    }
-}

+ 0 - 0
database/seeds/ConfigsTableSeeder.php


Some files were not shown because too many files changed in this diff