Jelajahi Sumber

+func admin information

Vien 5 tahun lalu
induk
melakukan
5233df40e0

+ 44 - 0
app/Console/Commands/test.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\DB;
+
+class Test extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'test:test';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Test.';
+
+    /**
+     * Create a new command instance.
+     *
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+       dump(json_decode('[{"title":"首页","url":"https:\/\/vienblog.com"},{"title":"关于作者","url":"https:\/\/vienblog.com"},{"title":"打赏作者","url":"https:\/\/viencoding.com\/pay"},{"title":"建站教程","url":"https:\/\/vienblog.com"},{"title":"科学上网","url":"https:\/\/viencoding.com\/article\/122"},{"title":"网站导航","url":"https:\/\/vienblog.com"},{"title":"机器学习","url":"https:\/\/vienblog.com\/category\/机器学习"},{"title":"Laravel教程","url":"https:\/\/vienblog.com"},{"title":"Python教程","url":"https:\/\/vienblog.com"},{"title":"Git教程","url":"https:\/\/vienblog.com"},{"title":"Docker教程","url":"https:\/\/vienblog.com"},{"title":"友情链接","url":"https:\/\/vienblog.com"}]'));
+    }
+}

+ 54 - 0
app/Http/Controllers/Admin/Index/InfoController.php

@@ -0,0 +1,54 @@
+<?php
+
+namespace App\Http\Controllers\Admin\Index;
+
+use App\Models\Blog\Article;
+use App\Models\Blog\ArticleTag;
+use App\Models\Blog\Category;
+use App\Models\Blog\Tag;
+use App\Models\Index\Information;
+use App\Models\Index\Link;
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+use Illuminate\Support\Facades\Auth;
+
+class InfoController extends Controller
+{
+    //
+    public function edit(Request $request)
+    {
+        $information = Information::query()
+            ->select( 'id', 'site_title', 'site_keywords', 'site_description', 'author_name', 'author_intro', 'author_avatar', 'navigation')
+            ->first()->toArray();
+        return view('admin.info.edit', ['information' => $information]);
+    }
+
+    public function update(Request $request)
+    {
+        $input = $request->input();
+        $this->validate($request, [
+            'site_title' => 'required|max:30',
+            'site_keywords' => 'required|max:50',
+            'site_description' => 'required|max:150',
+            'author_name' => 'required|max:20',
+            'author_intro' => 'required|max:50',
+            'author_avatar' => 'required|max:255'
+        ]);
+
+//        $data = ['email' => $input['email'], 'name' => $input['name'],];
+
+//        $information = Information::query()->find($input['id']);
+        $information = Information::query()->first();
+
+        $information->site_title = $input['site_title'];
+        $information->site_keywords = $input['site_keywords'];
+        $information->site_description = $input['site_description'];
+        $information->author_name = $input['author_name'];
+        $information->author_intro = $input['author_intro'];
+        $information->author_avatar = $input['author_avatar'];
+
+        $information->save();
+
+        return view('admin.info.edit', ['information' => $information->toArray()])->with(['message' => 'success']);
+    }
+}

+ 5 - 2
app/Http/Controllers/Admin/UploadController.php

@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Storage;
 use Intervention\Image\Facades\Image;
+use function MongoDB\BSON\toJSON;
 use yasmuru\LaravelTinify\Facades\Tinify;
 
 class UploadController extends Controller
@@ -21,15 +22,17 @@ class UploadController extends Controller
             && in_array($request->file->extension(), ["png", "jpg", "jpeg", "gif"])
         ) {
             $path = $request->file->store(date('Ymd'), config('vienblog.disks.article_image'));
-
             $url = Storage::disk(config('vienblog.disks.article_image'))->url($path);
 
+
             if (env('TINIFY_APIKEY', '') && in_array($request->file->extension(), ["png", "jpg", "jpeg"])) {
+
                 try {
                     set_time_limit(300);
                     $oldPath = public_path($url);
                     $result = Tinify::fromFile($oldPath);
-                    $result->toFile($oldPath);
+                    $result->toFile(str_replace('.png', '.jpg', $oldPath));
+                    return response()->json(['filename' => str_replace('.png', '.jpg', $url)]);
                 } catch (\Exception $e){
                     return response()->json(['filename' => $url]);
                 }

+ 2 - 2
app/Http/Controllers/Admin/User/UserController.php

@@ -13,7 +13,7 @@ class UserController extends Controller
     //
     public function edit($id)
     {
-        $user = Admin::find($id)->toArray();
+        $user = Admin::query()->find($id)->toArray();
         return view('admin.user.edit', ['user' => $user]);
     }
 
@@ -28,7 +28,7 @@ class UserController extends Controller
 
 //        $data = ['email' => $input['email'], 'name' => $input['name'],];
 
-        $user = Admin::find($input['id']);
+        $user = Admin::query()->find($input['id']);
 
         if($input['password']) {
             $user->password =  Hash::make($input['password']);

+ 1 - 0
app/Http/Kernel.php

@@ -51,6 +51,7 @@ class Kernel extends HttpKernel
      * @var array
      */
     protected $routeMiddleware = [
+        'init' => \App\Http\Middleware\Init::class,
         'auth' => \App\Http\Middleware\Authenticate::class,
         'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
         'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,

+ 20 - 0
app/Http/Middleware/Init.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+
+class Init
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        return $next($request);
+    }
+}

