README update, sql migrations

This commit is contained in:
Valér Jakubčo 2023-06-19 18:09:20 +02:00
parent dc615613d8
commit d32a18a51d
2 changed files with 164 additions and 45 deletions

146
README.md
View File

@ -1,66 +1,122 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
# Admin panel k bakalárskej práci
Webové rozhranie pripravené v PHP frameworku Laravel.
K fungovaniu aplikácie je potrebný SQL server, v našom prípade je to riešené pomocou mariadb.
Odporúčam použiť server Nginx, pretože poskytuje vyššiu rýchlosť ako napríklad Apache web server.
Ďalej je potrebné mať nainštalované php-fpm
Postup konfigurácie je písaný pre operačný systém GNU/Linux.
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
# Konfiguráciu NGINX
Pre inštaláciu Nginx použijeme následujúce príkazy.
## About Laravel
Debian, Ubuntu:
```
# apt install nginx php-fpm mariadb composer
```
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
Arch Linux:
```
# pacman -Sy nginx php-fpm mariadb composer
```
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Fedora:
```
# dnf install nginx php-fpm mariadb composer
```
Laravel is accessible, powerful, and provides tools required for large, robust applications.
V priečinku /etc/nginx/sites-available vytvoríme súbor pre našu webstránku napr. bakalarka_web.
Do súboru vložíme následujúcu konfiguráciu:
```
server {
server_name {nazov_servera};
root {korenovy_priecinok_webu};
## Learning Laravel
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
index index.php index.html;
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
location / {
try_files $uri $uri/ /index.php?$query_string;
}
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
## Laravel Sponsors
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/valerjakubco.xyz/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/valerjakubco.xyz/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
}
### Premium Partners
server {
if ($host = valerjakubco.xyz) {
return 301 https://$host$request_uri;
} # managed by Certbot
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
## Contributing
listen 80;
server_name valerjakubco.xyz;
return 404; # managed by Certbot
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
}
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
```
## Security Vulnerabilities
Na miesta nazov_servera doplníme názov servera alebo teda doménu nášho servera, ak nejakú máme.
Namiesto korenovy_priecinok_webu doplníme celú cestu k priečinku v ktorom sa nachádza náš web.
Pomocou príkazu nastavíme majiteľa a skupinu na www-data, to je základný názov pre Nginx používateľa.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
# Konfigurácia databázy
Databázový server je nainštalovaný po spustení úvodných príkazov. Ďalšia konfigurácia nie je potrebná
## License
# Konfigurácia webového rozhrania
Po naklonovaní repozitára do cieľového priečinku spustíme inštaláciu modulov pomocou príkazu:
```
$ composer install
```
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
Po úspešnom nainštalovaní potrebných súborov môžeme spustiť migráciu databázy pomocou pripravených migrations. To spustíme pomocou príkazu:
```
$ php artisan migrate
```
Ak by tento príkaz nezbehol správne môžeme tabuľky vytvoriť manuálne pomocou priloženého dumpu zo štruktúry databázy s názvom structure_dump.sql v tomto repozitári.
Môžeme použiť príkaz mysql dostupný v baličku mariadb
```
$ mysql -u{nazov_pouzivatela} -p
```
Následne vytvoríme databázu z názvom bakalarka pomocou príkazu:
```
CREATE DATABASE bakalarka;
```
A naimportujeme štruktúru pomocou príkazu:
```
source structure_dump.sql;
```
# Konfigurácia HTTPS
Ak chceme server používať so zabezpečeným HTTP protokolom, potrebujeme k tomu utilitu certbot, ktorá pomocou utility Let's encrypt vytvorí a nastaví certifikáty pre Nginx.
Debian, Ubuntu:
```
# apt install python3-certbot-nginx
```
Arch Linux:
```
# pacman -Sy python3-certbot-nginx
```
Fedora:
```
# dnf install python3-certbot-nginx
```
Pomocou príkazu:
```
# certbot --nginx
```
Certbot ma interaktívnu konfiguráciu, takže po spustení pokračovať podľa inštrukcií na obrazovke.

63
structure_dump.sql Normal file
View File

@ -0,0 +1,63 @@
CREATE TABLE `failed_jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) NOT NULL,
`connection` text NOT NULL,
`queue` text NOT NULL,
`payload` longtext NOT NULL,
`exception` longtext NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
CREATE TABLE `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(255) NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
CREATE TABLE `password_reset_tokens` (
`email` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
CREATE TABLE `password_resets` (
`email` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
CREATE TABLE `personal_access_tokens` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`tokenable_type` varchar(255) NOT NULL,
`tokenable_id` bigint(20) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`token` varchar(64) NOT NULL,
`abilities` text DEFAULT NULL,
`last_used_at` timestamp NULL DEFAULT NULL,
`expires_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
CREATE TABLE `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) NOT NULL,
`remember_token` varchar(100) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci