瀏覽代碼

Merge pull request #52 from ControlPanel-gg/useful_links_and_menu

Auto stash before revert of "Merge remote-tracking branch 'origin/dev…
AVMG 4 年之前
父節點
當前提交
1cfdd11f71
共有 48 個文件被更改,包括 267 次插入259 次删除
  1. 65 20
      app/Http/Controllers/Admin/UsefulLinkController.php
  2. 1 1
      app/Models/UsefulLink.php
  3. 4 4
      database/migrations/2021_06_09_213306_create_useful_links_table.php
  4. 3 9
      database/seeders/UsefulLinksSeeder.php
  5. 1 0
      public/css/app.css
  6. 0 0
      public/css/app.css.map
  7. 0 0
      public/js/app.js.map
  8. 1 1
      public/plugins/fontawesome-free/css/all.css
  9. 1 1
      public/plugins/fontawesome-free/css/all.min.css
  10. 1 1
      public/plugins/fontawesome-free/css/brands.css
  11. 1 1
      public/plugins/fontawesome-free/css/brands.min.css
  12. 1 1
      public/plugins/fontawesome-free/css/fontawesome.css
  13. 1 1
      public/plugins/fontawesome-free/css/fontawesome.min.css
  14. 1 1
      public/plugins/fontawesome-free/css/regular.css
  15. 1 1
      public/plugins/fontawesome-free/css/regular.min.css
  16. 1 1
      public/plugins/fontawesome-free/css/solid.css
  17. 1 1
      public/plugins/fontawesome-free/css/solid.min.css
  18. 1 1
      public/plugins/fontawesome-free/css/svg-with-js.css
  19. 1 1
      public/plugins/fontawesome-free/css/svg-with-js.min.css
  20. 1 1
      public/plugins/fontawesome-free/css/v4-shims.css
  21. 1 1
      public/plugins/fontawesome-free/css/v4-shims.min.css
  22. 二進制
      public/plugins/fontawesome-free/webfonts/fa-brands-400.eot
  23. 2 2
      public/plugins/fontawesome-free/webfonts/fa-brands-400.svg
  24. 二進制
      public/plugins/fontawesome-free/webfonts/fa-brands-400.ttf
  25. 二進制
      public/plugins/fontawesome-free/webfonts/fa-brands-400.woff
  26. 二進制
      public/plugins/fontawesome-free/webfonts/fa-brands-400.woff2
  27. 二進制
      public/plugins/fontawesome-free/webfonts/fa-regular-400.eot
  28. 2 2
      public/plugins/fontawesome-free/webfonts/fa-regular-400.svg
  29. 二進制
      public/plugins/fontawesome-free/webfonts/fa-regular-400.ttf
  30. 二進制
      public/plugins/fontawesome-free/webfonts/fa-regular-400.woff
  31. 二進制
      public/plugins/fontawesome-free/webfonts/fa-regular-400.woff2
  32. 二進制
      public/plugins/fontawesome-free/webfonts/fa-solid-900.eot
  33. 2 2
      public/plugins/fontawesome-free/webfonts/fa-solid-900.svg
  34. 二進制
      public/plugins/fontawesome-free/webfonts/fa-solid-900.ttf
  35. 二進制
      public/plugins/fontawesome-free/webfonts/fa-solid-900.woff
  36. 二進制
      public/plugins/fontawesome-free/webfonts/fa-solid-900.woff2
  37. 0 0
      public/plugins/summernote/summernote-bs4.min.css
  38. 1 0
      public/plugins/summernote/summernote-bs4.min.js
  39. 0 0
      public/plugins/summernote/summernote-bs4.min.js.map
  40. 16 0
      resources/css/stylesheet.css
  41. 1 0
      resources/sass/app.scss
  42. 1 1
      resources/views/admin/servers/table.blade.php
  43. 77 152
      resources/views/admin/usefullinks/create.blade.php
  44. 21 7
      resources/views/admin/usefullinks/edit.blade.php
  45. 14 31
      resources/views/admin/usefullinks/index.blade.php
  46. 1 1
      resources/views/home.blade.php
  47. 37 13
      resources/views/layouts/main.blade.php
  48. 4 0
      routes/web.php

+ 65 - 20
app/Http/Controllers/Admin/UsefulLinkController.php

@@ -4,6 +4,10 @@ namespace App\Http\Controllers\Admin;
 
 use App\Http\Controllers\Controller;
 use App\Models\UsefulLink;