+ 13 - 0
app/Models/Index/Information.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace App\Models\Index;
+
+use App\Models\Base\BaseModel;
+
+class Information extends BaseModel
+{
+    //
+    protected $table = 'information';
+//    protected $fillable = ['article_id', 'tag_id'];
+//    public $timestamps = false;
+}

+ 57 - 0
app/Providers/InitServiceProvider.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace App\Providers;
+
+use App\Models\Index\Information;
+use Illuminate\Support\ServiceProvider;
+
+class InitServiceProvider extends ServiceProvider
+{
+    /**
+     * Register services.
+     *
+     * @return void
+     */
+    public function register()
+    {
+        //
+    }
+
+    /**
+     * Bootstrap services.
+     *
+     * @return void
+     */
+    public function boot()
+    {
+        //
+        $information = Information::query()
+            ->select( 'site_title', 'site_keywords', 'site_description', 'author_name', 'author_intro', 'author_avatar', 'navigation')
+            ->first();
+
+
+
+        if ($information) {
+            $blog = [
+                "name" => $information->site_title,
+                "keywords" => $information->site_keywords,
+                "description" => $information->site_description,
+            ];
+
+            $this->app->get('config')->set('vienblog.blog', $blog);
+
+            $author = [ // 博主
+                "name" => $information->author_name,
+                "description" => $information->author_intro,
+                "avatar" => $information->author_avatar,
+            ];
+
+            $this->app->get('config')->set('vienblog.author', $author);
+        }
+
+
+//        $article = $article->toArray();
+
+
+    }
+}

+ 2 - 0
config/app.php

