init commit

This commit is contained in:
amikhaylov
2026-04-28 22:22:46 +03:00
parent 3788458f01
commit af933e8397
130 changed files with 4072 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Models\Loaders;
use Illuminate\Support\Facades\DB;
use App\Models\ORM\Event;
class GigsLoader
{
public function getEvents(): array
{
$data = Event::select(
"Event.Name as event",
"Event.PlaceId as place_id",
"Place.Name as place",
"Place.Address as address",
"Place.Phone as phone",
"Place.Url as url",
DB::Raw("DAY(Event.Date) as mday"),
DB::Raw("MONTH(Event.Date) as month"),
DB::Raw("DATE_FORMAT(Event.Time, '%H:%s') as time"),
DB::Raw("CONCAT(DATE_FORMAT(Event.Date,'%Y-%m-%d'),
'T',DATE_FORMAT(Event.Time, '%H:%i:%s')) as fulldate")
)->join("Place", function ($join){
$join->on("Place.Id", "=", "Event.PlaceId")
->where("Place.DeleteDate", NULL);
});
$data = $data->get();
return $data ? $data->toArray() : [];
}
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Models\Loaders;
use App\Models\ORM\Track;
class PlaylistLoader
{
public function getPlaylist(): array
{
$data = Track::select(
"Track.Name as Track",
"Performer.Name as Performer"
)->join('Performer', function ($join) {
$join->on('Performer.Id', "=", "Track.Performer")
->where('Performer.DeleteDate', NULL);
})->orderBy('Performer')->get();
return $data ? $data->toArray() : [];
}
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Models\ORM;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Event extends Model
{
use SoftDeletes;
const DELETED_AT = 'DeleteDate';
const UPDATED_AT = 'UpdatedDate';
const CREATED_AT = 'DateOfCreation';
protected $primaryKey = 'Id';
protected $table = 'Event';
protected $fillable = ['Name', 'Date', 'Time', 'Archived'];
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Models\ORM;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Track extends Model
{
use SoftDeletes;
const DELETED_AT = 'DeleteDate';
const UPDATED_AT = 'UpdatedDate';
const CREATED_AT = 'DateOfCreation';
protected $primaryKey = 'Id';
protected $table = 'Track';
protected $fillable = ['Name', 'Length'];
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}