+use Illuminate\Contracts\Foundation\Application;
+use Illuminate\Contracts\View\Factory;
+use Illuminate\Contracts\View\View;
+use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 
@@ -12,7 +16,7 @@ class UsefulLinkController extends Controller
     /**
      * Display a listing of the resource.
      *
-     * @return Response
+     * @return Application|Factory|View|Response
      */
     public function index()
     {
@@ -22,31 +26,37 @@ class UsefulLinkController extends Controller
     /**
      * Show the form for creating a new resource.
      *
-     * @return Response
-     */
     public function create()
     {
-        //
+        return view('admin.usefullinks.create');
     }
 
     /**
      * Store a newly created resource in storage.
      *
      * @param Request $request
-     * @return Response
+     * @return RedirectResponse
      */
     public function store(Request $request)
     {
-        //
+        $request->validate([
+           'icon' => 'required|string',
+           'title' => 'required|string|max:60',
+           'link' => 'required|string|max:191',
+           'description' => 'required|string|max:2000',
+        ]);
+
+        UsefulLink::create($request->all());
+        return redirect()->route('admin.usefullinks.index')->with('success', 'link has been created!');
     }
 
     /**
      * Display the specified resource.
      *
-     * @param UsefulLink $usefulLink
+     * @param UsefulLink $usefullink
      * @return Response
      */
-    public function show(UsefulLink $usefulLink)
+    public function show(UsefulLink $usefullink)
     {
         //
     }
@@ -54,36 +64,71 @@ class UsefulLinkController extends Controller
     /**
      * Show the form for editing the specified resource.
      *
-     * @param UsefulLink $usefulLink
-     * @return Response
+     * @param UsefulLink $usefullink
+     * @return Application|Factory|View
      */
-    public function edit(UsefulLink $usefulLink)
+    public function edit(UsefulLink $usefullink)
     {
-        //
+        return view('admin.usefullinks.edit' , [
+            'link' => $usefullink
+        ]);
     }
 
     /**
      * Update the specified resource in storage.
      *
      * @param Request $request
-     * @param UsefulLink $usefulLink
-     * @return Response
+     * @param UsefulLink $usefullink
+     * @return RedirectResponse
      */
-    public function update(Request $request, UsefulLink $usefulLink)
+    public function update(Request $request, UsefulLink $usefullink)
     {
-        //
+        $request->validate([
+            'icon' => 'required|string',
+            'title' => 'required|string|max:60',
+            'link' => 'required|string|max:191',
+            'description' => 'required|string|max:2000',
+        ]);
+
+        $usefullink->update($request->all());
+        return redirect()->route('admin.usefullinks.index')->with('success', 'link has been updated!');
     }
 
     /**
      * Remove the specified resource from storage.
      *
-     * @param UsefulLink $usefulLink
+     * @param UsefulLink $usefullink
      * @return Response
      */
-    public function destroy(UsefulLink $usefulLink)
+    public function destroy(UsefulLink $usefullink)
     {
-        dd($usefulLink);
+        $usefullink->delete();
+        return redirect()->back()->with('success', 'product has been removed!');
     }
 
-    
+    public function dataTable()
+    {
+        $query = UsefulLink::query();
+
+        return datatables($query)
+            ->addColumn('actions', function (UsefulLink $link) {
+                return '
+                            <a data-content="Edit" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.usefullinks.edit', $link->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
+
+                           <form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.usefullinks.destroy', $link->id) . '">
+                            ' . csrf_field() . '
+                            ' . method_field("DELETE") . '
+                           <button data-content="Delete" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
+                       </form>
+                ';
+            })
+            ->editColumn('created_at', function (UsefulLink $link) {
+                return $link->created_at ? $link->created_at->diffForHumans() : '';
+            })
+            ->editColumn('icon', function (UsefulLink $link) {
+                return "<i class='{$link->icon}'></i>";
+            })
+            ->rawColumns(['actions' , 'icon'])
+            ->make();
+    }
 }

+ 1 - 1
app/Models/UsefulLink.php

@@ -15,6 +15,6 @@ class UsefulLink extends Model
         'icon',
         'title',
         'link',
-        'message'
+        'description'
     ];
 }

+ 4 - 4
database/migrations/2021_06_09_213306_create_useful_links_table.php

@@ -16,10 +16,10 @@ class CreateUsefulLinksTable extends Migration
     {
         Schema::create('useful_links', function (Blueprint $table) {
             $table->id();
-            $table->string('icon')->default('');
-            $table->string('title')->default('Default Title');
-            $table->string('link')->default('https://bitsec.dev');
-            $table->string('message')->default('Default Message');
+            $table->string('icon');
+            $table->string('title');
+            $table->string('link')->nullable();
+            $table->text('description');
             $table->timestamps();
         });
     }

+ 3 - 9
database/seeders/UsefulLinksSeeder.php

@@ -18,25 +18,19 @@ class UsefulLinksSeeder extends Seeder
             'icon' => 'fas fa-egg',
             'title' => 'Pterodactyl Panel',
             'link' => env('PTERODACTYL_URL', 'http://localhost'),
-            'message' => 'Use your servers on our pterodactyl panel <small>(You can use the same login details)</small>'
+            'description' => 'Use your servers on our pterodactyl panel <small>(You can use the same login details)</small>'
         ]);
         UsefulLink::create([
             'icon' => 'fas fa-database',
             'title' => 'phpMyAdmin',
             'link' => env('PHPMYADMIN_URL', 'http://localhost'),
-            'message' => 'View your database online using phpMyAdmin'
+            'description' => 'View your database online using phpMyAdmin'
         ]);
         UsefulLink::create([
             'icon' => 'fab fa-discord',
             'title' => 'Discord',
             'link' => env('DISCORD_INVITE_URL'),
-            'message' => 'Need a helping hand? Want to chat? Got any questions? Join our discord!'
-        ]);
-        UsefulLink::create([
-            'icon' => 'fas fa-link',
-            'title' => 'Useful Links',
-            'link' => '_blank',
-            'message' => 'Want to make your own links that show here? Use the command <code>php artisan create:usefullink</code></br> Delete links via database (for now)'
+            'description' => 'Need a helping hand? Want to chat? Got any questions? Join our discord!'
         ]);
     }
 }

