FEATURE: Website loading now anything from DB

This commit is contained in:
Nikurasu 2021-12-16 06:09:58 +01:00
parent a2d5e085eb
commit cf2f28ba27
13 changed files with 986 additions and 892 deletions

2
.gitignore vendored
View file

@ -15,3 +15,5 @@ yarn-error.log
/.vscode
.editorconfig
socialtree.sqlite
database.db
node_modules

View file

@ -0,0 +1,43 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class loadAll extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'loadDB:all';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Loads all the config from the json into the DB';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
return Command::SUCCESS;
}
}

View file

@ -25,10 +25,14 @@ class SocialTreePageController extends Controller
["id" => 3, "platform" => "LinkedIn", "link" => "https://linkedIn.com/test", "linktext" => "LinkedIn", "brandcolors" => true],
];
$links = $this->socialTreePageService->getLinks();
$config = $this->socialTreePageService->getConfig()[0];
$username = $config['username'];
$theme = $config['theme'];
return view('app',[
'title' => 'Nikurasus LinkTree',
'title' => $username . 's LinkTree',
'username' => $username,
'links' => $links,
'theme' => $theme,
'content' => 'linkpage'
]);
}

View file

@ -3,6 +3,7 @@
namespace App\Services;
use App\Models\links;
use App\Models\userdata;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\DB;
@ -13,4 +14,9 @@ class SocialTreePageDataProvider
{
return links::all()->toArray();
}
public function getConfig(): array
{
return userdata::all()->toArray();
}
}

View file

@ -16,4 +16,9 @@ class SocialTreePageService
return $this->socialTreePageDataProvider->getLinks();
}
public function getConfig(): array
{
return $this->socialTreePageDataProvider->getConfig();
}
}

1794
src/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -19307,10 +19307,10 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/**
/***/ }),
/***/ "./resources/css/app.scss":
/*!********************************!*\
!*** ./resources/css/app.scss ***!
\********************************/
/***/ "./resources/css/orange.scss":
/*!***********************************!*\
!*** ./resources/css/orange.scss ***!
\***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
@ -19636,7 +19636,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "/js/app": 0,
/******/ "css/app": 0
/******/ "css/orange": 0
/******/ };
/******/
/******/ // no chunk on demand loading
@ -19686,8 +19686,8 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./resources/js/app.js")))
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./resources/css/app.scss")))
/******/ __webpack_require__.O(undefined, ["css/orange"], () => (__webpack_require__("./resources/js/app.js")))
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["css/orange"], () => (__webpack_require__("./resources/css/orange.scss")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()

View file

@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
"/css/orange.css": "/css/orange.css"
}

View file

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="{{ asset('css/'. $theme . '.css') }}" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap" rel="stylesheet">

View file

@ -3,7 +3,7 @@
<p class="username">&commat;{{$username}}</p>
<div class="links">
@foreach($links as $link)
@if(boolval(['brandcolors']))
@if(boolval($link['brandcolors']))
<a class="link link-{{strtolower($link['platform'])}}" href="{{$link['link']}}">{{$link['linktext']}}</a>
@else
<a class="link link-default" href="{{$link['link']}}">{{$link['linktext']}}</a>

View file

@ -12,4 +12,4 @@ const mix = require('laravel-mix');
*/
mix.js('resources/js/app.js', 'public/js');
mix.sass('resources/css/app.scss', 'public/css');
mix.sass('resources/css/orange.scss', 'public/css');