Added Breeze
This commit is contained in:
@@ -12,18 +12,18 @@ class GigsLoader
|
||||
$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",
|
||||
"places.name as place",
|
||||
"places.address as address",
|
||||
"places.phone as phone",
|
||||
"places.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);
|
||||
)->join("places", function ($join){
|
||||
$join->on("places.id", "=", "Event.PlaceId")
|
||||
->where("places.deleted_at", NULL);
|
||||
});
|
||||
$data = $data->get();
|
||||
|
||||
|
||||
@@ -2,18 +2,24 @@
|
||||
|
||||
namespace App\Models\Loaders;
|
||||
|
||||
use App\Models\ORM\User;
|
||||
use App\Models\ORM\User as Contact;
|
||||
|
||||
class UsersLoader
|
||||
{
|
||||
public function getContacts(): array
|
||||
{
|
||||
$data = User::select(
|
||||
"users.id","users.login","users.firstName","users.lastName",
|
||||
"users.phone", "users.email", "users.vkcom as webPage",
|
||||
"users.img_large","users.img_small","contactRoles.name as role"
|
||||
)->join("contactRoles", "users.contactRole", "=", "contactRoles.id")
|
||||
->where("users.useAsContact", 1)
|
||||
$data = Contact::select(
|
||||
"users.id",
|
||||
"users.name as first_name",
|
||||
"users.last_name",
|
||||
"users.phone",
|
||||
"users.email",
|
||||
"users.vk_id as web_page",
|
||||
"users.img_large",
|
||||
"users.img_small",
|
||||
"contact_roles.description as role"
|
||||
)->join("contact_roles", "users.contact_role", "=", "contact_roles.id")
|
||||
->where("users.use_as_contact", 1)
|
||||
->get();
|
||||
|
||||
return $data ? $data->toArray() : [];
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ORM;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContactRole extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'contact_roles';
|
||||
}
|
||||
@@ -9,10 +9,10 @@ class Place extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
const CREATED_AT = 'DateOfCreation';
|
||||
const UPDATED_AT = 'UpdateDate';
|
||||
const DELETED_AT = 'DeleteDate';
|
||||
const CREATED_AT = 'created_at';
|
||||
const UPDATED_AT = 'updated_at';
|
||||
const DELETED_AT = 'deleted_at';
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'Place';
|
||||
protected $table = 'places';
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace App\Models\Objects;
|
||||
class Contact
|
||||
{
|
||||
private ?int $id;
|
||||
private string $login;
|
||||
private string $firstName;
|
||||
private string $lastName;
|
||||
private string $phone;
|
||||
@@ -51,12 +50,11 @@ class Contact
|
||||
public function setAttributes(array $attributes = []):void
|
||||
{
|
||||
$this->id = $attributes['id'] ?? null;
|
||||
$this->login = $attributes['login'];
|
||||
$this->firstName = $attributes['firstName'];
|
||||
$this->lastName = $attributes['lastName'];
|
||||
$this->firstName = $attributes['first_name'];
|
||||
$this->lastName = $attributes['last_name'];
|
||||
$this->phone = $attributes['phone'];
|
||||
$this->email = $attributes['email'];
|
||||
$this->webPage = $attributes['webPage'] ?? null;
|
||||
$this->webPage = $attributes['web_page'] ?? null;
|
||||
$this->role = $attributes['role'] ?? null;
|
||||
$this->imgSmall = $this->setImagePath($attributes['img_small']) ?? null;
|
||||
$this->imgLarge = $this->setImagePath($attributes['img_large']) ?? null;
|
||||
@@ -88,11 +86,6 @@ class Contact
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getLogin(): string
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
public function getFirstName(): string
|
||||
{
|
||||
return $this->firstName;
|
||||
|
||||
Reference in New Issue
Block a user