Added Breeze
This commit is contained in:
@@ -14,13 +14,12 @@ class MapController extends Controller
|
||||
|
||||
private array $apiParams;
|
||||
|
||||
|
||||
public function index(int $id)
|
||||
{
|
||||
$this->apiParams = array(
|
||||
$this->apiParams = [
|
||||
"apikey" => $this->yandex_key,
|
||||
"lang" =>"ru_RU",
|
||||
);
|
||||
];
|
||||
|
||||
$apiCall = $this->createApiCall();
|
||||
|
||||
@@ -32,10 +31,13 @@ class MapController extends Controller
|
||||
public function getPlace(int $id)
|
||||
{
|
||||
$place = Place::find($id);
|
||||
[ $x, $y ] = explode("|",$place->Gps);
|
||||
[ $x, $y ] = explode("|", $place->gps);
|
||||
|
||||
return response()->json([
|
||||
'x' => $x, 'y' => $y
|
||||
'x' => $x,
|
||||
'y' => $y,
|
||||
'id' => $id,
|
||||
'name' => $place->Name,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\ORM\Place;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PlacesController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$places = Place::paginate(10);
|
||||
return view('places.index', compact('places'));
|
||||
}
|
||||
|
||||
public function store(Request $request) {
|
||||
$data = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'lat' => 'required|numeric',
|
||||
'lng' => 'required|numeric',
|
||||
]);
|
||||
|
||||
Place::create($data);
|
||||
|
||||
return redirect()
|
||||
->route('places.index')
|
||||
->with('status', 'Локация создана!');
|
||||
}
|
||||
|
||||
public function edit(Place $place) {
|
||||
return view('places.edit', compact('place'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Place $place) {
|
||||
$data = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'lat' => 'required|numeric',
|
||||
'lng' => 'required|numeric',
|
||||
]);
|
||||
$place->update($data);
|
||||
return redirect()
|
||||
->route('places.index')
|
||||
->with('status', 'Обновлено!');
|
||||
}
|
||||
|
||||
public function destroy(Place $place) {
|
||||
$place->delete();
|
||||
return redirect()
|
||||
->route('places.index')
|
||||
->with('status', 'Удалено!');
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
@@ -19,6 +20,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
Paginator::useTailwind();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user