Сделана главная страница с инфой по стримам, инфа подтягивается из БД
This commit is contained in:
parent
11c038d492
commit
0ff8a2cf42
|
@ -6,7 +6,7 @@ namespace App\Http\Controllers\Api\V1;
|
|||
use App\Http\Controllers\Controller;
|
||||
|
||||
|
||||
class IndexController extends Controller
|
||||
class CaesarController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Link;
|
||||
|
||||
class LinksController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return $this->getAll();
|
||||
}
|
||||
|
||||
public function getAll(){
|
||||
$links = new Link();
|
||||
return $links->all();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Weekdays;
|
||||
use App\Models\Game;
|
||||
use App\Models\Schedule;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SchedulesController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$finalSchedules = DB::table('schedules')
|
||||
->join('weekdays', "schedules.weekday_id", "=", "weekdays.weekday_id")
|
||||
->join("games", "schedules.game_id", "=", "games.game_id")
|
||||
->select("weekdays.weekday_name", "weekdays.current_date", "games.name", "schedules.stream_time")
|
||||
->get();
|
||||
return $finalSchedules;
|
||||
}
|
||||
|
||||
public function mmDate(){
|
||||
$minmaxDates = DB::table("weekdays")
|
||||
->select("weekdays.current_date")->where("weekday_id", "=", 1)
|
||||
->orWhere("weekday_id", "=", 7)
|
||||
->get();
|
||||
return $minmaxDates;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Game extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Link extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Schedule extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Weekdays extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('links', function (Blueprint $table) {
|
||||
$table->id('link_id');
|
||||
$table->text("link_name");
|
||||
$table->text("link");
|
||||
$table->text("image");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('links');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('weekdays', function (Blueprint $table) {
|
||||
$table->id("weekday_id");
|
||||
$table->text("weekday_name");
|
||||
$table->date("current_date");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('weekdays');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('games', function (Blueprint $table) {
|
||||
$table->id("game_id");
|
||||
$table->text("name");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('games');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('schedules', function (Blueprint $table) {
|
||||
$table->id("schedule_id");
|
||||
$table->foreignId("weekday_id")->constrained(
|
||||
table: "weekdays", column: "weekday_id", indexName: "constraint_weekday_id"
|
||||
);
|
||||
$table->foreignId("game_id")->constrained(
|
||||
table: "games", column: "game_id", indexName: "constraint_game_id"
|
||||
);
|
||||
$table->text("stream_time");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('schedules');
|
||||
}
|
||||
};
|
|
@ -3,7 +3,8 @@
|
|||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
"build": "vite build",
|
||||
"lara": "vite build && php artisan serve"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.0.3",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
|
@ -0,0 +1,85 @@
|
|||
<template>
|
||||
<v-sheet class="bg-gradient h-100 w-100 d-flex justify-center">
|
||||
<v-sheet class="mt-5 mb-5 rounded-lg w-75">
|
||||
<p class="text-h3 ma-5">Расписание стримов</p>
|
||||
<p class="ma-5 text-h4">{{ parseDate(dates[0].current_date) }} - {{ parseDate(dates[1].current_date) }}</p>
|
||||
<div class="w-100 d-flex justify-center">
|
||||
<v-table class="text-h5 w-66">
|
||||
<tbody>
|
||||
<tr v-for="schedule in schedules">
|
||||
<td>{{ parseDate(schedule.current_date) }} {{ schedule.weekday_name }} {{ schedule.stream_time }}</td>
|
||||
<td>{{ schedule.name }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-table>
|
||||
</div>
|
||||
<p class="text-h3 ma-5">Ссылочки</p>
|
||||
<div class="w-100 d-flex justify-center">
|
||||
<v-list class="w-66">
|
||||
<v-list-item class="ma-5" style="background-color: #1976D2; color: #FFFFFF" elevation="6" v-for="link in links" :href="link.link">
|
||||
<template v-slot:prepend>
|
||||
<v-avatar :image="link.image" rounded="0"></v-avatar>
|
||||
</template>
|
||||
<v-list-item-title>{{ link.link_name }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</div>
|
||||
<!--
|
||||
|
||||
-->
|
||||
</v-sheet>
|
||||
</v-sheet>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
name: "Schedule",
|
||||
data: () => ({
|
||||
links: [],
|
||||
schedules: [],
|
||||
dates: []
|
||||
}),
|
||||
methods: {
|
||||
parseDate(date){
|
||||
let dateArr = date.split("-");
|
||||
return dateArr[2] + "." + dateArr[1];
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
axios
|
||||
.get('/api/v1/links')
|
||||
.then(response => (this.links = response.data));
|
||||
axios
|
||||
.get('/api/v1/schedules')
|
||||
.then(response => (this.schedules = response.data));
|
||||
axios
|
||||
.get('/api/v1/dates')
|
||||
.then(response => (this.dates = response.data));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.bg-gradient {
|
||||
background: linear-gradient(-45deg, #f103b0, #f0a068, #4fdbfeff);
|
||||
background-size: 200% 200%;
|
||||
animation: gradient 15s ease infinite;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
@keyframes gradient {
|
||||
0% {
|
||||
background-position: 0 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0 50%;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -1,15 +1,15 @@
|
|||
<template>
|
||||
<v-app>
|
||||
<Polyfill></Polyfill>
|
||||
<Schedule></Schedule>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Polyfill from "./Polyfill.vue";
|
||||
import Schedule from "./Schedule.vue"
|
||||
|
||||
export default {
|
||||
name: "Welcome",
|
||||
components: {Polyfill}
|
||||
components: {Schedule}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ export default {
|
|||
|
||||
<style scoped>
|
||||
.bg-gradient {
|
||||
background: linear-gradient(-45deg, #6947ea, #ffd298, #4698bb);
|
||||
background: linear-gradient(-45deg, #f103b0, #f0a068, #4fdbfeff);
|
||||
background-size: 200% 200%;
|
||||
animation: gradient 15s ease infinite;
|
||||
height: 100vh;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Резюме</title>
|
||||
<title>Информация о трансляциях</title>
|
||||
@vite('resources/welcome.js')
|
||||
@vite('resources/css/app.css')
|
||||
</head>
|
||||
|
|
|
@ -14,4 +14,7 @@ use Illuminate\Support\Facades\Route;
|
|||
|
|
||||
*/
|
||||
|
||||
Route::get('/', 'App\Http\Controllers\Api\V1\IndexController@index')->name('caesar');
|
||||
Route::get('/', 'App\Http\Controllers\Api\V1\CaesarController@index')->name('caesar');
|
||||
Route::get('/links', 'App\Http\Controllers\LinksController@index')->name('links');
|
||||
Route::get('/schedules', 'App\Http\Controllers\SchedulesController@index')->name('schedules');
|
||||
Route::get('/dates', 'App\Http\Controllers\SchedulesController@mmDate')->name('dates');
|
||||
|
|
Loading…
Reference in New Issue