+ 1 - 0
public/css/app.css

@@ -1,4 +1,5 @@
 @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback);
+::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:#3a4047;border-radius:9px}::-webkit-scrollbar-thumb:hover{background:#2e3339}::-webkit-scrollbar-track{background:#343a40;border-radius:10px;box-shadow:inset 7px 10px 12px #343a40}
 /*!
  *   AdminLTE v3.1.0-rc
  *   Author: Colorlib

文件差異過大導致無法顯示
+ 0 - 0
public/css/app.css.map


文件差異過大導致無法顯示
+ 0 - 0
public/js/app.js.map


+ 1 - 1
public/plugins/fontawesome-free/css/all.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 .fa,

文件差異過大導致無法顯示
+ 1 - 1
public/plugins/fontawesome-free/css/all.min.css


+ 1 - 1
public/plugins/fontawesome-free/css/brands.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 @font-face {

+ 1 - 1
public/plugins/fontawesome-free/css/brands.min.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 @font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-brands-400.eot);src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands";font-weight:400}

+ 1 - 1
public/plugins/fontawesome-free/css/fontawesome.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 .fa,

文件差異過大導致無法顯示
+ 1 - 1
public/plugins/fontawesome-free/css/fontawesome.min.css


+ 1 - 1
public/plugins/fontawesome-free/css/regular.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 @font-face {

+ 1 - 1
public/plugins/fontawesome-free/css/regular.min.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 @font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-regular-400.eot);src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.far{font-family:"Font Awesome 5 Free";font-weight:400}

+ 1 - 1
public/plugins/fontawesome-free/css/solid.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 @font-face {

+ 1 - 1
public/plugins/fontawesome-free/css/solid.min.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 @font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.fas{font-family:"Font Awesome 5 Free";font-weight:900}

+ 1 - 1
public/plugins/fontawesome-free/css/svg-with-js.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 svg:not(:root).svg-inline--fa {

文件差異過大導致無法顯示
+ 1 - 1
public/plugins/fontawesome-free/css/svg-with-js.min.css


+ 1 - 1
public/plugins/fontawesome-free/css/v4-shims.css

@@ -1,5 +1,5 @@
 /*!
- * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
  */
 .fa.fa-glass:before {

文件差異過大導致無法顯示
+ 1 - 1
public/plugins/fontawesome-free/css/v4-shims.min.css


二進制
public/plugins/fontawesome-free/webfonts/fa-brands-400.eot


+ 2 - 2
public/plugins/fontawesome-free/webfonts/fa-brands-400.svg

@@ -2,11 +2,11 @@
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
 <metadata>
-Created by FontForge 20200314 at Mon Oct  5 09:50:45 2020
+Created by FontForge 20200314 at Wed Jan 13 11:57:55 2021
  By Robert Madole
 Copyright (c) Font Awesome
 </metadata>
-<!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
+<!-- Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
 <font id="FontAwesome5Brands-Regular" horiz-adv-x="448" >
   <font-face 
     font-family="Font Awesome 5 Brands Regular"

二進制
public/plugins/fontawesome-free/webfonts/fa-brands-400.ttf


二進制
public/plugins/fontawesome-free/webfonts/fa-brands-400.woff


二進制
public/plugins/fontawesome-free/webfonts/fa-brands-400.woff2


二進制
public/plugins/fontawesome-free/webfonts/fa-regular-400.eot


+ 2 - 2
public/plugins/fontawesome-free/webfonts/fa-regular-400.svg

@@ -2,11 +2,11 @@
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
 <metadata>
-Created by FontForge 20200314 at Mon Oct  5 09:50:45 2020
+Created by FontForge 20200314 at Wed Jan 13 11:57:54 2021
  By Robert Madole
 Copyright (c) Font Awesome
 </metadata>
-<!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
+<!-- Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
 <font id="FontAwesome5Free-Regular" horiz-adv-x="512" >
   <font-face 
     font-family="Font Awesome 5 Free Regular"

二進制
public/plugins/fontawesome-free/webfonts/fa-regular-400.ttf


二進制
public/plugins/fontawesome-free/webfonts/fa-regular-400.woff


二進制
public/plugins/fontawesome-free/webfonts/fa-regular-400.woff2


二進制
public/plugins/fontawesome-free/webfonts/fa-solid-900.eot


+ 2 - 2
public/plugins/fontawesome-free/webfonts/fa-solid-900.svg

@@ -2,11 +2,11 @@
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
 <metadata>
-Created by FontForge 20200314 at Mon Oct  5 09:50:45 2020
+Created by FontForge 20200314 at Wed Jan 13 11:57:55 2021
  By Robert Madole
 Copyright (c) Font Awesome
 </metadata>
-<!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
+<!-- Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
 <font id="FontAwesome5Free-Solid" horiz-adv-x="512" >
   <font-face 
     font-family="Font Awesome 5 Free Solid"

二進制
public/plugins/fontawesome-free/webfonts/fa-solid-900.ttf


二進制
public/plugins/fontawesome-free/webfonts/fa-solid-900.woff


二進制
public/plugins/fontawesome-free/webfonts/fa-solid-900.woff2


文件差異過大導致無法顯示
+ 0 - 0
public/plugins/summernote/summernote-bs4.min.css


文件差異過大導致無法顯示
+ 1 - 0
public/plugins/summernote/summernote-bs4.min.js


文件差異過大導致無法顯示
+ 0 - 0
public/plugins/summernote/summernote-bs4.min.js.map


+ 16 - 0
resources/css/stylesheet.css

@@ -0,0 +1,16 @@
+::-webkit-scrollbar {
+    width: 8px;
+    height: 8px;
+}
+::-webkit-scrollbar-thumb {
+    background: #3A4047;
+    border-radius: 9px;
+}
+::-webkit-scrollbar-thumb:hover{
+    background: #2E3339;
+}
+::-webkit-scrollbar-track{
+    background: #343a40;
+    border-radius: 10px;
+    box-shadow: inset 7px 10px 12px #343a40;
+}

+ 1 - 0
resources/sass/app.scss

@@ -2,6 +2,7 @@
 @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback');
 
 // Bootstrap
+@import '../css/stylesheet.css';
 @import '../css/adminlte.min.css';
 @import '../css/slim.min.css';
 

+ 1 - 1
resources/views/admin/servers/table.blade.php

@@ -25,7 +25,7 @@
             serverSide: true,
             stateSave: true,
             ajax: "{{route('admin.servers.datatable')}}{{$filter ?? ''}}",
-            order: [[ 6, "desc" ]],
+            order: [[ 5, "desc" ]],
             columns: [
                 {data: 'status' , name : 'servers.suspended'},
                 {data: 'name'},

+ 77 - 152
resources/views/admin/usefullinks/create.blade.php

@@ -6,13 +6,13 @@
         <div class="container-fluid">
             <div class="row mb-2">
                 <div class="col-sm-6">
-                    <h1>Products</h1>
+                    <h1>Useful Links</h1>
                 </div>
                 <div class="col-sm-6">
                     <ol class="breadcrumb float-sm-right">
                         <li class="breadcrumb-item"><a href="{{route('home')}}">Dashboard</a></li>
-                        <li class="breadcrumb-item"><a href="{{route('admin.products.index')}}">Products</a></li>
-                        <li class="breadcrumb-item"><a class="text-muted" href="{{route('admin.products.create')}}">Create</a>
+                        <li class="breadcrumb-item"><a href="{{route('admin.usefullinks.index')}}">Useful Links</a></li>
+                        <li class="breadcrumb-item"><a class="text-muted" href="{{route('admin.usefullinks.create')}}">Create</a>
                         </li>
                     </ol>
                 </div>
@@ -29,162 +29,70 @@
                 <div class="col-lg-6">
                     <div class="card">
                         <div class="card-body">
-                            <form action="{{route('admin.products.store')}}" method="POST">
+                            <form action="{{route('admin.usefullinks.store')}}" method="POST">
                                 @csrf
-                                <div class="d-flex flex-row-reverse">
-                                    <div class="custom-control custom-switch">
-                                        <input type="checkbox" name="disabled" class="custom-control-input custom-control-input-danger" id="switch1">
-                                        <label class="custom-control-label" for="switch1">Disabled <i data-toggle="popover" data-trigger="hover" data-content="Will hide this option from being selected" class="fas fa-info-circle"></i></label>
-                                    </div>
-                                </div>
-
-                                <div class="row">
-                                    <div class="col-lg-6">
-                                        <div class="form-group">
-                                            <label for="name">Name</label>
-                                            <input value="{{old('name')}}" id="name" name="name" type="text"
-                                                   class="form-control @error('name') is-invalid @enderror"
-                                                   required="required">
-                                            @error('name')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
-
-                                        <div class="form-group">
-                                            <label for="price">Price in credits</label>
-                                            <input value="{{old('price')}}" id="price" name="price"
-                                                   type="number"
-                                                   class="form-control @error('price') is-invalid @enderror"
-                                                   required="required">
-                                            @error('price')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
 
-                                        <div class="form-group">
-                                            <label for="memory">Memory</label>
-                                            <input value="{{old('memory')}}" id="memory" name="memory"
-                                                   type="number"
-                                                   class="form-control @error('memory') is-invalid @enderror"
-                                                   required="required">
-                                            @error('memory')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
 
-                                        <div class="form-group">
-                                            <label for="cpu">Cpu</label>
-                                            <input value="{{old('cpu')}}" id="cpu" name="cpu"
-                                                   type="number"
-                                                   class="form-control @error('cpu') is-invalid @enderror"
-                                                   required="required">
-                                            @error('cpu')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
-
-                                        <div class="form-group">
-                                            <label for="swap">Swap</label>
-                                            <input value="{{old('swap')}}" id="swap" name="swap"
-                                                   type="number"
-                                                   class="form-control @error('swap') is-invalid @enderror"
-                                                   required="required">
-                                            @error('swap')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
+                                <div class="form-group">
+                                    <label for="icon">Icon class name</label>
+                                    <input value="{{old('icon')}}" id="icon" name="icon"
+                                           type="text"
+                                           placeholder="fas fa-user"
+                                           class="form-control @error('icon') is-invalid @enderror"
+                                           required="required">
+                                    <div class="text-muted">
+                                        You can find available free icons <a target="_blank"
+                                                                             href="https://fontawesome.com/v5.15/icons?d=gallery&p=2">here</a>
+                                    </div>
+                                    @error('icon')
+                                    <div class="invalid-feedback">
+                                        {{$message}}
+                                    </div>
+                                    @enderror
+                                </div>
 
-                                        <div class="form-group">
-                                            <label for="description">Description <i data-toggle="popover" data-trigger="hover" data-content="This is what the users sees" class="fas fa-info-circle"></i></label>
-                                            <textarea id="description" name="description"
-                                                      type="text"
-                                                      class="form-control @error('description') is-invalid @enderror"
-                                                      required="required">{{old('description')}}</textarea>
-                                            @error('description')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
+                                <div class="form-group">
+                                    <label for="title">Title</label>
+                                    <input value="{{old('title')}}" id="title" name="title"
+                                           type="text"
+                                           class="form-control @error('title') is-invalid @enderror"
+                                           required="required">
+                                    @error('title')
+                                    <div class="invalid-feedback">
+                                        {{$message}}
+                                    </div>
+                                    @enderror
+                                </div>
 
+                                <div class="form-group">
+                                    <label for="link">Link</label>
+                                    <input value="{{old('link')}}" id="link" name="link"
+                                           type="text"
+                                           class="form-control @error('link') is-invalid @enderror"
+                                           required="required">
+                                    @error('link')
+                                    <div class="invalid-feedback">
+                                        {{$message}}
                                     </div>
-                                    <div class="col-lg-6">
-                                        <div class="form-group">
-                                            <label for="disk">Disk</label>
-                                            <input value="{{old('disk') ?? 1000}}" id="disk" name="disk"
-                                                   type="number"
-                                                   class="form-control @error('disk') is-invalid @enderror"
-                                                   required="required">
-                                            @error('disk')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
-                                        <div class="form-group">
-                                            <label for="io">IO</label>
-                                            <input value="{{old('io') ?? 500}}" id="io" name="io"
-                                                   type="number"
-                                                   class="form-control @error('io') is-invalid @enderror"
-                                                   required="required">
-                                            @error('io')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
-                                        <div class="form-group">
-                                            <label for="databases">Databases</label>
-                                            <input value="{{old('databases') ?? 1}}" id="databases"
-                                                   name="databases"
-                                                   type="number"
-                                                   class="form-control @error('databases') is-invalid @enderror"
-                                                   required="required">
-                                            @error('databases')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
-                                        <div class="form-group">
-                                            <label for="backups">Backups</label>
-                                            <input value="{{old('backups') ?? 1}}" id="backups"
-                                                   name="backups"
-                                                   type="number"
-                                                   class="form-control @error('backups') is-invalid @enderror"
-                                                   required="required">
-                                            @error('backups')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
-                                        <div class="form-group">
-                                            <label for="allocations">Allocations</label>
-                                            <input value="{{old('allocations') ?? 0}}"
-                                                   id="allocations" name="allocations"
-                                                   type="number"
-                                                   class="form-control @error('allocations') is-invalid @enderror"
-                                                   required="required">
-                                            @error('allocations')
-                                            <div class="invalid-feedback">
-                                                {{$message}}
-                                            </div>
-                                            @enderror
-                                        </div>
+                                    @enderror
+                                </div>
+
+                                <div class="form-group">
+                                    <label for="description">Description</label>
+                                    <textarea id="description"
+                                              name="description"
+                                              type="text"
+                                              class="form-control @error('description') is-invalid @enderror">
+                                        {{old('description')}}
+                                    </textarea>
+                                    @error('description')
+                                    <div class="text-danger">
+                                        {{$message}}
                                     </div>
+                                    @enderror
                                 </div>
 
+
                                 <div class="form-group text-right">
                                     <button type="submit" class="btn btn-primary">
                                         Submit
@@ -199,7 +107,24 @@
         </div>
     </section>
     <!-- END CONTENT -->
-
-
+    <script>
+        document.addEventListener('DOMContentLoaded', (event) => {
+            // Summernote
+            $('#description').summernote({
+                height: 100,
+                toolbar: [
+                    [ 'style', [ 'style' ] ],
+                    [ 'font', [ 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'clear'] ],
+                    [ 'fontname', [ 'fontname' ] ],
+                    [ 'fontsize', [ 'fontsize' ] ],
+                    [ 'color', [ 'color' ] ],
+                    [ 'para', [ 'ol', 'ul', 'paragraph', 'height' ] ],
+                    [ 'table', [ 'table' ] ],
+                    [ 'insert', [ 'link'] ],
+                    [ 'view', [ 'undo', 'redo', 'fullscreen', 'codeview', 'help' ] ]
+                ]
+            })
+        })
+    </script>
 
 @endsection

+ 21 - 7
resources/views/admin/usefullinks/edit.blade.php

@@ -12,7 +12,7 @@
                     <ol class="breadcrumb float-sm-right">
                         <li class="breadcrumb-item"><a href="{{route('home')}}">Dashboard</a></li>
                         <li class="breadcrumb-item"><a href="{{route('admin.usefullinks.index')}}">Useful Links</a></li>
-                        <li class="breadcrumb-item"><a class="text-muted" href="{{route('admin.usefullinks.create')}}">Create</a>
+                        <li class="breadcrumb-item"><a class="text-muted" href="{{route('admin.usefullinks.edit' , $link->id)}}">Edit</a>
                         </li>
                     </ol>
                 </div>
@@ -29,13 +29,14 @@
                 <div class="col-lg-6">
                     <div class="card">
                         <div class="card-body">
-                            <form action="{{route('admin.usefullinks.store')}}" method="POST">
+                            <form action="{{route('admin.usefullinks.update' , $link->id)}}" method="POST">
                                 @csrf
+                                @method('PATCH')
 
 
                                 <div class="form-group">
                                     <label for="icon">Icon class name</label>
-                                    <input value="{{old('icon')}}" id="icon" name="icon"
+                                    <input value="{{$link->icon}}" id="icon" name="icon"
                                            type="text"
                                            placeholder="fas fa-user"
                                            class="form-control @error('icon') is-invalid @enderror"
@@ -53,7 +54,7 @@
 
                                 <div class="form-group">
                                     <label for="title">Title</label>
-                                    <input value="{{old('title')}}" id="title" name="title"
+                                    <input value="{{$link->title}}" id="title" name="title"
                                            type="text"
                                            class="form-control @error('title') is-invalid @enderror"
                                            required="required">
@@ -66,7 +67,7 @@
 
                                 <div class="form-group">
                                     <label for="link">Link</label>
-                                    <input value="{{old('link')}}" id="link" name="link"
+                                    <input value="{{$link->link}}" id="link" name="link"
                                            type="text"
                                            class="form-control @error('link') is-invalid @enderror"
                                            required="required">
@@ -83,7 +84,7 @@
                                               name="description"
                                               type="text"
                                               class="form-control @error('description') is-invalid @enderror">
-                                        {{old('description')}}
+                                        {{$link->description}}
                                     </textarea>
                                     @error('description')
                                     <div class="text-danger">
@@ -112,7 +113,20 @@
     <script>
         document.addEventListener('DOMContentLoaded', (event) => {
             // Summernote
-            $('#description').summernote()
+            $('#description').summernote({
+                height: 100,
+                toolbar: [
+                    [ 'style', [ 'style' ] ],
+                    [ 'font', [ 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'clear'] ],
+                    [ 'fontname', [ 'fontname' ] ],
+                    [ 'fontsize', [ 'fontsize' ] ],
+                    [ 'color', [ 'color' ] ],
+                    [ 'para', [ 'ol', 'ul', 'paragraph', 'height' ] ],
+                    [ 'table', [ 'table' ] ],
+                    [ 'insert', [ 'link'] ],
+                    [ 'view', [ 'undo', 'redo', 'fullscreen', 'codeview', 'help' ] ]
+                ]
+            })
         })
     </script>
 

+ 14 - 31
resources/views/admin/usefullinks/index.blade.php

@@ -6,15 +6,14 @@
         <div class="container-fluid">
             <div class="row mb-2">
                 <div class="col-sm-6">
-                    <h1>Products</h1>
+                    <h1>Useful Links</h1>
                 </div>
                 <div class="col-sm-6">
                     <ol class="breadcrumb float-sm-right">
                         <li class="breadcrumb-item"><a href="{{route('home')}}">Dashboard</a></li>
                         <li class="breadcrumb-item"><a class="text-muted"
-                                                       href="{{route('admin.products.index')}}">Products</a></li>
+                                                       href="{{route('admin.usefullinks.index')}}">Useful Links</a></li>
                     </ol>
-                </div>
             </div>
         </div>
     </section>
@@ -28,29 +27,20 @@
 
                 <div class="card-header">
                     <div class="d-flex justify-content-between">
-                        <h5 class="card-title"><i class="fas fa-sliders-h mr-2"></i>Products</h5>
-                        <a href="{{route('admin.products.create')}}" class="btn btn-sm btn-primary"><i
+                        <h5 class="card-title"><i class="fas fa-sliders-h mr-2"></i>Useful Links</h5>
+                        <a href="{{route('admin.usefullinks.create')}}" class="btn btn-sm btn-primary"><i
                                 class="fas fa-plus mr-1"></i>Create new</a>
                     </div>
                 </div>
 
                 <div class="card-body table-responsive">
-
                     <table id="datatable" class="table table-striped">
                         <thead>
                         <tr>
-                            <th>Active</th>
-                            <th>Name</th>
-                            <th>Price</th>
-                            <th>Memory</th>
-                            <th>Cpu</th>
-                            <th>Swap</th>
-                            <th>Disk</th>
-                            <th>IO</th>
-                            <th>Databases</th>
-                            <th>Backups</th>
-                            <th>Allocations</th>
-                            <th>Servers</th>
+                            <th>description</th>
+                            <th width="50">Icon</th>
+                            <th>Title</th>
+                            <th>Link</th>
                             <th>Created at</th>
                             <th></th>
                         </tr>
@@ -79,20 +69,13 @@
                 processing: true,
                 serverSide: true,
                 stateSave: true,
-                ajax: "{{route('admin.products.datatable')}}",
+                ajax: "{{route('admin.usefullinks.datatable')}}",
+                order: [[ 1, "asc" ]],
                 columns: [
-                    {data: 'disabled'},
-                    {data: 'name'},
-                    {data: 'price'},
-                    {data: 'memory'},
-                    {data: 'cpu'},
-                    {data: 'swap'},
-                    {data: 'disk'},
-                    {data: 'io'},
-                    {data: 'databases'},
-                    {data: 'backups'},
-                    {data: 'allocations'},
-                    {data: 'servers', sortable: false},
+                    {data: 'description' ,visible: false},
+                    {data: 'icon'},
+                    {data: 'title'},
+                    {data: 'link'},
                     {data: 'created_at'},
                     {data: 'actions', sortable: false},
                 ],

+ 1 - 1
resources/views/home.blade.php

@@ -89,7 +89,7 @@
                                             <i class="{{ $useful_link->icon }} mr-2"></i>{{ $useful_link->title }}
                                         </a>
                                     </h5>
-                                    {!! $useful_link->message !!}
+                                    {!! $useful_link->description !!}
                                 </div>
                             @endforeach
                         </div>

+ 37 - 13
resources/views/layouts/main.blade.php

@@ -13,6 +13,8 @@
     {{--    <link rel="stylesheet" href="{{asset('css/adminlte.min.css')}}">--}}
     <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.24/datatables.min.css"/>
 
+    {{--  summernote --}}
+    <link rel="stylesheet" href="{{asset('plugins/summernote/summernote-bs4.min.css')}}">
 
     <link rel="stylesheet" href="{{asset('css/app.css')}}">
     <link rel="preload" href="{{asset('plugins/fontawesome-free/css/all.min.css')}}" as="style"
@@ -45,7 +47,8 @@
                 <a class="nav-link" data-toggle="dropdown" href="#">
                     <i class="far fa-bell"></i>
                     @if(Auth::user()->unreadNotifications->count() != 0)
-                        <span class="badge badge-warning navbar-badge">{{Auth::user()->unreadNotifications->count()}}</span>
+                        <span
+                            class="badge badge-warning navbar-badge">{{Auth::user()->unreadNotifications->count()}}</span>
                     @endif
                 </a>
                 <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
@@ -54,19 +57,22 @@
 
                     @foreach(Auth::user()->unreadNotifications->sortBy('created_at')->take(5) as $notification)
                         <a href="{{route('notifications.show' , $notification->id)}}" class="dropdown-item">
-                            <span class="d-inline-block text-truncate" style="max-width: 150px;"><i class="fas fa-envelope mr-2"></i>{{$notification->data['title']}}</span>
+                            <span class="d-inline-block text-truncate" style="max-width: 150px;"><i
+                                    class="fas fa-envelope mr-2"></i>{{$notification->data['title']}}</span>
                             <span
                                 class="float-right text-muted text-sm">{{$notification->created_at->longAbsoluteDiffForHumans()}} ago</span>
                         </a>
                     @endforeach
 
                     <div class="dropdown-divider"></div>
-                    <a href="{{route('notifications.index')}}" class="dropdown-item dropdown-footer">See All Notifications</a>
+                    <a href="{{route('notifications.index')}}" class="dropdown-item dropdown-footer">See All
+                        Notifications</a>
                 </div>
             </li>
 
             <li class="nav-item dropdown no-arrow">
-                <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true"
+                <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
+                   aria-haspopup="true"
                    aria-expanded="false">
                     <span class="mr-1 d-none d-lg-inline text-gray-600 small">
                         {{Auth::user()->name}}
@@ -115,11 +121,12 @@
         </a>
 
         <!-- Sidebar -->
-        <div class="sidebar">
+        <div class="sidebar" style="overflow-y: auto">
 
             <!-- Sidebar Menu -->
-            <nav class="mt-2">
-                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
+            <nav class="my-2">
+                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu"
+                    data-accordion="false">
                     <!-- Add icons to the links using the .nav-icon class
                          with font-awesome or any other icon font library -->
                     <li class="nav-item">
@@ -130,7 +137,8 @@
                     </li>
 
                     <li class="nav-item">
-                        <a href="{{route('servers.index')}}" class="nav-link @if(Request::routeIs('servers.*')) active @endif">
+                        <a href="{{route('servers.index')}}"
+                           class="nav-link @if(Request::routeIs('servers.*')) active @endif">
                             <i class="nav-icon fa fa-server"></i>
                             <p>Servers
                                 <span
@@ -151,7 +159,8 @@
                         <li class="nav-header">Admin</li>
 
                         <li class="nav-item">
-                            <a href="{{route('admin.users.index')}}" class="nav-link @if(Request::routeIs('admin.users.*')) active @endif">
+                            <a href="{{route('admin.users.index')}}"
+                               class="nav-link @if(Request::routeIs('admin.users.*')) active @endif">
                                 <i class="nav-icon fas fa-users"></i>
                                 <p>Users</p>
                             </a>
@@ -174,7 +183,8 @@
                         </li>
 
                         <li class="nav-item">
-                            <a href="{{route('admin.store.index')}}" class="nav-link @if(Request::routeIs('admin.store.*')) active @endif">
+                            <a href="{{route('admin.store.index')}}"
+                               class="nav-link @if(Request::routeIs('admin.store.*')) active @endif">
                                 <i class="nav-icon fas fa-shopping-basket"></i>
                                 <p>Store</p>
                             </a>
@@ -183,14 +193,16 @@
                         <li class="nav-header">Pterodactyl</li>
 
                         <li class="nav-item">
-                            <a href="{{route('admin.nodes.index')}}" class="nav-link @if(Request::routeIs('admin.nodes.*')) active @endif">
+                            <a href="{{route('admin.nodes.index')}}"
+                               class="nav-link @if(Request::routeIs('admin.nodes.*')) active @endif">
                                 <i class="nav-icon fas fa-sitemap"></i>
                                 <p>Nodes</p>
                             </a>
                         </li>
 
                         <li class="nav-item">
-                            <a href="{{route('admin.nests.index')}}" class="nav-link @if(Request::routeIs('admin.nests.*')) active @endif">
+                            <a href="{{route('admin.nests.index')}}"
+                               class="nav-link @if(Request::routeIs('admin.nests.*')) active @endif">
                                 <i class="nav-icon fas fa-th-large"></i>
                                 <p>Nests</p>
                             </a>
@@ -242,6 +254,15 @@
                             </a>
                         </li>
 
+                        <li class="nav-item">
+                            <a href="{{route('admin.usefullinks.index')}}"
+                               class="nav-link @if(Request::routeIs('admin.usefullinks.*')) active @endif">
+                                <i class="nav-icon fas fa-link"></i>
+                                <p>Useful Links</p>
+                            </a>
+                        </li>
+
+
                     @endif
 
                 </ul>
@@ -257,7 +278,8 @@
     </div>
     <!-- /.content-wrapper -->
     <footer class="main-footer">
-        <strong>Copyright &copy; 2021-{{date('Y')}} <a href="{{url('/')}}">{{env('APP_NAME' , 'Laravel')}}</a>.</strong> All rights
+        <strong>Copyright &copy; 2021-{{date('Y')}} <a href="{{url('/')}}">{{env('APP_NAME' , 'Laravel')}}</a>.</strong>
+        All rights
         reserved.
     </footer>
 
@@ -277,6 +299,8 @@
 <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10.14.1/dist/sweetalert2.all.min.js"></script>
 <script src="{{asset('js/app.js')}}"></script>
 <script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.24/datatables.min.js"></script>
+<!-- Summernote -->
+<script src="{{asset('plugins/summernote/summernote-bs4.min.js')}}"></script>
 
 <script>
     $(document).ready(function () {

+ 4 - 0
routes/web.php

@@ -10,6 +10,7 @@ use App\Http\Controllers\Admin\PaypalProductController;
 use App\Http\Controllers\Admin\ProductController;
 use App\Http\Controllers\Admin\ServerController as AdminServerController;
 use App\Http\Controllers\Admin\SettingsController;
+use App\Http\Controllers\Admin\UsefulLinkController;
 use App\Http\Controllers\Admin\UserController;
 use App\Http\Controllers\Auth\SocialiteController;
 use App\Http\Controllers\HomeController;
@@ -101,6 +102,9 @@ Route::middleware('auth')->group(function () {
         Route::patch('settings/update/icons', [SettingsController::class , 'updateIcons'])->name('settings.update.icons');
         Route::resource('settings', SettingsController::class)->only('index');
 
+        Route::get('usefullinks/datatable', [UsefulLinkController::class, 'datatable'])->name('usefullinks.datatable');
+        Route::resource('usefullinks', UsefulLinkController::class);
+
         Route::get('api/datatable', [ApplicationApiController::class, 'datatable'])->name('api.datatable');
         Route::resource('api', ApplicationApiController::class)->parameters([
             'api' => 'applicationApi',

部分文件因文件數量過多而無法顯示