mirror of
https://github.com/robonen/education-project.git
synced 2026-03-20 02:44:31 +00:00
Модуль журнала
This commit is contained in:
38
app/Filters/JournalFilter.php
Normal file
38
app/Filters/JournalFilter.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class JournalFilter extends QueryFilter
|
||||
{
|
||||
|
||||
protected function student($value)
|
||||
{
|
||||
$this->builder = $this->builder->where('student_id', $value);
|
||||
}
|
||||
|
||||
protected function teacher($value)
|
||||
{
|
||||
$this->builder = $this->builder->where('teacher_id', $value);
|
||||
}
|
||||
|
||||
protected function subject($value)
|
||||
{
|
||||
$this->builder = $this->builder->where('subject_id', $value);
|
||||
}
|
||||
|
||||
protected function date($value)
|
||||
{
|
||||
$value = Carbon::createFromTimestamp($value/1000)->floorDays();
|
||||
$this->builder = $this->builder->where('updated_at', $value);
|
||||
}
|
||||
|
||||
protected function last($value)
|
||||
{
|
||||
$date = Carbon::now()->subDays($value);
|
||||
$this->builder = $this->builder->where('updated_at', '>=', $date);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Auth\LoginRequest;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
@@ -11,10 +12,14 @@ class LoginController extends Controller
|
||||
{
|
||||
$credentials = $request->only('login', 'password');
|
||||
|
||||
if (auth()->attempt($credentials))
|
||||
if (!auth()->attempt($credentials))
|
||||
return response()->json('You cannot sign with those credentials!', 401);
|
||||
|
||||
$token = auth()->user()->makeToken($request->get('remember_me'));
|
||||
$remember = (bool)$request->get('remember_me');
|
||||
$token = auth()->user()->createToken(config('app.name'));
|
||||
|
||||
$token->token->expires_at = $remember ? Carbon::now()->addMonth() : Carbon::now()->addDay();
|
||||
$token->token->save();
|
||||
|
||||
return response()->json([
|
||||
'token_type' => 'Bearer',
|
||||
|
||||
@@ -18,7 +18,7 @@ class RegisterController extends Controller
|
||||
{
|
||||
$role = Role::where('name', $request->get('role'));
|
||||
|
||||
if ($role->isEmpty())
|
||||
if ($role->get()->isEmpty())
|
||||
return response()->json('Role not found', 404);
|
||||
|
||||
$user = User::create(array_merge(
|
||||
|
||||
111
app/Http/Controllers/JournalController.php
Normal file
111
app/Http/Controllers/JournalController.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Filters\JournalFilter;
|
||||
use App\Http\Requests\JournalRequest;
|
||||
use App\Models\Journal;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class JournalController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$journal = (new JournalFilter(Journal::all(), $request))->apply()->values();
|
||||
return response()->json($journal, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
// public function create()
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param JournalRequest $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(JournalRequest $request)
|
||||
{
|
||||
if ($request->has('date'))
|
||||
$date = Carbon::createFromTimestamp($request->get('date')/1000)->floorDays();
|
||||
else
|
||||
$date = Carbon::now()->floorDays();
|
||||
|
||||
|
||||
$exist = Journal::where('updated_at', $date)
|
||||
->where('student_id', $request->get('student_id'))
|
||||
->where('subject_id', $request->get('subject_id'))
|
||||
->get();
|
||||
|
||||
if ($exist->isNotEmpty())
|
||||
return response()->json('Оценка на эту дату уже выставлена', 200);
|
||||
|
||||
$data = array_merge(['updated_at' => $date], $request->all());
|
||||
|
||||
$journal = Journal::create($data);
|
||||
return response()->json(['id' => $journal->id], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $journal
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function show(int $journal)
|
||||
{
|
||||
return response()->json(Journal::find($journal), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Journal $journal
|
||||
* @return Response
|
||||
*/
|
||||
// public function edit(Journal $journal)
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param JournalRequest $request
|
||||
* @param Journal $journal
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(JournalRequest $request, Journal $journal)
|
||||
{
|
||||
$journal->update($request->all());
|
||||
return response()->json(['id' => $journal->id], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Journal $journal
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(Journal $journal)
|
||||
{
|
||||
$journal->delete();
|
||||
return response()->json(null, 200);
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Filters\JournalFilter;
|
||||
use App\Http\Requests\SchoolClassRequest;
|
||||
use App\Models\SchoolClass;
|
||||
use App\Models\Teacher;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -65,11 +67,26 @@ class SchoolClassController extends Controller
|
||||
$students = $class->students;
|
||||
$studentsOnlyFIO = [];
|
||||
foreach ($students as $student) {
|
||||
array_push($studentsOnlyFIO, $student->only('id', 'name', 'surname', 'patronymic'));
|
||||
array_push($studentsOnlyFIO, $student->only('id', 'name', 'surname', 'patronymic'));
|
||||
}
|
||||
return response()->json($studentsOnlyFIO, 200);
|
||||
}
|
||||
|
||||
public function getStudentsJournal(SchoolClass $class, Request $request)
|
||||
{
|
||||
$students = $class->students;
|
||||
$allStudents = [];
|
||||
|
||||
foreach ($students as $student)
|
||||
{
|
||||
$cpys = clone $student;
|
||||
$cpys->scores = (new JournalFilter($student->scores, $request))->apply()->values();
|
||||
$allStudents[] = $cpys;
|
||||
}
|
||||
|
||||
return response()->json($allStudents, 200);
|
||||
}
|
||||
|
||||
//получение всех предметов для класса
|
||||
public function getSubjects(SchoolClass $class)
|
||||
{
|
||||
|
||||
@@ -14,6 +14,8 @@ class LoginRequest extends UserRequest
|
||||
*/
|
||||
public function specific()
|
||||
{
|
||||
return [];
|
||||
return [
|
||||
'remember_me' => 'integer'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
25
app/Http/Requests/JournalRequest.php
Normal file
25
app/Http/Requests/JournalRequest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class JournalRequest extends ApiFormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'student_id' => 'required|integer',
|
||||
'teacher_id' => 'required|integer',
|
||||
'subject_id' => 'required|integer',
|
||||
'score' => 'required|integer',
|
||||
'comment' => 'string',
|
||||
'date' => 'integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ class HeadTeacher extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
];
|
||||
|
||||
|
||||
22
app/Models/Journal.php
Normal file
22
app/Models/Journal.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Filters\QueryFilter;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Journal extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'teacher_id',
|
||||
'student_id',
|
||||
'subject_id',
|
||||
'score',
|
||||
'comment',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -10,7 +10,7 @@ class Parentt extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
];
|
||||
|
||||
|
||||
@@ -25,5 +25,4 @@ class SchoolClass extends Model
|
||||
return $this->belongsToMany(Subject::class, 'academic_plans', 'class_id')
|
||||
->withPivot('hours_per_week', 'hours_per_year');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
@@ -10,14 +11,21 @@ class Student extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
];
|
||||
|
||||
protected $guarded = [
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function schoolClass()
|
||||
{
|
||||
return $this->belongsTo(SchoolClass::class, 'class_id');
|
||||
return $this->belongsTo(SchoolClass::class, 'class_id')->where('');
|
||||
}
|
||||
public function scores()
|
||||
{
|
||||
return $this->hasMany(Journal::class, 'student_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class Teacher extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
];
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
@@ -58,11 +57,11 @@ class User extends Authenticatable
|
||||
return $this->hasOne(HeadTeacher::class);
|
||||
}
|
||||
|
||||
public function makeToken(bool $remember)
|
||||
{
|
||||
$token = $this->createToken(config('app.name'));
|
||||
$token->token->expires_at = $remember ? Carbon::now()->addMonth() : Carbon::now()->addDay();
|
||||
$token->token->save();
|
||||
return $token;
|
||||
}
|
||||
// public function makeToken(bool $remember)
|
||||
// {
|
||||
// $token = $this->createToken(config('app.name'));
|
||||
// $token->token->expires_at = $remember ? Carbon::now()->addMonth() : Carbon::now()->addDay();
|
||||
// $token->token->save();
|
||||
// return $token;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
Passport::routes();
|
||||
// Passport::routes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::prefix('/api')
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"cboden/ratchet": "^0.4.3",
|
||||
"fideloper/proxy": "^4.4",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
|
||||
569
composer.lock
generated
569
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d29a824fe1ba5e1a371425931ce19f0b",
|
||||
"content-hash": "b864dde6a95522044afee456c400fb07",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
@@ -110,6 +110,63 @@
|
||||
],
|
||||
"time": "2020-08-18T23:57:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "cboden/ratchet",
|
||||
"version": "v0.4.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ratchetphp/Ratchet.git",
|
||||
"reference": "466a0ecc83209c75b76645eb823401b5c52e5f21"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ratchetphp/Ratchet/zipball/466a0ecc83209c75b76645eb823401b5c52e5f21",
|
||||
"reference": "466a0ecc83209c75b76645eb823401b5c52e5f21",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/psr7": "^1.0",
|
||||
"php": ">=5.4.2",
|
||||
"ratchet/rfc6455": "^0.3",
|
||||
"react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5",
|
||||
"symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0",
|
||||
"symfony/routing": "^2.6|^3.0|^4.0|^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.8"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Ratchet\\": "src/Ratchet"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Chris Boden",
|
||||
"email": "cboden@gmail.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Matt Bonneau",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "PHP WebSocket library",
|
||||
"homepage": "http://socketo.me",
|
||||
"keywords": [
|
||||
"Ratchet",
|
||||
"WebSockets",
|
||||
"server",
|
||||
"sockets",
|
||||
"websocket"
|
||||
],
|
||||
"time": "2020-07-07T15:50:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "defuse/php-encryption",
|
||||
"version": "v2.2.1",
|
||||
@@ -491,6 +548,49 @@
|
||||
],
|
||||
"time": "2020-11-14T15:56:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "evenement/evenement",
|
||||
"version": "v3.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/igorw/evenement.git",
|
||||
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
|
||||
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Evenement": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Igor Wiedler",
|
||||
"email": "igor@wiedler.ch"
|
||||
}
|
||||
],
|
||||
"description": "Événement is a very simple event dispatching library for PHP",
|
||||
"keywords": [
|
||||
"event-dispatcher",
|
||||
"event-emitter"
|
||||
],
|
||||
"time": "2017-07-23T21:35:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fideloper/proxy",
|
||||
"version": "4.4.1",
|
||||
@@ -2932,6 +3032,473 @@
|
||||
],
|
||||
"time": "2020-08-18T17:17:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ratchet/rfc6455",
|
||||
"version": "v0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ratchetphp/RFC6455.git",
|
||||
"reference": "c8651c7938651c2d55f5d8c2422ac5e57a183341"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/c8651c7938651c2d55f5d8c2422ac5e57a183341",
|
||||
"reference": "c8651c7938651c2d55f5d8c2422ac5e57a183341",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/psr7": "^1.0",
|
||||
"php": ">=5.4.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "5.7.*",
|
||||
"react/socket": "^1.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Ratchet\\RFC6455\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Chris Boden",
|
||||
"email": "cboden@gmail.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Matt Bonneau",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "RFC6455 WebSocket protocol handler",
|
||||
"homepage": "http://socketo.me",
|
||||
"keywords": [
|
||||
"WebSockets",
|
||||
"rfc6455",
|
||||
"websocket"
|
||||
],
|
||||
"time": "2020-05-15T18:31:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/cache",
|
||||
"version": "v1.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/cache.git",
|
||||
"reference": "44a568925556b0bd8cacc7b49fb0f1cf0d706a0c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/cache/zipball/44a568925556b0bd8cacc7b49fb0f1cf0d706a0c",
|
||||
"reference": "44a568925556b0bd8cacc7b49fb0f1cf0d706a0c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"react/promise": "^3.0 || ^2.0 || ^1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\Cache\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christian Lück",
|
||||
"email": "christian@clue.engineering",
|
||||
"homepage": "https://clue.engineering/"
|
||||
},
|
||||
{
|
||||
"name": "Cees-Jan Kiewiet",
|
||||
"email": "reactphp@ceesjankiewiet.nl",
|
||||
"homepage": "https://wyrihaximus.net/"
|
||||
},
|
||||
{
|
||||
"name": "Jan Sorgalla",
|
||||
"email": "jsorgalla@gmail.com",
|
||||
"homepage": "https://sorgalla.com/"
|
||||
},
|
||||
{
|
||||
"name": "Chris Boden",
|
||||
"email": "cboden@gmail.com",
|
||||
"homepage": "https://cboden.dev/"
|
||||
}
|
||||
],
|
||||
"description": "Async, Promise-based cache interface for ReactPHP",
|
||||
"keywords": [
|
||||
"cache",
|
||||
"caching",
|
||||
"promise",
|
||||
"reactphp"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/WyriHaximus",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/clue",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-18T12:12:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/dns",
|
||||
"version": "v1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/dns.git",
|
||||
"reference": "665260757171e2ab17485b44e7ffffa7acb6ca1f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/dns/zipball/665260757171e2ab17485b44e7ffffa7acb6ca1f",
|
||||
"reference": "665260757171e2ab17485b44e7ffffa7acb6ca1f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"react/cache": "^1.0 || ^0.6 || ^0.5",
|
||||
"react/event-loop": "^1.0 || ^0.5",
|
||||
"react/promise": "^3.0 || ^2.7 || ^1.2.1",
|
||||
"react/promise-timer": "^1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"clue/block-react": "^1.2",
|
||||
"phpunit/phpunit": "^9.3 || ^4.8.35"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\Dns\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christian Lück",
|
||||
"email": "christian@clue.engineering",
|
||||
"homepage": "https://clue.engineering/"
|
||||
},
|
||||
{
|
||||
"name": "Cees-Jan Kiewiet",
|
||||
"email": "reactphp@ceesjankiewiet.nl",
|
||||
"homepage": "https://wyrihaximus.net/"
|
||||
},
|
||||
{
|
||||
"name": "Jan Sorgalla",
|
||||
"email": "jsorgalla@gmail.com",
|
||||
"homepage": "https://sorgalla.com/"
|
||||
},
|
||||
{
|
||||
"name": "Chris Boden",
|
||||
"email": "cboden@gmail.com",
|
||||
"homepage": "https://cboden.dev/"
|
||||
}
|
||||
],
|
||||
"description": "Async DNS resolver for ReactPHP",
|
||||
"keywords": [
|
||||
"async",
|
||||
"dns",
|
||||
"dns-resolver",
|
||||
"reactphp"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/WyriHaximus",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/clue",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-18T12:12:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/event-loop",
|
||||
"version": "v1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/event-loop.git",
|
||||
"reference": "6d24de090cd59cfc830263cfba965be77b563c13"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/6d24de090cd59cfc830263cfba965be77b563c13",
|
||||
"reference": "6d24de090cd59cfc830263cfba965be77b563c13",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-event": "~1.0 for ExtEventLoop",
|
||||
"ext-pcntl": "For signal handling support when using the StreamSelectLoop",
|
||||
"ext-uv": "* for ExtUvLoop"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\EventLoop\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.",
|
||||
"keywords": [
|
||||
"asynchronous",
|
||||
"event-loop"
|
||||
],
|
||||
"time": "2020-01-01T18:39:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/promise",
|
||||
"version": "v2.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/promise.git",
|
||||
"reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4",
|
||||
"reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\Promise\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jan Sorgalla",
|
||||
"email": "jsorgalla@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
|
||||
"keywords": [
|
||||
"promise",
|
||||
"promises"
|
||||
],
|
||||
"time": "2020-05-12T15:16:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/promise-timer",
|
||||
"version": "v1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/promise-timer.git",
|
||||
"reference": "daee9baf6ef30c43ea4c86399f828bb5f558f6e6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/promise-timer/zipball/daee9baf6ef30c43ea4c86399f828bb5f558f6e6",
|
||||
"reference": "daee9baf6ef30c43ea4c86399f828bb5f558f6e6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5",
|
||||
"react/promise": "^3.0 || ^2.7.0 || ^1.2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\Promise\\Timer\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christian Lück",
|
||||
"email": "christian@lueck.tv"
|
||||
}
|
||||
],
|
||||
"description": "A trivial implementation of timeouts for Promises, built on top of ReactPHP.",
|
||||
"homepage": "https://github.com/reactphp/promise-timer",
|
||||
"keywords": [
|
||||
"async",
|
||||
"event-loop",
|
||||
"promise",
|
||||
"reactphp",
|
||||
"timeout",
|
||||
"timer"
|
||||
],
|
||||
"time": "2020-07-10T12:18:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/socket",
|
||||
"version": "v1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/socket.git",
|
||||
"reference": "e2b96b23a13ca9b41ab343268dbce3f8ef4d524a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/socket/zipball/e2b96b23a13ca9b41ab343268dbce3f8ef4d524a",
|
||||
"reference": "e2b96b23a13ca9b41ab343268dbce3f8ef4d524a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
|
||||
"php": ">=5.3.0",
|
||||
"react/dns": "^1.1",
|
||||
"react/event-loop": "^1.0 || ^0.5",
|
||||
"react/promise": "^2.6.0 || ^1.2.1",
|
||||
"react/promise-timer": "^1.4.0",
|
||||
"react/stream": "^1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"clue/block-react": "^1.2",
|
||||
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35",
|
||||
"react/promise-stream": "^1.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\Socket\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christian Lück",
|
||||
"email": "christian@clue.engineering",
|
||||
"homepage": "https://clue.engineering/"
|
||||
},
|
||||
{
|
||||
"name": "Cees-Jan Kiewiet",
|
||||
"email": "reactphp@ceesjankiewiet.nl",
|
||||
"homepage": "https://wyrihaximus.net/"
|
||||
},
|
||||
{
|
||||
"name": "Jan Sorgalla",
|
||||
"email": "jsorgalla@gmail.com",
|
||||
"homepage": "https://sorgalla.com/"
|
||||
},
|
||||
{
|
||||
"name": "Chris Boden",
|
||||
"email": "cboden@gmail.com",
|
||||
"homepage": "https://cboden.dev/"
|
||||
}
|
||||
],
|
||||
"description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP",
|
||||
"keywords": [
|
||||
"Connection",
|
||||
"Socket",
|
||||
"async",
|
||||
"reactphp",
|
||||
"stream"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/WyriHaximus",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/clue",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-08-28T12:49:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/stream",
|
||||
"version": "v1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/stream.git",
|
||||
"reference": "7c02b510ee3f582c810aeccd3a197b9c2f52ff1a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/stream/zipball/7c02b510ee3f582c810aeccd3a197b9c2f52ff1a",
|
||||
"reference": "7c02b510ee3f582c810aeccd3a197b9c2f52ff1a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
|
||||
"php": ">=5.3.8",
|
||||
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"clue/stream-filter": "~1.2",
|
||||
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\Stream\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP",
|
||||
"keywords": [
|
||||
"event-driven",
|
||||
"io",
|
||||
"non-blocking",
|
||||
"pipe",
|
||||
"reactphp",
|
||||
"readable",
|
||||
"stream",
|
||||
"writable"
|
||||
],
|
||||
"time": "2020-05-04T10:17:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "swiftmailer/swiftmailer",
|
||||
"version": "v6.2.3",
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJournalsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('journals', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('teacher_id');
|
||||
$table->unsignedBigInteger('student_id');
|
||||
$table->unsignedBigInteger('subject_id');
|
||||
$table->unsignedBigInteger('score');
|
||||
$table->string('comment')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('subject_id')
|
||||
->references('id')->on('subjects');
|
||||
|
||||
$table->foreign('teacher_id')
|
||||
->references('id')->on('teachers')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('student_id')
|
||||
->references('id')->on('students')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('journals');
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,11 @@ Route::apiResource('subjects', 'SubjectController');
|
||||
Route::apiResource('classes', 'SchoolClassController');
|
||||
Route::post('classes/{class}/teacher', 'SchoolClassController@addTeacher');
|
||||
Route::get('classes/{class}/students', 'SchoolClassController@getStudents'); //все ученики класса
|
||||
Route::get('classes/{class}/journal', 'SchoolClassController@getStudentsJournal'); //все ученики класса с оценками
|
||||
Route::get('classes/{class}/subjects', 'SchoolClassController@getSubjects'); //все предметы класса
|
||||
|
||||
Route::apiResource('journal', 'JournalController');
|
||||
|
||||
Route::apiResource('themes', 'ThemeController');
|
||||
|
||||
Route::apiResource('timetables', 'TimetableController');
|
||||
|
||||
@@ -12,3 +12,5 @@
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::view('/', 'auth');
|
||||
|
||||
Reference in New Issue
Block a user