@@ -176,6 +176,8 @@ return [
         App\Providers\EventServiceProvider::class,
         App\Providers\RouteServiceProvider::class,
 
+        App\Providers\InitServiceProvider::class,
+
     ],
 
     /*

+ 8 - 2
config/vienblog.php

@@ -123,8 +123,14 @@ return [
     "disks" => [
         "article_image" => "vienblog" // 文章中图片的disk(disk在filesystem.php中配置)
     ],
-    "ad" => false, // Google AdSense Auto AD 开关 默认关闭 开启需要在 resources/views/ads/adsense.blade.php 中添加 AdSense代码
-    "counter" => false, // 统计工具(例如百度统计、StatCounter等) 开关 默认关闭 开启需要在 resources/views/counters/counter.blade.php 中添加相关代码
+    "ad" => [
+        "open" => false, // Google AdSense Auto AD 开关 默认关闭 开启需要在后台中添加 AdSense代码
+        "script" => ""
+    ],
+    "counter" => [
+        "open" => false, // 统计工具(例如百度统计、StatCounter等) 开关 默认关闭 开启需要在后台中添加相关代码
+        "script" => ""
+        ],
     "baidu" => [ // 提交站内链接给百度 请先登录百度站长平台验证站长身份 从而获得相应的信息用于下面配置
         "auto_push" => false, // 百度自动推送 开关 默认关闭 用于自动提交页面链接给百度收录
         "manual_push" => [ // 主动推送

+ 38 - 0
database/migrations/2020_04_04_141214_create_switch_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateSwitchTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('switch', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('name', 255)->default('')->comment('name');
+            $table->tinyInteger('status')->default(1)->comment('status: 1-open;0-close');
+            $table->longText('extra')->nullable()->comment('extra setting');
+            $table->integer('updated_at');
+            $table->integer('created_at');
+            $table->integer('deleted_at')->nullable();
+            //            $table->index('site_title');
+            $table->index('name');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('switch');
+    }
+}

+ 49 - 0
database/migrations/2020_04_04_141231_create_information_table.php

@@ -0,0 +1,49 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateInformationTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('information', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('site_title', 255)->default('')->comment('title');
+            $table->string('site_keywords')->default('')->comment('keywords');
+            $table->string('site_description', 255)->default('')->comment('description');
+            $table->string('author_name', 255)->default('')->comment('author_name');
+            $table->string('author_intro', 255)->default('')->comment('author_intro');
+            $table->string('author_avatar', 255)->default('')->comment('author_avatar');
+            $table->longText('navigation')->nullable()->comment('navigation links');
+//            $table->integer('user_id')->default(0)->comment('author id');
+//            $table->integer('cate_id')->default(0)->comment('category id');
+//            $table->integer('comment_count')->default(0)->comment('comment count');
+//            $table->integer('read_count')->default(0)->comment('read count');
+//            $table->tinyInteger('status')->default(1)->comment('status: 1-public;0-private');
+//            $table->integer('sort')->default(0)->comment('sort');
+//            $table->tinyInteger('is_top')->default(0)->comment('sticky to top');
+            $table->integer('updated_at');
+            $table->integer('created_at');
+            $table->integer('deleted_at')->nullable();
+//            $table->index('site_title');
+//            $table->index('created_at');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('information');
+    }
+}

+ 2 - 0
database/seeds/DatabaseSeeder.php

@@ -13,5 +13,7 @@ class DatabaseSeeder extends Seeder
     {
          $this->call(AdminTableSeeder::class);
          $this->call(FriendLinkTableSeeder::class);
+         $this->call(SiteInfoSeeder::class);
+         $this->call(SiteSwitchSeeder::class);
     }
 }

+ 78 - 0
database/seeds/SiteInfoSeeder.php

@@ -0,0 +1,78 @@
+<?php
+
+use Illuminate\Database\Seeder;
+use Illuminate\Support\Facades\DB;
+
+class SiteInfoSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        //
+        DB::table('information')->insert([
+            'site_title'  => 'Vien Blog',
+            'site_keywords' => 'Laravel,Markdown,免费,开源,博客,Blog',
+            'site_description' => '免费开源博客、基于Laravel5.8、支持Markdown、支持图片拖拽上传',
+            'author_name' => 'Vien',
+            'author_intro' => '一名有职业素养的铲屎官,欢迎云撸猫',
+            'author_avatar' => '/images/avatars/lbxx-14.jpeg',
+            'navigation' => json_encode([
+                [
+                    "title" => "首页",
+                    "url" => "https://vienblog.com"
+                ],
+                [
+                    "title" => "关于作者",
+                    "url" => "https://vienblog.com"
+                ],
+                [
+                    "title" => "打赏作者",
+                    "url" => "https://viencoding.com/pay"
+                ],
+                [
+                    "title" => "建站教程",
+                    "url" => "https://vienblog.com"
+                ],
+                [
+                    "title" => "科学上网",
+                    "url" => "https://viencoding.com/article/122"
+                ],
+                [
+                    "title" => "网站导航",
+                    "url" => "https://vienblog.com"
+                ],
+                [
+                    "title" => "机器学习",
+                    "url" => "https://vienblog.com/category/机器学习"
+                ],
+                [
+                    "title" => "Laravel教程",
+                    "url" => "https://vienblog.com"
+                ],
+                [
+                    "title" => "Python教程",
+                    "url" => "https://vienblog.com"
+                ],
+                [
+                    "title" => "Git教程",
+                    "url" => "https://vienblog.com"
+                ],
+                [
+                    "title" => "Docker教程",
+                    "url" => "https://vienblog.com"
+                ],
+                [
+                    "title" => "友情链接",
+                    "url" => "https://vienblog.com"
+                ]
+            ], JSON_UNESCAPED_UNICODE),
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+
+    }
+}

+ 126 - 0
database/seeds/SiteSwitchSeeder.php

@@ -0,0 +1,126 @@
+<?php
+
+use Illuminate\Database\Seeder;
+use Illuminate\Support\Facades\DB;
+
+class SiteSwitchSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        DB::table('switch')->insert([
+            'name' => 'adsense',
+            'status' => 0,
+            'extra' => '',
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "counter",
+            'status' => 0,
+            'extra' => '',
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "baidu_autopush",
+            'status' => 0,
+            'extra' => '',
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "motto",
+            'status' => 1,
+            'extra' => json_encode(
+                [
+                    "title" => "联系作者",
+                    "content" => "微信: luvvien 添加注明: vienblog.com"
+                ], JSON_UNESCAPED_UNICODE),
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "tag",
+            'status' => 1,
+            'extra' => json_encode(
+                [
+                    "title" => "标签",
+                    "count" => 30
+                ], JSON_UNESCAPED_UNICODE),
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "category",
+            'status' => 1,
+            'extra' => json_encode(
+                [
+                    "title" => "分类",
+                    "count" => 20
+                ], JSON_UNESCAPED_UNICODE),
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "hot",
+            'status' => 1,
+            'extra' => json_encode(
+                [
+                    "title" => "热门文章",
+                    "count" => 8
+                ], JSON_UNESCAPED_UNICODE),
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "latest",
+            'status' => 1,
+            'extra' => json_encode(
+                [
+                    "title" => "刚刚发布了",
+                    "count" => 8
+                ], JSON_UNESCAPED_UNICODE),
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "popular",
+            'status' => 1,
+            'extra' => json_encode(
+                [
+                    "title" => "最近有人在看",
+                    "count" => 8
+                ], JSON_UNESCAPED_UNICODE),
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+        DB::table('switch')->insert([
+            'name' => "carousel",
+            'status' => 1,
+            'extra' => json_encode([ // 设置滚动的Banner 请让图的长宽比都相同 否则切换时高度会变化
+                [
+                    "image" => "/images/banners/vultr_affiliate_560x260.png", // 图片路径
+                    "url" => "https://www.vultr.com/?ref=8372175-6G", // 点击后的跳转链接
+                    "description" => "优质国外服务器供应商Vultr限时注册送100刀", // Banner描述 用于img标签的alt属性
+                ],
+                [
+                    "image" => "/images/banners/ali_affiliate_560x260.png", // 图片路径
+                    "url" => "https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=clx8dxhx", // 点击后的跳转链接
+                    "description" => "阿里云高性能服务器低至2折", // Banner描述 用于img标签的alt属性
+                ],
+                [
+                    "image" => "/images/banners/tencent_affiliate_560x260.png", // 图片路径
+                    "url" => "https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=2d48606c208631c31d73aadcb8412bab&from=console", // 点击后的跳转链接
+                    "description" => "推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。", // Banner描述 用于img标签的alt属性
+                ],
+            ], JSON_UNESCAPED_UNICODE),
+            'created_at' => 1553745930,
+            'updated_at' => 1553745930,
+        ]);
+    }
+}

+ 60 - 0
resources/views/admin/info/edit.blade.php

@@ -0,0 +1,60 @@
+@extends('admin.layouts.app')
+
+@section('content')
+    <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
+        @include('admin.layouts.alert')
+        <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
+            <h2 class="h2">管理员信息</h2>
+            <div class="btn-toolbar mb-2 mb-md-0">
+                <button type="submit" class="btn btn-sm btn-primary mr-1"
+                        onclick="event.preventDefault();document.getElementById('edit-form').submit();">
+                    提交
+                </button>
+            </div>
+        </div>
+
+        {{--<canvas class="my-4" id="myChart" width="900" height="380"></canvas>--}}
+        <form action="{{ route('admin.info.update') }}" id="edit-form" method="post">
+            @csrf
+            <input type="hidden" name="id" value="{{ $information['id'] }}">
+            <div class="form-group col-md-4">
+                <label for="site_title">网站名</label>
+                <input type="text" class="form-control" id="site_title" name="site_title"
+                       value="{{ $information['site_title'] }}" required>
+            </div>
+
+            <div class="form-group col-md-4">
+                <label for="site_description">网站描述</label>
+                <input type="text" class="form-control" id="site_description" name="site_description"
+                       value="{{ $information['site_description'] }}" required>
+            </div>
+
+            <div class="form-group col-md-4">
+                <label for="site_keywords">网站关键字</label>
+                <input type="text" class="form-control" id="site_keywords" name="site_keywords"
+                       value="{{ $information['site_keywords'] }}" placeholder="用英文逗号分隔 建议2-5个词" required>
+            </div>
+
+            <div class="form-group col-md-4">
+                <label for="author_name">作者名称</label>
+                <input type="text" class="form-control" id="author_name" name="author_name"
+                       value="{{ $information['author_name'] }}" required>
+            </div>
+
+            <div class="form-group col-md-4">
+                <label for="author_intro">作者介绍</label>
+                <input type="text" class="form-control" id="author_intro" name="author_intro"
+                       value="{{ $information['author_intro'] }}" required>
+            </div>
+
+
+            <div class="form-group col-md-4">
+                <label for="author_avatar">头像</label>
+                <input type="text" class="form-control" id="author_avatar" name="author_avatar"
+                       value="{{ $information['author_avatar'] }}" required>
+            </div>
+
+            <button type="submit" class="mt-2 ml-3 btn btn-sm btn-primary">提交</button>
+        </form>
+    </main>
+@endsection

+ 7 - 0
resources/views/admin/layouts/menu.blade.php

@@ -29,6 +29,13 @@
                     管理员信息
                 </a>
             </li>
+            <li class="nav-item">
+                <a class="nav-link" href="{{ route('admin.info.edit', '1') }}">
+                    {{--<span data-feather="users"></span>--}}
+                    {{--<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>--}}
+                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>                    网站信息
+                </a>
+            </li>
         </ul>
 
         {{--<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">--}}

+ 6 - 4
resources/views/home/layouts/app.blade.php

@@ -35,8 +35,9 @@
     @show
     @section('css_ext')@show
     @section('ads')
-        @if(env('APP_DEBUG') == false and config('vienblog.ad') == true)
-            @include('ads.adsense')
+        @if(env('APP_DEBUG') == false and config('vienblog.ad.open') == true)
+            {{--@include('ads.adsense')--}}
+            {{ config('vienblog.ad.script') }}
         @endif
     @show
 
@@ -46,8 +47,9 @@
 @yield('content')
 
 @section('counter')
-    @if(env('APP_DEBUG') == false and config('vienblog.counter') == true)
-        @include('counters.counter')
+    @if(env('APP_DEBUG') == false and config('vienblog.counter.open') == true)
+{{--        @include('counters.counter')--}}
+        {{ config('vienblog.counter.script') }}
     @endif
 @show
 

+ 10 - 6
routes/web.php

@@ -14,8 +14,6 @@
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Route;
 
-Route::get('/', 'Home\Blog\ArticleController@index');
-
 Auth::routes();
 
 Route::group(['prefix' => 'admin', ], function () {
@@ -50,6 +48,9 @@ Route::group(['prefix' => 'admin', ], function () {
 
         Route::get('/users/{id}', 'Admin\User\UserController@edit')->name('admin.user.edit');
         Route::post('/users', 'Admin\User\UserController@update')->name('admin.user.update');
+
+        Route::get('/info/{id}', 'Admin\Index\InfoController@edit')->name('admin.info.edit');
+        Route::post('/info', 'Admin\Index\InfoController@update')->name('admin.info.update');
     });
 });
 
@@ -57,7 +58,10 @@ Route::group(['prefix' => 'admin', ], function () {
 //    return view('auth.login');
 //});
 
-Route::get('/friend-links', 'Home\Index\LinkController@index')->name('home.blog.link.friend');
-Route::get('/{slug}', 'Home\Blog\ArticleController@show')->name('home.blog.article');
-Route::get('/category/{category}', 'Home\Blog\CategoryController@show')->name('home.blog.category.show');
-Route::get('/tag/{tag}', 'Home\Blog\TagController@show')->name('home.blog.tag.show');
+Route::group(['middleware' => 'init', ], function () {
+    Route::get('/', 'Home\Blog\ArticleController@index');
+    Route::get('/friend-links', 'Home\Index\LinkController@index')->name('home.blog.link.friend');
+    Route::get('/{slug}', 'Home\Blog\ArticleController@show')->name('home.blog.article');
+    Route::get('/category/{category}', 'Home\Blog\CategoryController@show')->name('home.blog.category.show');
+    Route::get('/tag/{tag}', 'Home\Blog\TagController@show')->name('home.blog.tag.show');
+});