Compare commits
8 Commits
66cddf3fb2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a448fce756 | |||
| 18aad4749f | |||
| ea511a00e6 | |||
| ff904abf49 | |||
| 2a83373b28 | |||
| e400b203b8 | |||
| 82f1f37af6 | |||
| 62100c42b0 |
8
RoomType::create([
Normal file
8
RoomType::create([
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[90m= [39m[34;4mApp\Models\Hotel[39;24m {#5905
|
||||||
|
[34mname[39m: "[32mMountain Lodge[39m",
|
||||||
|
[34maddress[39m: "[32mAlpine Valley, Switzerland[39m",
|
||||||
|
[34mupdated_at[39m: "[32m2026-01-23 22:51:26[39m",
|
||||||
|
[34mcreated_at[39m: "[32m2026-01-23 22:51:26[39m",
|
||||||
|
[34mid[39m: [35m30[39m,
|
||||||
|
}
|
||||||
|
|
||||||
38
app/Http/Controllers/Admin/AuthController.php
Normal file
38
app/Http/Controllers/Admin/AuthController.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class AuthController extends Controller
|
||||||
|
{
|
||||||
|
public function showLoginForm()
|
||||||
|
{
|
||||||
|
return view('admin.login');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function login(Request $request)
|
||||||
|
{
|
||||||
|
$credentials = $request->validate([
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (Auth::attempt($credentials)) {
|
||||||
|
$request->session()->regenerate();
|
||||||
|
return redirect()->route('admin.hotels.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->withErrors(['email' => 'Неверные данные.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout(Request $request)
|
||||||
|
{
|
||||||
|
Auth::logout();
|
||||||
|
$request->session()->invalidate();
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
return redirect()->route('admin.login.form')->with('success', 'Вы успешно вышли из системы.');
|
||||||
|
}
|
||||||
|
}
|
||||||
55
app/Http/Controllers/Admin/AvailabilityController.php
Normal file
55
app/Http/Controllers/Admin/AvailabilityController.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\RoomType;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class AvailabilityController extends Controller
|
||||||
|
{
|
||||||
|
public function calendar(RoomType $roomType)
|
||||||
|
{
|
||||||
|
$roomType->load('availabilities');
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
return view('admin.availability._calendar', compact('roomType'))->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('admin.availability.calendar', compact('roomType'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request, RoomType $roomType)
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'is_available' => 'required|boolean',
|
||||||
|
'price' => 'nullable|numeric|min=0',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$roomType->availabilities()
|
||||||
|
->where('start_date', '<=', $validated['end_date'])
|
||||||
|
->where('end_date', '>=', $validated['start_date'])
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
$roomType->availabilities()->create($validated);
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['success' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Период сохранён.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(\App\Models\Availability $availability)
|
||||||
|
{
|
||||||
|
$availability->delete();
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
return response()->json(['success' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Период удалён.');
|
||||||
|
}
|
||||||
|
}
|
||||||
71
app/Http/Controllers/Admin/HotelController.php
Normal file
71
app/Http/Controllers/Admin/HotelController.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Hotel;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\RoomType;
|
||||||
|
|
||||||
|
class HotelController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$hotels = Hotel::all();
|
||||||
|
return view('admin.hotels.index', compact('hotels'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.hotels.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function calendar(Request $request, $hotelId)
|
||||||
|
{
|
||||||
|
$hotel = \App\Models\Hotel::findOrFail($hotelId);
|
||||||
|
$roomTypes = RoomType::where('hotel_id', $hotelId)->with('availabilities')->get();
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return view('admin.hotels._calendar', compact('hotel', 'roomTypes'))->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('admin.hotels.calendar', compact('hotel', 'roomTypes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'address' => 'nullable|string',
|
||||||
|
'phone' => 'nullable|string|max:20',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Hotel::create($validated);
|
||||||
|
|
||||||
|
return redirect()->route('admin.hotels.index')->with('success', 'Отель успешно добавлен!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(Hotel $hotel)
|
||||||
|
{
|
||||||
|
return view('admin.hotels.edit', compact('hotel'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, Hotel $hotel)
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'address' => 'nullable|string',
|
||||||
|
'phone' => 'nullable|string|max:20',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$hotel->update($validated);
|
||||||
|
|
||||||
|
return redirect()->route('admin.hotels.index')->with('success', 'Отель успешно обновлён!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Hotel $hotel)
|
||||||
|
{
|
||||||
|
$hotel->delete();
|
||||||
|
return redirect()->route('admin.hotels.index')->with('success', 'Отель удалён.');
|
||||||
|
}
|
||||||
|
}
|
||||||
81
app/Http/Controllers/InvoiceController.php
Normal file
81
app/Http/Controllers/InvoiceController.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Booking;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Models\RoomAvailability;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class InvoiceController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function generate(Request $request, $bookingId)
|
||||||
|
{
|
||||||
|
$booking = Booking::findOrFail($bookingId);
|
||||||
|
|
||||||
|
if ($booking->status === 'cancelled') {
|
||||||
|
return response()->json(['error' => 'Cannot generate invoice for cancelled booking'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalAmount = 0;
|
||||||
|
$currentDate = new \DateTime($booking->check_in);
|
||||||
|
$endDate = new \DateTime($booking->check_out);
|
||||||
|
|
||||||
|
while ($currentDate < $endDate) {
|
||||||
|
$date = $currentDate->format('Y-m-d');
|
||||||
|
|
||||||
|
$availability = RoomAvailability::where('room_type_id', $booking->room_type_id)
|
||||||
|
->where('date', $date)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$price = $availability && $availability->price_override !== null
|
||||||
|
? $availability->price_override
|
||||||
|
: $booking->roomType->base_price;
|
||||||
|
|
||||||
|
$totalAmount += $price;
|
||||||
|
|
||||||
|
$currentDate->modify('+1 day');
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$invoice = Invoice::create([
|
||||||
|
'booking_id' => $booking->id,
|
||||||
|
'total_amount' => $totalAmount,
|
||||||
|
'status' => 'pending',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$pdfPath = $this->generatePdf($invoice);
|
||||||
|
|
||||||
|
if ($pdfPath) {
|
||||||
|
$invoice->update(['pdf_path' => $pdfPath]);
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json($invoice, 201);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollback();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function generatePdf($invoice)
|
||||||
|
{
|
||||||
|
|
||||||
|
$pdf = \PDF::loadView('invoices.show', compact('invoice'));
|
||||||
|
|
||||||
|
$fileName = "invoice_{$invoice->id}.pdf";
|
||||||
|
$path = "invoices/{$fileName}";
|
||||||
|
|
||||||
|
Storage::put($path, $pdf->output());
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class Orders extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
use Hamcrest\Number\OrderingComparison;
|
|
||||||
use Illuminate\Container\Attributes\Auth;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\Orders;
|
|
||||||
|
|
||||||
class OrdersController extends Controller
|
|
||||||
{
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return response()->json(Orders::all()->toJson);
|
|
||||||
}
|
|
||||||
public function create(Request $request)
|
|
||||||
{
|
|
||||||
$status = $request->get(key: 'status');
|
|
||||||
$description = $request->get(key: 'description');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$order = new Order();
|
|
||||||
$order ->status = $status;
|
|
||||||
$order ->description = $description;
|
|
||||||
|
|
||||||
$order ->total = $request->get('total',0);
|
|
||||||
$order ->save();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return response()->json($order->toJson());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
24
app/Models/Admin.php
Normal file
24
app/Models/Admin.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
|
||||||
|
class Admin extends Authenticatable
|
||||||
|
{
|
||||||
|
use HasApiTokens;
|
||||||
|
|
||||||
|
protected $guard = 'admin'; // Указываем guard для админов
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'password',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
'password',
|
||||||
|
'remember_token',
|
||||||
|
];
|
||||||
|
}
|
||||||
31
app/Models/Availability.php
Normal file
31
app/Models/Availability.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Availability extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'room_type_id',
|
||||||
|
'start_date',
|
||||||
|
'end_date',
|
||||||
|
'is_available',
|
||||||
|
'price',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'is_available' => 'boolean',
|
||||||
|
'start_date' => 'date',
|
||||||
|
'end_date' => 'date',
|
||||||
|
'price' => 'decimal:2',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function roomType()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RoomType::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
34
app/Models/Booking.php
Normal file
34
app/Models/Booking.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Booking extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'room_type_id',
|
||||||
|
'check_in',
|
||||||
|
'check_out',
|
||||||
|
'guest_name',
|
||||||
|
'guest_email',
|
||||||
|
'guest_phone',
|
||||||
|
'is_confirmed',
|
||||||
|
'total_price',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'check_in' => 'date',
|
||||||
|
'check_out' => 'date',
|
||||||
|
'is_confirmed' => 'boolean',
|
||||||
|
'total_price' => 'decimal:2',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function roomType()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RoomType::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/Models/Hotel.php
Normal file
26
app/Models/Hotel.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Hotel extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'address',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function roomTypes()
|
||||||
|
{
|
||||||
|
return $this->hasMany(\App\Models\RoomType::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
//public function bookings()
|
||||||
|
//{
|
||||||
|
// return $this->hasMany(Booking::class);
|
||||||
|
//}
|
||||||
|
}
|
||||||
25
app/Models/Invoice.php
Normal file
25
app/Models/Invoice.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Invoice extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'booking_id',
|
||||||
|
'total_amount',
|
||||||
|
'status',
|
||||||
|
'issued_at',
|
||||||
|
'due_date',
|
||||||
|
'pdf_path',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function booking()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(\App\Models\Booking::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
app/Models/RoomAvailability.php
Normal file
29
app/Models/RoomAvailability.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RoomAvailability extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'room_type_id',
|
||||||
|
'date',
|
||||||
|
'is_available',
|
||||||
|
'price_override',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'date' => 'date',
|
||||||
|
'is_available' => 'boolean',
|
||||||
|
'price_override' => 'decimal:2',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function roomType()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RoomType::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
33
app/Models/RoomType.php
Normal file
33
app/Models/RoomType.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RoomType extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'hotel_id',
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
'max_guests',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function hotel()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Hotel::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function availabilities()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Availability::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bookings()
|
||||||
|
{
|
||||||
|
return $this->hasMany(\App\Models\Booking::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
@@ -10,13 +10,12 @@ use Laravel\Sanctum\HasApiTokens;
|
|||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
|
||||||
use HasApiTokens, HasFactory, Notifiable;
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*
|
*
|
||||||
* @var list<string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
@@ -27,7 +26,7 @@ class User extends Authenticatable
|
|||||||
/**
|
/**
|
||||||
* The attributes that should be hidden for serialization.
|
* The attributes that should be hidden for serialization.
|
||||||
*
|
*
|
||||||
* @var list<string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'password',
|
'password',
|
||||||
@@ -35,15 +34,19 @@ class User extends Authenticatable
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the attributes that should be cast.
|
* The attributes that should be cast.
|
||||||
*
|
*
|
||||||
* @return array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
protected function casts(): array
|
protected $casts = [
|
||||||
{
|
|
||||||
return [
|
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
'password' => 'hashed',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Проверяет, является ли пользователь админом.
|
||||||
|
*/
|
||||||
|
public function isAdmin(): bool
|
||||||
|
{
|
||||||
|
return $this->is_admin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
app/Providers/AuthServiceProvider.php
Normal file
30
app/Providers/AuthServiceProvider.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
|
class AuthServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The policy mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $policies = [
|
||||||
|
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any authentication / authorization services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->registerPolicies();
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
42
app/Providers/EventServiceProvider.php
Normal file
42
app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event to listener mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, array<int, class-string>>
|
||||||
|
*/
|
||||||
|
protected $listen = [
|
||||||
|
Registered::class => [
|
||||||
|
SendEmailVerificationNotification::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any events for your application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if events and listeners should be automatically discovered.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function shouldDiscoverEvents()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
32
app/Providers/ResponseMacroServiceProvider.php
Normal file
32
app/Providers/ResponseMacroServiceProvider.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Response;
|
||||||
|
|
||||||
|
class ResponseMacroServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
Response::macro('success', function ($data = null, $message = 'Success') {
|
||||||
|
return Response::json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => $message,
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
Response::macro('error', function ($message = 'Error', $code = 400) {
|
||||||
|
return Response::json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $message,
|
||||||
|
], $code);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
49
app/Providers/RouteServiceProvider.php
Normal file
49
app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The path to your application's route files.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $routesPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define your route model bindings, pattern filters, and other route configuration.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->configureRateLimiting();
|
||||||
|
|
||||||
|
$this->routes(function () {
|
||||||
|
Route::middleware('web')
|
||||||
|
->group(base_path('routes/web.php'));
|
||||||
|
|
||||||
|
// Route::middleware(['web', 'auth'])
|
||||||
|
// ->prefix('admin')
|
||||||
|
// ->group(base_path('routes/admin.php'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Configure the rate limiters for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function configureRateLimiting()
|
||||||
|
{
|
||||||
|
RateLimiter::for('api', function (Request $request) {
|
||||||
|
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,9 +11,16 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||||||
commands: __DIR__.'/../routes/console.php',
|
commands: __DIR__.'/../routes/console.php',
|
||||||
health: '/up',
|
health: '/up',
|
||||||
)
|
)
|
||||||
->withMiddleware(function (Middleware $middleware): void {
|
->withMiddleware(function (Middleware $middleware) {
|
||||||
//
|
// Middleware
|
||||||
})
|
})
|
||||||
->withExceptions(function (Exceptions $exceptions): void {
|
->withExceptions(function (Exceptions $exceptions) {
|
||||||
//
|
$exceptions->render(function (Throwable $e, Request $request) {
|
||||||
})->create();
|
if ($request->expectsJson()) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->create();
|
||||||
@@ -2,4 +2,6 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
App\Providers\AppServiceProvider::class,
|
App\Providers\AppServiceProvider::class,
|
||||||
|
App\Providers\AuthServiceProvider::class,
|
||||||
|
App\Providers\ResponseMacroServiceProvider::class,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -7,12 +7,15 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2",
|
"php": "^8.2",
|
||||||
|
"barryvdh/laravel-dompdf": "^3.1",
|
||||||
"laravel/framework": "^12.0",
|
"laravel/framework": "^12.0",
|
||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.2",
|
||||||
"laravel/tinker": "^2.10.1"
|
"laravel/tinker": "^2.10.1",
|
||||||
|
"laravel/ui": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.23",
|
"fakerphp/faker": "^1.23",
|
||||||
|
"laravel/breeze": "*",
|
||||||
"laravel/pail": "^1.2.2",
|
"laravel/pail": "^1.2.2",
|
||||||
"laravel/pint": "^1.24",
|
"laravel/pint": "^1.24",
|
||||||
"laravel/sail": "^1.41",
|
"laravel/sail": "^1.41",
|
||||||
|
|||||||
1693
composer.lock
generated
1693
composer.lock
generated
File diff suppressed because it is too large
Load Diff
124
config/app.php
124
config/app.php
@@ -1,15 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
|
return [
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Name
|
| Application Name
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This value is the name of your application, which will be used when the
|
| This value is the name of your application. This value is used when the
|
||||||
| framework needs to place the application's name in a notification or
|
| framework needs to place the application's name in a notification or
|
||||||
| other UI elements where an application name needs to be displayed.
|
| any other location as required by the application or its packages.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -48,20 +49,22 @@ return [
|
|||||||
|
|
|
|
||||||
| This URL is used by the console to properly generate URLs when using
|
| This URL is used by the console to properly generate URLs when using
|
||||||
| the Artisan command line tool. You should set this to the root of
|
| the Artisan command line tool. You should set this to the root of
|
||||||
| the application so that it's available within Artisan commands.
|
| your application so that it is used when running Artisan tasks.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'url' => env('APP_URL', 'http://localhost'),
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
|
'asset_url' => env('ASSET_URL'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Timezone
|
| Application Timezone
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may specify the default timezone for your application, which
|
| Here you may specify the default timezone for your application, which
|
||||||
| will be used by the PHP date and date-time functions. The timezone
|
| will be used by the PHP date and date-time functions. We have gone
|
||||||
| is set to "UTC" by default as it is suitable for most use cases.
|
| ahead and set this to a sensible default for you out of the box.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -73,37 +76,53 @@ return [
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| The application locale determines the default locale that will be used
|
| The application locale determines the default locale that will be used
|
||||||
| by Laravel's translation / localization methods. This option can be
|
| by the translation service provider. You are free to set this value
|
||||||
| set to any locale for which you plan to have translation strings.
|
| to any of the locales which will be supported by the application.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'locale' => env('APP_LOCALE', 'en'),
|
'locale' => 'en',
|
||||||
|
|
||||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Fallback Locale
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The fallback locale determines the locale to use when the current one
|
||||||
|
| is not available. You may change the value to correspond to any of
|
||||||
|
| the language folders that are provided through your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
'fallback_locale' => 'en',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Faker Locale
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This locale will be used by the Faker PHP library when generating fake
|
||||||
|
| data for your database seeds. For example, this will be used to get
|
||||||
|
| localized telephone numbers, street address information and more.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'faker_locale' => 'en_US',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Encryption Key
|
| Encryption Key
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This key is utilized by Laravel's encryption services and should be set
|
| This key is used by the Illuminate encrypter service and should be set
|
||||||
| to a random, 32 character string to ensure that all encrypted values
|
| to a random, 32 character string, otherwise these encrypted strings
|
||||||
| are secure. You should do this prior to deploying the application.
|
| will not be safe. Please do this before deploying an application!
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'cipher' => 'AES-256-CBC',
|
|
||||||
|
|
||||||
'key' => env('APP_KEY'),
|
'key' => env('APP_KEY'),
|
||||||
|
|
||||||
'previous_keys' => [
|
'cipher' => 'AES-256-CBC',
|
||||||
...array_filter(
|
|
||||||
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
|
|
||||||
),
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -119,8 +138,67 @@ return [
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
'maintenance' => [
|
'maintenance' => [
|
||||||
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
'driver' => 'file',
|
||||||
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Autoloaded Service Providers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The service providers listed here will be automatically loaded on the
|
||||||
|
| request to your application. Feel free to add your own services to
|
||||||
|
| this array to grant expanded functionality to your applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'providers' => [
|
||||||
|
// Laravel Framework Service Providers...
|
||||||
|
Illuminate\Auth\AuthServiceProvider::class,
|
||||||
|
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||||
|
Illuminate\Bus\BusServiceProvider::class,
|
||||||
|
Illuminate\Cache\CacheServiceProvider::class,
|
||||||
|
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||||
|
Illuminate\Cookie\CookieServiceProvider::class,
|
||||||
|
Illuminate\Database\DatabaseServiceProvider::class,
|
||||||
|
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||||
|
Illuminate\Filesystem\FilesystemServiceProvider::class, // ← ОБЯЗАТЕЛЬНО!
|
||||||
|
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||||
|
Illuminate\Hashing\HashServiceProvider::class,
|
||||||
|
Illuminate\Mail\MailServiceProvider::class,
|
||||||
|
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||||
|
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||||
|
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||||
|
Illuminate\Queue\QueueServiceProvider::class,
|
||||||
|
Illuminate\Redis\RedisServiceProvider::class,
|
||||||
|
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||||
|
Illuminate\Session\SessionServiceProvider::class,
|
||||||
|
Illuminate\Translation\TranslationServiceProvider::class,
|
||||||
|
Illuminate\Validation\ValidationServiceProvider::class,
|
||||||
|
Illuminate\View\ViewServiceProvider::class,
|
||||||
|
|
||||||
|
// Package Service Providers...
|
||||||
|
|
||||||
|
// Application Service Providers...
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
App\Providers\AuthServiceProvider::class,
|
||||||
|
App\Providers\EventServiceProvider::class,
|
||||||
|
App\Providers\RouteServiceProvider::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Class Aliases
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This array of class aliases will be registered when this application
|
||||||
|
| is started. However, feel free to register as many as you wish as
|
||||||
|
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'aliases' => Facade::defaultAliases()->merge([
|
||||||
|
// 'Example' => App\Facades\Example::class,
|
||||||
|
])->toArray(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ return [
|
|||||||
| Authentication Defaults
|
| Authentication Defaults
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This option defines the default authentication "guard" and password
|
| This option controls the default authentication "guard" and password
|
||||||
| reset "broker" for your application. You may change these values
|
| reset options for your application. You may change these defaults
|
||||||
| as required, but they're a perfect start for most applications.
|
| as required, but they're a perfect start for most applications.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'defaults' => [
|
'defaults' => [
|
||||||
'guard' => env('AUTH_GUARD', 'web'),
|
'guard' => 'web',
|
||||||
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
'passwords' => 'users',
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -25,13 +25,13 @@ return [
|
|||||||
|
|
|
|
||||||
| Next, you may define every authentication guard for your application.
|
| Next, you may define every authentication guard for your application.
|
||||||
| Of course, a great default configuration has been defined for you
|
| Of course, a great default configuration has been defined for you
|
||||||
| which utilizes session storage plus the Eloquent user provider.
|
| here which uses session storage and the Eloquent user provider.
|
||||||
|
|
|
|
||||||
| All authentication guards have a user provider, which defines how the
|
| All authentication drivers have a user provider. This defines how the
|
||||||
| users are actually retrieved out of your database or other storage
|
| users are actually retrieved out of your database or other storage
|
||||||
| system used by the application. Typically, Eloquent is utilized.
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
|
||||||
| Supported: "session"
|
| Supported: "session", "token"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -40,6 +40,17 @@ return [
|
|||||||
'driver' => 'session',
|
'driver' => 'session',
|
||||||
'provider' => 'users',
|
'provider' => 'users',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
'driver' => 'sanctum',
|
||||||
|
'provider' => 'users',
|
||||||
|
'hash' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'admin' => [ // ← Этот guard нужен для админов
|
||||||
|
'driver' => 'sanctum',
|
||||||
|
'provider' => 'admins',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -47,12 +58,12 @@ return [
|
|||||||
| User Providers
|
| User Providers
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| All authentication guards have a user provider, which defines how the
|
| All authentication drivers have a user provider. This defines how the
|
||||||
| users are actually retrieved out of your database or other storage
|
| users are actually retrieved out of your database or other storage
|
||||||
| system used by the application. Typically, Eloquent is utilized.
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
|
||||||
| If you have multiple user tables or models you may configure multiple
|
| If you have multiple user tables or models you may configure multiple
|
||||||
| providers to represent the model / table. These providers may then
|
| sources which represent each model / table. These sources may then
|
||||||
| be assigned to any extra authentication guards you have defined.
|
| be assigned to any extra authentication guards you have defined.
|
||||||
|
|
|
|
||||||
| Supported: "database", "eloquent"
|
| Supported: "database", "eloquent"
|
||||||
@@ -62,13 +73,13 @@ return [
|
|||||||
'providers' => [
|
'providers' => [
|
||||||
'users' => [
|
'users' => [
|
||||||
'driver' => 'eloquent',
|
'driver' => 'eloquent',
|
||||||
'model' => env('AUTH_MODEL', App\Models\User::class),
|
'model' => App\Models\User::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
// 'users' => [
|
'admins' => [
|
||||||
// 'driver' => 'database',
|
'driver' => 'eloquent',
|
||||||
// 'table' => 'users',
|
'model' => App\Models\Admin::class,
|
||||||
// ],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -76,18 +87,14 @@ return [
|
|||||||
| Resetting Passwords
|
| Resetting Passwords
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| These configuration options specify the behavior of Laravel's password
|
| You may specify multiple password reset configurations if you have more
|
||||||
| reset functionality, including the table utilized for token storage
|
| than one user table or model in the application and you want to have
|
||||||
| and the user provider that is invoked to actually retrieve users.
|
| separate password reset settings based on the specific user types.
|
||||||
|
|
|
|
||||||
| The expiry time is the number of minutes that each reset token will be
|
| The expire time is the number of minutes that each reset token will be
|
||||||
| considered valid. This security feature keeps tokens short-lived so
|
| considered valid. This security feature keeps tokens short-lived so
|
||||||
| they have less time to be guessed. You may change this as needed.
|
| they have less time to be guessed. You may change this as needed.
|
||||||
|
|
|
|
||||||
| The throttle setting is the number of seconds a user must wait before
|
|
||||||
| generating more password reset tokens. This prevents the user from
|
|
||||||
| quickly generating a very large amount of password reset tokens.
|
|
||||||
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'passwords' => [
|
'passwords' => [
|
||||||
|
|||||||
19
config/cors.php
Normal file
19
config/cors.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||||
|
|
||||||
|
'allowed_methods' => ['*'],
|
||||||
|
|
||||||
|
'allowed_origins' => ['*'],
|
||||||
|
|
||||||
|
'allowed_origins_patterns' => [],
|
||||||
|
|
||||||
|
'allowed_headers' => ['*'],
|
||||||
|
|
||||||
|
'exposed_headers' => [],
|
||||||
|
|
||||||
|
'max_age' => 0,
|
||||||
|
|
||||||
|
'supports_credentials' => false,
|
||||||
|
];
|
||||||
301
config/dompdf.php
Normal file
301
config/dompdf.php
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Set some default values. It is possible to add all defines that can be set
|
||||||
|
| in dompdf_config.inc.php. You can also override the entire config file.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'show_warnings' => false, // Throw an Exception on warnings from dompdf
|
||||||
|
|
||||||
|
'public_path' => null, // Override the public path if needed
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show € and £.
|
||||||
|
*/
|
||||||
|
'convert_entities' => true,
|
||||||
|
|
||||||
|
'options' => [
|
||||||
|
/**
|
||||||
|
* The location of the DOMPDF font directory
|
||||||
|
*
|
||||||
|
* The location of the directory where DOMPDF will store fonts and font metrics
|
||||||
|
* Note: This directory must exist and be writable by the webserver process.
|
||||||
|
* *Please note the trailing slash.*
|
||||||
|
*
|
||||||
|
* Notes regarding fonts:
|
||||||
|
* Additional .afm font metrics can be added by executing load_font.php from command line.
|
||||||
|
*
|
||||||
|
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
|
||||||
|
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
|
||||||
|
* increase file size unless font subsetting is enabled. Before embedding a font please
|
||||||
|
* review your rights under the font license.
|
||||||
|
*
|
||||||
|
* Any font specification in the source HTML is translated to the closest font available
|
||||||
|
* in the font directory.
|
||||||
|
*
|
||||||
|
* The pdf standard "Base 14 fonts" are:
|
||||||
|
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
|
||||||
|
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
|
||||||
|
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
|
||||||
|
* Symbol, ZapfDingbats.
|
||||||
|
*/
|
||||||
|
'font_dir' => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The location of the DOMPDF font cache directory
|
||||||
|
*
|
||||||
|
* This directory contains the cached font metrics for the fonts used by DOMPDF.
|
||||||
|
* This directory can be the same as DOMPDF_FONT_DIR
|
||||||
|
*
|
||||||
|
* Note: This directory must exist and be writable by the webserver process.
|
||||||
|
*/
|
||||||
|
'font_cache' => storage_path('fonts'),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The location of a temporary directory.
|
||||||
|
*
|
||||||
|
* The directory specified must be writeable by the webserver process.
|
||||||
|
* The temporary directory is required to download remote images and when
|
||||||
|
* using the PDFLib back end.
|
||||||
|
*/
|
||||||
|
'temp_dir' => sys_get_temp_dir(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ==== IMPORTANT ====
|
||||||
|
*
|
||||||
|
* dompdf's "chroot": Prevents dompdf from accessing system files or other
|
||||||
|
* files on the webserver. All local files opened by dompdf must be in a
|
||||||
|
* subdirectory of this directory. DO NOT set it to '/' since this could
|
||||||
|
* allow an attacker to use dompdf to read any files on the server. This
|
||||||
|
* should be an absolute path.
|
||||||
|
* This is only checked on command line call by dompdf.php, but not by
|
||||||
|
* direct class use like:
|
||||||
|
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
|
||||||
|
*/
|
||||||
|
'chroot' => realpath(base_path()),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protocol whitelist
|
||||||
|
*
|
||||||
|
* Protocols and PHP wrappers allowed in URIs, and the validation rules
|
||||||
|
* that determine if a resouce may be loaded. Full support is not guaranteed
|
||||||
|
* for the protocols/wrappers specified
|
||||||
|
* by this array.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
'allowed_protocols' => [
|
||||||
|
'data://' => ['rules' => []],
|
||||||
|
'file://' => ['rules' => []],
|
||||||
|
'http://' => ['rules' => []],
|
||||||
|
'https://' => ['rules' => []],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operational artifact (log files, temporary files) path validation
|
||||||
|
*/
|
||||||
|
'artifactPathValidation' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
'log_output_file' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to enable font subsetting or not.
|
||||||
|
*/
|
||||||
|
'enable_font_subsetting' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The PDF rendering backend to use
|
||||||
|
*
|
||||||
|
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
|
||||||
|
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
|
||||||
|
* fall back on CPDF. 'GD' renders PDFs to graphic files.
|
||||||
|
* {@link * Canvas_Factory} ultimately determines which rendering class to
|
||||||
|
* instantiate based on this setting.
|
||||||
|
*
|
||||||
|
* Both PDFLib & CPDF rendering backends provide sufficient rendering
|
||||||
|
* capabilities for dompdf, however additional features (e.g. object,
|
||||||
|
* image and font support, etc.) differ between backends. Please see
|
||||||
|
* {@link PDFLib_Adapter} for more information on the PDFLib backend
|
||||||
|
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
|
||||||
|
* on CPDF. Also see the documentation for each backend at the links
|
||||||
|
* below.
|
||||||
|
*
|
||||||
|
* The GD rendering backend is a little different than PDFLib and
|
||||||
|
* CPDF. Several features of CPDF and PDFLib are not supported or do
|
||||||
|
* not make any sense when creating image files. For example,
|
||||||
|
* multiple pages are not supported, nor are PDF 'objects'. Have a
|
||||||
|
* look at {@link GD_Adapter} for more information. GD support is
|
||||||
|
* experimental, so use it at your own risk.
|
||||||
|
*
|
||||||
|
* @link http://www.pdflib.com
|
||||||
|
* @link http://www.ros.co.nz/pdf
|
||||||
|
* @link http://www.php.net/image
|
||||||
|
*/
|
||||||
|
'pdf_backend' => 'CPDF',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* html target media view which should be rendered into pdf.
|
||||||
|
* List of types and parsing rules for future extensions:
|
||||||
|
* http://www.w3.org/TR/REC-html40/types.html
|
||||||
|
* screen, tty, tv, projection, handheld, print, braille, aural, all
|
||||||
|
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
|
||||||
|
* Note, even though the generated pdf file is intended for print output,
|
||||||
|
* the desired content might be different (e.g. screen or projection view of html file).
|
||||||
|
* Therefore allow specification of content here.
|
||||||
|
*/
|
||||||
|
'default_media_type' => 'screen',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default paper size.
|
||||||
|
*
|
||||||
|
* North America standard is "letter"; other countries generally "a4"
|
||||||
|
*
|
||||||
|
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
|
||||||
|
*/
|
||||||
|
'default_paper_size' => 'a4',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default paper orientation.
|
||||||
|
*
|
||||||
|
* The orientation of the page (portrait or landscape).
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
'default_paper_orientation' => 'portrait',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default font family
|
||||||
|
*
|
||||||
|
* Used if no suitable fonts can be found. This must exist in the font folder.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
'default_font' => 'serif',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image DPI setting
|
||||||
|
*
|
||||||
|
* This setting determines the default DPI setting for images and fonts. The
|
||||||
|
* DPI may be overridden for inline images by explictly setting the
|
||||||
|
* image's width & height style attributes (i.e. if the image's native
|
||||||
|
* width is 600 pixels and you specify the image's width as 72 points,
|
||||||
|
* the image will have a DPI of 600 in the rendered PDF. The DPI of
|
||||||
|
* background images can not be overridden and is controlled entirely
|
||||||
|
* via this parameter.
|
||||||
|
*
|
||||||
|
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
|
||||||
|
* If a size in html is given as px (or without unit as image size),
|
||||||
|
* this tells the corresponding size in pt.
|
||||||
|
* This adjusts the relative sizes to be similar to the rendering of the
|
||||||
|
* html page in a reference browser.
|
||||||
|
*
|
||||||
|
* In pdf, always 1 pt = 1/72 inch
|
||||||
|
*
|
||||||
|
* Rendering resolution of various browsers in px per inch:
|
||||||
|
* Windows Firefox and Internet Explorer:
|
||||||
|
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
|
||||||
|
* Linux Firefox:
|
||||||
|
* about:config *resolution: Default:96
|
||||||
|
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
|
||||||
|
*
|
||||||
|
* Take care about extra font/image zoom factor of browser.
|
||||||
|
*
|
||||||
|
* In images, <img> size in pixel attribute, img css style, are overriding
|
||||||
|
* the real image dimension in px for rendering.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
'dpi' => 96,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable embedded PHP
|
||||||
|
*
|
||||||
|
* If this setting is set to true then DOMPDF will automatically evaluate embedded PHP contained
|
||||||
|
* within <script type="text/php"> ... </script> tags.
|
||||||
|
*
|
||||||
|
* ==== IMPORTANT ==== Enabling this for documents you do not trust (e.g. arbitrary remote html pages)
|
||||||
|
* is a security risk.
|
||||||
|
* Embedded scripts are run with the same level of system access available to dompdf.
|
||||||
|
* Set this option to false (recommended) if you wish to process untrusted documents.
|
||||||
|
* This setting may increase the risk of system exploit.
|
||||||
|
* Do not change this settings without understanding the consequences.
|
||||||
|
* Additional documentation is available on the dompdf wiki at:
|
||||||
|
* https://github.com/dompdf/dompdf/wiki
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
'enable_php' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rnable inline JavaScript
|
||||||
|
*
|
||||||
|
* If this setting is set to true then DOMPDF will automatically insert JavaScript code contained
|
||||||
|
* within <script type="text/javascript"> ... </script> tags as written into the PDF.
|
||||||
|
* NOTE: This is PDF-based JavaScript to be executed by the PDF viewer,
|
||||||
|
* not browser-based JavaScript executed by Dompdf.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
'enable_javascript' => true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable remote file access
|
||||||
|
*
|
||||||
|
* If this setting is set to true, DOMPDF will access remote sites for
|
||||||
|
* images and CSS files as required.
|
||||||
|
*
|
||||||
|
* ==== IMPORTANT ====
|
||||||
|
* This can be a security risk, in particular in combination with isPhpEnabled and
|
||||||
|
* allowing remote html code to be passed to $dompdf = new DOMPDF(); $dompdf->load_html(...);
|
||||||
|
* This allows anonymous users to download legally doubtful internet content which on
|
||||||
|
* tracing back appears to being downloaded by your server, or allows malicious php code
|
||||||
|
* in remote html pages to be executed by your server with your account privileges.
|
||||||
|
*
|
||||||
|
* This setting may increase the risk of system exploit. Do not change
|
||||||
|
* this settings without understanding the consequences. Additional
|
||||||
|
* documentation is available on the dompdf wiki at:
|
||||||
|
* https://github.com/dompdf/dompdf/wiki
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
'enable_remote' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of allowed remote hosts
|
||||||
|
*
|
||||||
|
* Each value of the array must be a valid hostname.
|
||||||
|
*
|
||||||
|
* This will be used to filter which resources can be loaded in combination with
|
||||||
|
* isRemoteEnabled. If enable_remote is FALSE, then this will have no effect.
|
||||||
|
*
|
||||||
|
* Leave to NULL to allow any remote host.
|
||||||
|
*
|
||||||
|
* @var array|null
|
||||||
|
*/
|
||||||
|
'allowed_remote_hosts' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ratio applied to the fonts height to be more like browsers' line height
|
||||||
|
*/
|
||||||
|
'font_height_ratio' => 1.1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the HTML5 Lib parser
|
||||||
|
*
|
||||||
|
* @deprecated This feature is now always on in dompdf 2.x
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
'enable_html5_parser' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
@@ -1,41 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Default Filesystem Disk
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may specify the default filesystem disk that should be used
|
|
||||||
| by the framework. The "local" disk, as well as a variety of cloud
|
|
||||||
| based disks are available to your application for file storage.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Filesystem Disks
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Below you may configure as many filesystem disks as necessary, and you
|
|
||||||
| may even configure multiple disks for the same driver. Examples for
|
|
||||||
| most supported storage drivers are configured here for reference.
|
|
||||||
|
|
|
||||||
| Supported drivers: "local", "ftp", "sftp", "s3"
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'disks' => [
|
'disks' => [
|
||||||
|
|
||||||
'local' => [
|
'local' => [
|
||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => storage_path('app/private'),
|
'root' => storage_path('app'),
|
||||||
'serve' => true,
|
|
||||||
'throw' => false,
|
|
||||||
'report' => false,
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'public' => [
|
'public' => [
|
||||||
@@ -43,8 +14,6 @@ return [
|
|||||||
'root' => storage_path('app/public'),
|
'root' => storage_path('app/public'),
|
||||||
'url' => env('APP_URL').'/storage',
|
'url' => env('APP_URL').'/storage',
|
||||||
'visibility' => 'public',
|
'visibility' => 'public',
|
||||||
'throw' => false,
|
|
||||||
'report' => false,
|
|
||||||
],
|
],
|
||||||
|
|
||||||
's3' => [
|
's3' => [
|
||||||
@@ -56,25 +25,10 @@ return [
|
|||||||
'url' => env('AWS_URL'),
|
'url' => env('AWS_URL'),
|
||||||
'endpoint' => env('AWS_ENDPOINT'),
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
'throw' => false,
|
|
||||||
'report' => false,
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Symbolic Links
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may configure the symbolic links that will be created when the
|
|
||||||
| `storage:link` Artisan command is executed. The array keys should be
|
|
||||||
| the locations of the links and the values should be their targets.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'links' => [
|
'links' => [
|
||||||
public_path('storage') => storage_path('app/public'),
|
public_path('storage') => storage_path('app/public'),
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
628
cription' => 'С панорамным видом',
Normal file
628
cription' => 'С панорамным видом',
Normal file
@@ -0,0 +1,628 @@
|
|||||||
|
|
||||||
|
SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS
|
||||||
|
|
||||||
|
Commands marked with * may be preceded by a number, _N.
|
||||||
|
Notes in parentheses indicate the behavior if _N is given.
|
||||||
|
A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
|
||||||
|
|
||||||
|
h H Display this help.
|
||||||
|
q :q Q :Q ZZ Exit.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MMOOVVIINNGG
|
||||||
|
|
||||||
|
e ^E j ^N CR * Forward one line (or _N lines).
|
||||||
|
y ^Y k ^K ^P * Backward one line (or _N lines).
|
||||||
|
f ^F ^V SPACE * Forward one window (or _N lines).
|
||||||
|
b ^B ESC-v * Backward one window (or _N lines).
|
||||||
|
z * Forward one window (and set window to _N).
|
||||||
|
w * Backward one window (and set window to _N).
|
||||||
|
ESC-SPACE * Forward one window, but don't stop at end-of-file.
|
||||||
|
d ^D * Forward one half-window (and set half-window to _N).
|
||||||
|
u ^U * Backward one half-window (and set half-window to _N).
|
||||||
|
ESC-) RightArrow * Right one half screen width (or _N positions).
|
||||||
|
ESC-( LeftArrow * Left one half screen width (or _N positions).
|
||||||
|
ESC-} ^RightArrow Right to last column displayed.
|
||||||
|
ESC-{ ^LeftArrow Left to first column.
|
||||||
|
F Forward forever; like "tail -f".
|
||||||
|
ESC-F Like F but stop when search pattern is found.
|
||||||
|
r ^R ^L Repaint screen.
|
||||||
|
R Repaint screen, discarding buffered input.
|
||||||
|
---------------------------------------------------
|
||||||
|
Default "window" is the screen height.
|
||||||
|
Default "half-window" is half of the screen height.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SSEEAARRCCHHIINNGG
|
||||||
|
|
||||||
|
/_p_a_t_t_e_r_n * Search forward for (_N-th) matching line.
|
||||||
|
?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line.
|
||||||
|
n * Repeat previous search (for _N-th occurrence).
|
||||||
|
N * Repeat previous search in reverse direction.
|
||||||
|
ESC-n * Repeat previous search, spanning files.
|
||||||
|
ESC-N * Repeat previous search, reverse dir. & spanning files.
|
||||||
|
^O^N ^On * Search forward for (_N-th) OSC8 hyperlink.
|
||||||
|
^O^P ^Op * Search backward for (_N-th) OSC8 hyperlink.
|
||||||
|
^O^L ^Ol Jump to the currently selected OSC8 hyperlink.
|
||||||
|
ESC-u Undo (toggle) search highlighting.
|
||||||
|
ESC-U Clear search highlighting.
|
||||||
|
&_p_a_t_t_e_r_n * Display only matching lines.
|
||||||
|
---------------------------------------------------
|
||||||
|
A search pattern may begin with one or more of:
|
||||||
|
^N or ! Search for NON-matching lines.
|
||||||
|
^E or * Search multiple files (pass thru END OF FILE).
|
||||||
|
^F or @ Start search at FIRST file (for /) or last file (for ?).
|
||||||
|
^K Highlight matches, but don't move (KEEP position).
|
||||||
|
^R Don't use REGULAR EXPRESSIONS.
|
||||||
|
^S _n Search for match in _n-th parenthesized subpattern.
|
||||||
|
^W WRAP search if no match found.
|
||||||
|
^L Enter next character literally into pattern.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
JJUUMMPPIINNGG
|
||||||
|
|
||||||
|
g < ESC-< * Go to first line in file (or line _N).
|
||||||
|
G > ESC-> * Go to last line in file (or line _N).
|
||||||
|
p % * Go to beginning of file (or _N percent into file).
|
||||||
|
t * Go to the (_N-th) next tag.
|
||||||
|
T * Go to the (_N-th) previous tag.
|
||||||
|
{ ( [ * Find close bracket } ) ].
|
||||||
|
} ) ] * Find open bracket { ( [.
|
||||||
|
ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>.
|
||||||
|
ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>.
|
||||||
|
---------------------------------------------------
|
||||||
|
Each "find close bracket" command goes forward to the close bracket
|
||||||
|
matching the (_N-th) open bracket in the top line.
|
||||||
|
Each "find open bracket" command goes backward to the open bracket
|
||||||
|
matching the (_N-th) close bracket in the bottom line.
|
||||||
|
|
||||||
|
m_<_l_e_t_t_e_r_> Mark the current top line with <letter>.
|
||||||
|
M_<_l_e_t_t_e_r_> Mark the current bottom line with <letter>.
|
||||||
|
'_<_l_e_t_t_e_r_> Go to a previously marked position.
|
||||||
|
'' Go to the previous position.
|
||||||
|
^X^X Same as '.
|
||||||
|
ESC-m_<_l_e_t_t_e_r_> Clear a mark.
|
||||||
|
---------------------------------------------------
|
||||||
|
A mark is any upper-case or lower-case letter.
|
||||||
|
Certain marks are predefined:
|
||||||
|
^ means beginning of the file
|
||||||
|
$ means end of the file
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
CCHHAANNGGIINNGG FFIILLEESS
|
||||||
|
|
||||||
|
:e [_f_i_l_e] Examine a new file.
|
||||||
|
^X^V Same as :e.
|
||||||
|
:n * Examine the (_N-th) next file from the command line.
|
||||||
|
:p * Examine the (_N-th) previous file from the command line.
|
||||||
|
:x * Examine the first (or _N-th) file from the command line.
|
||||||
|
^O^O Open the currently selected OSC8 hyperlink.
|
||||||
|
:d Delete the current file from the command line list.
|
||||||
|
= ^G :f Print current file name.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS
|
||||||
|
|
||||||
|
-_<_f_l_a_g_> Toggle a command line option [see OPTIONS below].
|
||||||
|
--_<_n_a_m_e_> Toggle a command line option, by name.
|
||||||
|
__<_f_l_a_g_> Display the setting of a command line option.
|
||||||
|
___<_n_a_m_e_> Display the setting of an option, by name.
|
||||||
|
+_c_m_d Execute the less cmd each time a new file is examined.
|
||||||
|
|
||||||
|
!_c_o_m_m_a_n_d Execute the shell command with $SHELL.
|
||||||
|
#_c_o_m_m_a_n_d Execute the shell command, expanded like a prompt.
|
||||||
|
|XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command.
|
||||||
|
s _f_i_l_e Save input to a file.
|
||||||
|
v Edit the current file with $VISUAL or $EDITOR.
|
||||||
|
V Print version number of "less".
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
OOPPTTIIOONNSS
|
||||||
|
|
||||||
|
Most options may be changed either on the command line,
|
||||||
|
or from within less by using the - or -- command.
|
||||||
|
Options may be given in one of two forms: either a single
|
||||||
|
character preceded by a -, or a name preceded by --.
|
||||||
|
|
||||||
|
-? ........ --help
|
||||||
|
Display help (from command line).
|
||||||
|
-a ........ --search-skip-screen
|
||||||
|
Search skips current screen.
|
||||||
|
-A ........ --SEARCH-SKIP-SCREEN
|
||||||
|
Search starts just after target line.
|
||||||
|
-b [_N] .... --buffers=[_N]
|
||||||
|
Number of buffers.
|
||||||
|
-B ........ --auto-buffers
|
||||||
|
Don't automatically allocate buffers for pipes.
|
||||||
|
-c ........ --clear-screen
|
||||||
|
Repaint by clearing rather than scrolling.
|
||||||
|
-d ........ --dumb
|
||||||
|
Dumb terminal.
|
||||||
|
-D xx_c_o_l_o_r . --color=xx_c_o_l_o_r
|
||||||
|
Set screen colors.
|
||||||
|
-e -E .... --quit-at-eof --QUIT-AT-EOF
|
||||||
|
Quit at end of file.
|
||||||
|
-f ........ --force
|
||||||
|
Force open non-regular files.
|
||||||
|
-F ........ --quit-if-one-screen
|
||||||
|
Quit if entire file fits on first screen.
|
||||||
|
-g ........ --hilite-search
|
||||||
|
Highlight only last match for searches.
|
||||||
|
-G ........ --HILITE-SEARCH
|
||||||
|
Don't highlight any matches for searches.
|
||||||
|
-h [_N] .... --max-back-scroll=[_N]
|
||||||
|
Backward scroll limit.
|
||||||
|
-i ........ --ignore-case
|
||||||
|
Ignore case in searches that do not contain uppercase.
|
||||||
|
-I ........ --IGNORE-CASE
|
||||||
|
Ignore case in all searches.
|
||||||
|
-j [_N] .... --jump-target=[_N]
|
||||||
|
Screen position of target lines.
|
||||||
|
-J ........ --status-column
|
||||||
|
Display a status column at left edge of screen.
|
||||||
|
-k _f_i_l_e ... --lesskey-file=_f_i_l_e
|
||||||
|
Use a compiled lesskey file.
|
||||||
|
-K ........ --quit-on-intr
|
||||||
|
Exit less in response to ctrl-C.
|
||||||
|
-L ........ --no-lessopen
|
||||||
|
Ignore the LESSOPEN environment variable.
|
||||||
|
-m -M .... --long-prompt --LONG-PROMPT
|
||||||
|
Set prompt style.
|
||||||
|
-n ......... --line-numbers
|
||||||
|
Suppress line numbers in prompts and messages.
|
||||||
|
-N ......... --LINE-NUMBERS
|
||||||
|
Display line number at start of each line.
|
||||||
|
-o [_f_i_l_e] .. --log-file=[_f_i_l_e]
|
||||||
|
Copy to log file (standard input only).
|
||||||
|
-O [_f_i_l_e] .. --LOG-FILE=[_f_i_l_e]
|
||||||
|
Copy to log file (unconditionally overwrite).
|
||||||
|
-p _p_a_t_t_e_r_n . --pattern=[_p_a_t_t_e_r_n]
|
||||||
|
Start at pattern (from command line).
|
||||||
|
-P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t]
|
||||||
|
Define new prompt.
|
||||||
|
-q -Q .... --quiet --QUIET --silent --SILENT
|
||||||
|
Quiet the terminal bell.
|
||||||
|
-r -R .... --raw-control-chars --RAW-CONTROL-CHARS
|
||||||
|
Output "raw" control characters.
|
||||||
|
-s ........ --squeeze-blank-lines
|
||||||
|
Squeeze multiple blank lines.
|
||||||
|
-S ........ --chop-long-lines
|
||||||
|
Chop (truncate) long lines rather than wrapping.
|
||||||
|
-t _t_a_g .... --tag=[_t_a_g]
|
||||||
|
Find a tag.
|
||||||
|
-T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e]
|
||||||
|
Use an alternate tags file.
|
||||||
|
-u -U .... --underline-special --UNDERLINE-SPECIAL
|
||||||
|
Change handling of backspaces, tabs and carriage returns.
|
||||||
|
-V ........ --version
|
||||||
|
Display the version number of "less".
|
||||||
|
-w ........ --hilite-unread
|
||||||
|
Highlight first new line after forward-screen.
|
||||||
|
-W ........ --HILITE-UNREAD
|
||||||
|
Highlight first new line after any forward movement.
|
||||||
|
-x [_N[,...]] --tabs=[_N[,...]]
|
||||||
|
Set tab stops.
|
||||||
|
-X ........ --no-init
|
||||||
|
Don't use termcap init/deinit strings.
|
||||||
|
-y [_N] .... --max-forw-scroll=[_N]
|
||||||
|
Forward scroll limit.
|
||||||
|
-z [_N] .... --window=[_N]
|
||||||
|
Set size of window.
|
||||||
|
-" [_c[_c]] . --quotes=[_c[_c]]
|
||||||
|
Set shell quote characters.
|
||||||
|
-~ ........ --tilde
|
||||||
|
Don't display tildes after end of file.
|
||||||
|
-# [_N] .... --shift=[_N]
|
||||||
|
Set horizontal scroll amount (0 = one half screen width).
|
||||||
|
|
||||||
|
--exit-follow-on-close
|
||||||
|
Exit F command on a pipe when writer closes pipe.
|
||||||
|
--file-size
|
||||||
|
Automatically determine the size of the input file.
|
||||||
|
--follow-name
|
||||||
|
The F command changes files if the input file is renamed.
|
||||||
|
--header=[_L[,_C[,_N]]]
|
||||||
|
Use _L lines (starting at line _N) and _C columns as headers.
|
||||||
|
--incsearch
|
||||||
|
Search file as each pattern character is typed in.
|
||||||
|
--intr=[_C]
|
||||||
|
Use _C instead of ^X to interrupt a read.
|
||||||
|
--lesskey-context=_t_e_x_t
|
||||||
|
Use lesskey source file contents.
|
||||||
|
--lesskey-src=_f_i_l_e
|
||||||
|
Use a lesskey source file.
|
||||||
|
--line-num-width=[_N]
|
||||||
|
Set the width of the -N line number field to _N characters.
|
||||||
|
--match-shift=[_N]
|
||||||
|
Show at least _N characters to the left of a search match.
|
||||||
|
--modelines=[_N]
|
||||||
|
Read _N lines from the input file and look for vim modelines.
|
||||||
|
--mouse
|
||||||
|
Enable mouse input.
|
||||||
|
--no-keypad
|
||||||
|
Don't send termcap keypad init/deinit strings.
|
||||||
|
--no-histdups
|
||||||
|
Remove duplicates from command history.
|
||||||
|
--no-number-headers
|
||||||
|
Don't give line numbers to header lines.
|
||||||
|
--no-search-header-lines
|
||||||
|
Searches do not include header lines.
|
||||||
|
--no-search-header-columns
|
||||||
|
Searches do not include header columns.
|
||||||
|
--no-search-headers
|
||||||
|
Searches do not include header lines or columns.
|
||||||
|
--no-vbell
|
||||||
|
Disable the terminal's visual bell.
|
||||||
|
--redraw-on-quit
|
||||||
|
Redraw final screen when quitting.
|
||||||
|
--rscroll=[_C]
|
||||||
|
Set the character used to mark truncated lines.
|
||||||
|
--save-marks
|
||||||
|
Retain marks across invocations of less.
|
||||||
|
--search-options=[EFKNRW-]
|
||||||
|
Set default options for every search.
|
||||||
|
--show-preproc-errors
|
||||||
|
Display a message if preprocessor exits with an error status.
|
||||||
|
--proc-backspace
|
||||||
|
Process backspaces for bold/underline.
|
||||||
|
--PROC-BACKSPACE
|
||||||
|
Treat backspaces as control characters.
|
||||||
|
--proc-return
|
||||||
|
Delete carriage returns before newline.
|
||||||
|
--PROC-RETURN
|
||||||
|
Treat carriage returns as control characters.
|
||||||
|
--proc-tab
|
||||||
|
Expand tabs to spaces.
|
||||||
|
--PROC-TAB
|
||||||
|
Treat tabs as control characters.
|
||||||
|
--status-col-width=[_N]
|
||||||
|
Set the width of the -J status column to _N characters.
|
||||||
|
--status-line
|
||||||
|
Highlight or color the entire line containing a mark.
|
||||||
|
--use-backslash
|
||||||
|
Subsequent options use backslash as escape char.
|
||||||
|
--use-color
|
||||||
|
Enables colored text.
|
||||||
|
--wheel-lines=[_N]
|
||||||
|
Each click of the mouse wheel moves _N lines.
|
||||||
|
--wordwrap
|
||||||
|
Wrap lines at spaces.
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LLIINNEE EEDDIITTIINNGG
|
||||||
|
|
||||||
|
These keys can be used to edit text being entered
|
||||||
|
on the "command line" at the bottom of the screen.
|
||||||
|
|
||||||
|
RightArrow ..................... ESC-l ... Move cursor right one character.
|
||||||
|
LeftArrow ...................... ESC-h ... Move cursor left one character.
|
||||||
|
ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word.
|
||||||
|
ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word.
|
||||||
|
HOME ........................... ESC-0 ... Move cursor to start of line.
|
||||||
|
END ............................ ESC-$ ... Move cursor to end of line.
|
||||||
|
BACKSPACE ................................ Delete char to left of cursor.
|
||||||
|
DELETE ......................... ESC-x ... Delete char under cursor.
|
||||||
|
ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor.
|
||||||
|
ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
|
||||||
|
ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
|
||||||
|
UpArrow ........................ ESC-k ... Retrieve previous command line.
|
||||||
|
DownArrow ...................... ESC-j ... Retrieve next command line.
|
||||||
|
TAB ...................................... Complete filename & cycle.
|
||||||
|
SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle.
|
||||||
|
ctrl-L ................................... Complete filename, list all.
|
||||||
|
|
||||||
|
SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS
|
||||||
|
|
||||||
|
Commands marked with * may be preceded by a number, _N.
|
||||||
|
Notes in parentheses indicate the behavior if _N is given.
|
||||||
|
A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
|
||||||
|
|
||||||
|
h H Display this help.
|
||||||
|
q :q Q :Q ZZ Exit.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MMOOVVIINNGG
|
||||||
|
|
||||||
|
e ^E j ^N CR * Forward one line (or _N lines).
|
||||||
|
y ^Y k ^K ^P * Backward one line (or _N lines).
|
||||||
|
f ^F ^V SPACE * Forward one window (or _N lines).
|
||||||
|
b ^B ESC-v * Backward one window (or _N lines).
|
||||||
|
z * Forward one window (and set window to _N).
|
||||||
|
w * Backward one window (and set window to _N).
|
||||||
|
ESC-SPACE * Forward one window, but don't stop at end-of-file.
|
||||||
|
d ^D * Forward one half-window (and set half-window to _N).
|
||||||
|
u ^U * Backward one half-window (and set half-window to _N).
|
||||||
|
ESC-) RightArrow * Right one half screen width (or _N positions).
|
||||||
|
ESC-( LeftArrow * Left one half screen width (or _N positions).
|
||||||
|
ESC-} ^RightArrow Right to last column displayed.
|
||||||
|
ESC-{ ^LeftArrow Left to first column.
|
||||||
|
F Forward forever; like "tail -f".
|
||||||
|
ESC-F Like F but stop when search pattern is found.
|
||||||
|
r ^R ^L Repaint screen.
|
||||||
|
R Repaint screen, discarding buffered input.
|
||||||
|
---------------------------------------------------
|
||||||
|
Default "window" is the screen height.
|
||||||
|
Default "half-window" is half of the screen height.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SSEEAARRCCHHIINNGG
|
||||||
|
|
||||||
|
/_p_a_t_t_e_r_n * Search forward for (_N-th) matching line.
|
||||||
|
?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line.
|
||||||
|
n * Repeat previous search (for _N-th occurrence).
|
||||||
|
N * Repeat previous search in reverse direction.
|
||||||
|
ESC-n * Repeat previous search, spanning files.
|
||||||
|
ESC-N * Repeat previous search, reverse dir. & spanning files.
|
||||||
|
^O^N ^On * Search forward for (_N-th) OSC8 hyperlink.
|
||||||
|
^O^P ^Op * Search backward for (_N-th) OSC8 hyperlink.
|
||||||
|
^O^L ^Ol Jump to the currently selected OSC8 hyperlink.
|
||||||
|
ESC-u Undo (toggle) search highlighting.
|
||||||
|
ESC-U Clear search highlighting.
|
||||||
|
&_p_a_t_t_e_r_n * Display only matching lines.
|
||||||
|
---------------------------------------------------
|
||||||
|
A search pattern may begin with one or more of:
|
||||||
|
^N or ! Search for NON-matching lines.
|
||||||
|
^E or * Search multiple files (pass thru END OF FILE).
|
||||||
|
^F or @ Start search at FIRST file (for /) or last file (for ?).
|
||||||
|
^K Highlight matches, but don't move (KEEP position).
|
||||||
|
^R Don't use REGULAR EXPRESSIONS.
|
||||||
|
^S _n Search for match in _n-th parenthesized subpattern.
|
||||||
|
^W WRAP search if no match found.
|
||||||
|
^L Enter next character literally into pattern.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
JJUUMMPPIINNGG
|
||||||
|
|
||||||
|
g < ESC-< * Go to first line in file (or line _N).
|
||||||
|
G > ESC-> * Go to last line in file (or line _N).
|
||||||
|
p % * Go to beginning of file (or _N percent into file).
|
||||||
|
t * Go to the (_N-th) next tag.
|
||||||
|
T * Go to the (_N-th) previous tag.
|
||||||
|
{ ( [ * Find close bracket } ) ].
|
||||||
|
} ) ] * Find open bracket { ( [.
|
||||||
|
ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>.
|
||||||
|
ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>.
|
||||||
|
---------------------------------------------------
|
||||||
|
Each "find close bracket" command goes forward to the close bracket
|
||||||
|
matching the (_N-th) open bracket in the top line.
|
||||||
|
Each "find open bracket" command goes backward to the open bracket
|
||||||
|
matching the (_N-th) close bracket in the bottom line.
|
||||||
|
|
||||||
|
m_<_l_e_t_t_e_r_> Mark the current top line with <letter>.
|
||||||
|
M_<_l_e_t_t_e_r_> Mark the current bottom line with <letter>.
|
||||||
|
'_<_l_e_t_t_e_r_> Go to a previously marked position.
|
||||||
|
'' Go to the previous position.
|
||||||
|
^X^X Same as '.
|
||||||
|
ESC-m_<_l_e_t_t_e_r_> Clear a mark.
|
||||||
|
---------------------------------------------------
|
||||||
|
A mark is any upper-case or lower-case letter.
|
||||||
|
Certain marks are predefined:
|
||||||
|
^ means beginning of the file
|
||||||
|
$ means end of the file
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
CCHHAANNGGIINNGG FFIILLEESS
|
||||||
|
|
||||||
|
:e [_f_i_l_e] Examine a new file.
|
||||||
|
^X^V Same as :e.
|
||||||
|
:n * Examine the (_N-th) next file from the command line.
|
||||||
|
:p * Examine the (_N-th) previous file from the command line.
|
||||||
|
:x * Examine the first (or _N-th) file from the command line.
|
||||||
|
^O^O Open the currently selected OSC8 hyperlink.
|
||||||
|
:d Delete the current file from the command line list.
|
||||||
|
= ^G :f Print current file name.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS
|
||||||
|
|
||||||
|
-_<_f_l_a_g_> Toggle a command line option [see OPTIONS below].
|
||||||
|
--_<_n_a_m_e_> Toggle a command line option, by name.
|
||||||
|
__<_f_l_a_g_> Display the setting of a command line option.
|
||||||
|
___<_n_a_m_e_> Display the setting of an option, by name.
|
||||||
|
+_c_m_d Execute the less cmd each time a new file is examined.
|
||||||
|
|
||||||
|
!_c_o_m_m_a_n_d Execute the shell command with $SHELL.
|
||||||
|
#_c_o_m_m_a_n_d Execute the shell command, expanded like a prompt.
|
||||||
|
|XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command.
|
||||||
|
s _f_i_l_e Save input to a file.
|
||||||
|
v Edit the current file with $VISUAL or $EDITOR.
|
||||||
|
V Print version number of "less".
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
OOPPTTIIOONNSS
|
||||||
|
|
||||||
|
Most options may be changed either on the command line,
|
||||||
|
or from within less by using the - or -- command.
|
||||||
|
Options may be given in one of two forms: either a single
|
||||||
|
character preceded by a -, or a name preceded by --.
|
||||||
|
|
||||||
|
-? ........ --help
|
||||||
|
Display help (from command line).
|
||||||
|
-a ........ --search-skip-screen
|
||||||
|
Search skips current screen.
|
||||||
|
-A ........ --SEARCH-SKIP-SCREEN
|
||||||
|
Search starts just after target line.
|
||||||
|
-b [_N] .... --buffers=[_N]
|
||||||
|
Number of buffers.
|
||||||
|
-B ........ --auto-buffers
|
||||||
|
Don't automatically allocate buffers for pipes.
|
||||||
|
-c ........ --clear-screen
|
||||||
|
Repaint by clearing rather than scrolling.
|
||||||
|
-d ........ --dumb
|
||||||
|
Dumb terminal.
|
||||||
|
-D xx_c_o_l_o_r . --color=xx_c_o_l_o_r
|
||||||
|
Set screen colors.
|
||||||
|
-e -E .... --quit-at-eof --QUIT-AT-EOF
|
||||||
|
Quit at end of file.
|
||||||
|
-f ........ --force
|
||||||
|
Force open non-regular files.
|
||||||
|
-F ........ --quit-if-one-screen
|
||||||
|
Quit if entire file fits on first screen.
|
||||||
|
-g ........ --hilite-search
|
||||||
|
Highlight only last match for searches.
|
||||||
|
-G ........ --HILITE-SEARCH
|
||||||
|
Don't highlight any matches for searches.
|
||||||
|
-h [_N] .... --max-back-scroll=[_N]
|
||||||
|
Backward scroll limit.
|
||||||
|
-i ........ --ignore-case
|
||||||
|
Ignore case in searches that do not contain uppercase.
|
||||||
|
-I ........ --IGNORE-CASE
|
||||||
|
Ignore case in all searches.
|
||||||
|
-j [_N] .... --jump-target=[_N]
|
||||||
|
Screen position of target lines.
|
||||||
|
-J ........ --status-column
|
||||||
|
Display a status column at left edge of screen.
|
||||||
|
-k _f_i_l_e ... --lesskey-file=_f_i_l_e
|
||||||
|
Use a compiled lesskey file.
|
||||||
|
-K ........ --quit-on-intr
|
||||||
|
Exit less in response to ctrl-C.
|
||||||
|
-L ........ --no-lessopen
|
||||||
|
Ignore the LESSOPEN environment variable.
|
||||||
|
-m -M .... --long-prompt --LONG-PROMPT
|
||||||
|
Set prompt style.
|
||||||
|
-n ......... --line-numbers
|
||||||
|
Suppress line numbers in prompts and messages.
|
||||||
|
-N ......... --LINE-NUMBERS
|
||||||
|
Display line number at start of each line.
|
||||||
|
-o [_f_i_l_e] .. --log-file=[_f_i_l_e]
|
||||||
|
Copy to log file (standard input only).
|
||||||
|
-O [_f_i_l_e] .. --LOG-FILE=[_f_i_l_e]
|
||||||
|
Copy to log file (unconditionally overwrite).
|
||||||
|
-p _p_a_t_t_e_r_n . --pattern=[_p_a_t_t_e_r_n]
|
||||||
|
Start at pattern (from command line).
|
||||||
|
-P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t]
|
||||||
|
Define new prompt.
|
||||||
|
-q -Q .... --quiet --QUIET --silent --SILENT
|
||||||
|
Quiet the terminal bell.
|
||||||
|
-r -R .... --raw-control-chars --RAW-CONTROL-CHARS
|
||||||
|
Output "raw" control characters.
|
||||||
|
-s ........ --squeeze-blank-lines
|
||||||
|
Squeeze multiple blank lines.
|
||||||
|
-S ........ --chop-long-lines
|
||||||
|
Chop (truncate) long lines rather than wrapping.
|
||||||
|
-t _t_a_g .... --tag=[_t_a_g]
|
||||||
|
Find a tag.
|
||||||
|
-T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e]
|
||||||
|
Use an alternate tags file.
|
||||||
|
-u -U .... --underline-special --UNDERLINE-SPECIAL
|
||||||
|
Change handling of backspaces, tabs and carriage returns.
|
||||||
|
-V ........ --version
|
||||||
|
Display the version number of "less".
|
||||||
|
-w ........ --hilite-unread
|
||||||
|
Highlight first new line after forward-screen.
|
||||||
|
-W ........ --HILITE-UNREAD
|
||||||
|
Highlight first new line after any forward movement.
|
||||||
|
-x [_N[,...]] --tabs=[_N[,...]]
|
||||||
|
Set tab stops.
|
||||||
|
-X ........ --no-init
|
||||||
|
Don't use termcap init/deinit strings.
|
||||||
|
-y [_N] .... --max-forw-scroll=[_N]
|
||||||
|
Forward scroll limit.
|
||||||
|
-z [_N] .... --window=[_N]
|
||||||
|
Set size of window.
|
||||||
|
-" [_c[_c]] . --quotes=[_c[_c]]
|
||||||
|
Set shell quote characters.
|
||||||
|
-~ ........ --tilde
|
||||||
|
Don't display tildes after end of file.
|
||||||
|
-# [_N] .... --shift=[_N]
|
||||||
|
Set horizontal scroll amount (0 = one half screen width).
|
||||||
|
|
||||||
|
--exit-follow-on-close
|
||||||
|
Exit F command on a pipe when writer closes pipe.
|
||||||
|
--file-size
|
||||||
|
Automatically determine the size of the input file.
|
||||||
|
--follow-name
|
||||||
|
The F command changes files if the input file is renamed.
|
||||||
|
--header=[_L[,_C[,_N]]]
|
||||||
|
Use _L lines (starting at line _N) and _C columns as headers.
|
||||||
|
--incsearch
|
||||||
|
Search file as each pattern character is typed in.
|
||||||
|
--intr=[_C]
|
||||||
|
Use _C instead of ^X to interrupt a read.
|
||||||
|
--lesskey-context=_t_e_x_t
|
||||||
|
Use lesskey source file contents.
|
||||||
|
--lesskey-src=_f_i_l_e
|
||||||
|
Use a lesskey source file.
|
||||||
|
--line-num-width=[_N]
|
||||||
|
Set the width of the -N line number field to _N characters.
|
||||||
|
--match-shift=[_N]
|
||||||
|
Show at least _N characters to the left of a search match.
|
||||||
|
--modelines=[_N]
|
||||||
|
Read _N lines from the input file and look for vim modelines.
|
||||||
|
--mouse
|
||||||
|
Enable mouse input.
|
||||||
|
--no-keypad
|
||||||
|
Don't send termcap keypad init/deinit strings.
|
||||||
|
--no-histdups
|
||||||
|
Remove duplicates from command history.
|
||||||
|
--no-number-headers
|
||||||
|
Don't give line numbers to header lines.
|
||||||
|
--no-search-header-lines
|
||||||
|
Searches do not include header lines.
|
||||||
|
--no-search-header-columns
|
||||||
|
Searches do not include header columns.
|
||||||
|
--no-search-headers
|
||||||
|
Searches do not include header lines or columns.
|
||||||
|
--no-vbell
|
||||||
|
Disable the terminal's visual bell.
|
||||||
|
--redraw-on-quit
|
||||||
|
Redraw final screen when quitting.
|
||||||
|
--rscroll=[_C]
|
||||||
|
Set the character used to mark truncated lines.
|
||||||
|
--save-marks
|
||||||
|
Retain marks across invocations of less.
|
||||||
|
--search-options=[EFKNRW-]
|
||||||
|
Set default options for every search.
|
||||||
|
--show-preproc-errors
|
||||||
|
Display a message if preprocessor exits with an error status.
|
||||||
|
--proc-backspace
|
||||||
|
Process backspaces for bold/underline.
|
||||||
|
--PROC-BACKSPACE
|
||||||
|
Treat backspaces as control characters.
|
||||||
|
--proc-return
|
||||||
|
Delete carriage returns before newline.
|
||||||
|
--PROC-RETURN
|
||||||
|
Treat carriage returns as control characters.
|
||||||
|
--proc-tab
|
||||||
|
Expand tabs to spaces.
|
||||||
|
--PROC-TAB
|
||||||
|
Treat tabs as control characters.
|
||||||
|
--status-col-width=[_N]
|
||||||
|
Set the width of the -J status column to _N characters.
|
||||||
|
--status-line
|
||||||
|
Highlight or color the entire line containing a mark.
|
||||||
|
--use-backslash
|
||||||
|
Subsequent options use backslash as escape char.
|
||||||
|
--use-color
|
||||||
|
Enables colored text.
|
||||||
|
--wheel-lines=[_N]
|
||||||
|
Each click of the mouse wheel moves _N lines.
|
||||||
|
--wordwrap
|
||||||
|
Wrap lines at spaces.
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LLIINNEE EEDDIITTIINNGG
|
||||||
|
|
||||||
|
These keys can be used to edit text being entered
|
||||||
|
on the "command line" at the bottom of the screen.
|
||||||
|
|
||||||
|
RightArrow ..................... ESC-l ... Move cursor right one character.
|
||||||
|
LeftArrow ...................... ESC-h ... Move cursor left one character.
|
||||||
|
ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word.
|
||||||
|
ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word.
|
||||||
|
HOME ........................... ESC-0 ... Move cursor to start of line.
|
||||||
|
END ............................ ESC-$ ... Move cursor to end of line.
|
||||||
|
BACKSPACE ................................ Delete char to left of cursor.
|
||||||
|
DELETE ......................... ESC-x ... Delete char under cursor.
|
||||||
|
ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor.
|
||||||
|
ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
|
||||||
|
ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
|
||||||
|
UpArrow ........................ ESC-k ... Retrieve previous command line.
|
||||||
|
DownArrow ...................... ESC-j ... Retrieve next command line.
|
||||||
|
TAB ...................................... Complete filename & cycle.
|
||||||
|
SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle.
|
||||||
|
ctrl-L ................................... Complete filename, list all.
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::create('table_hotels', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->timestamps();
|
|
||||||
$table->text('name');
|
|
||||||
$table->text('description');
|
|
||||||
$table->text('address');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('table_hotels');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateHotelsTable extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('hotels', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('address')->nullable();
|
||||||
|
$table->string('phone')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('hotels');
|
||||||
|
}
|
||||||
|
}
|
||||||
33
database/migrations/2025_12_30_222106_create_room_types.php
Normal file
33
database/migrations/2025_12_30_222106_create_room_types.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('room_types', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('hotel_id')->constrained()->onDelete('cascade');
|
||||||
|
$table->string('name');
|
||||||
|
$table->integer('capacity')->nullable()->default(2)->change();
|
||||||
|
$table->decimal('base_price', 10, 2);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
$table->integer('capacity')->default(2)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -11,12 +11,15 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('table_room_types', function (Blueprint $table) {
|
Schema::create('room_availabilities', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
|
||||||
|
$table->date('date');
|
||||||
|
$table->boolean('is_available')->default(true);
|
||||||
|
$table->decimal('price_override', 10, 2)->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->text('name');
|
|
||||||
$table->text('capacity');
|
$table->unique(['room_type_id', 'date']);
|
||||||
$table->text('base_price');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +28,6 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('table_room_types');
|
Schema::dropIfExists('room_availability');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('bookings', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
|
||||||
|
$table->date('check_in');
|
||||||
|
$table->date('check_out');
|
||||||
|
$table->string('guest_name');
|
||||||
|
$table->string('guest_email');
|
||||||
|
$table->string('guest_phone')->nullable();
|
||||||
|
$table->boolean('is_confirmed')->default(false);
|
||||||
|
$table->decimal('total_price', 10, 2)->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('bookings');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -11,8 +11,13 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('table_room_availability', function (Blueprint $table) {
|
Schema::create('invoices', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->foreignId('booking_id')->constrained()->onDelete('cascade');
|
||||||
|
$table->decimal('amount', 10, 2);
|
||||||
|
$table->string('currency')->default('RUB');
|
||||||
|
$table->string('pdf_path')->nullable();
|
||||||
|
$table->timestamp('issued_at')->useCurrent();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -22,6 +27,6 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('table_room_availability');
|
Schema::dropIfExists('invoices');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateAdminsTable extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('admins', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('email')->unique();
|
||||||
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
|
$table->string('password');
|
||||||
|
$table->rememberToken();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('admins');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('invoices', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('booking_id')->constrained()->onDelete('cascade');
|
||||||
|
$table->decimal('total_amount', 10, 2);
|
||||||
|
$table->string('status')->default('pending');
|
||||||
|
$table->timestamp('issued_at')->useCurrent();
|
||||||
|
$table->timestamp('due_date')->nullable();
|
||||||
|
$table->string('pdf_path')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('invoices');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -4,25 +4,19 @@ use Illuminate\Database\Migrations\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
class AddDefaultPhoneToUsersTable extends Migration
|
||||||
{
|
{
|
||||||
/**
|
public function up()
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->boolean('is_admin')->default(false);
|
$table->string('phone')->default('')->change();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function down()
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn('is_admin');
|
$table->string('phone')->nullable()->change();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('availabilities', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
|
||||||
|
$table->date('start_date');
|
||||||
|
$table->date('end_date');
|
||||||
|
$table->boolean('is_available')->default(true);
|
||||||
|
$table->decimal('price', 8, 2)->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('availabilities');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
$table->text('description')->nullable()->after('name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('description');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
$table->integer('max_guests')->default(2)->after('description');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('max_guests');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
// Изменяем capacity: делаем nullable и добавляем default
|
||||||
|
$table->integer('capacity')->nullable()->default(2)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
$table->integer('capacity')->default(2)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
// Изменяем base_price: делаем nullable и добавляем default
|
||||||
|
$table->decimal('base_price', 8, 2)->nullable()->default(5000.00)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('room_types', function (Blueprint $table) {
|
||||||
|
$table->decimal('base_price', 8, 2)->default(5000.00)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -2,24 +2,66 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use App\Models\Admin;
|
||||||
|
use App\Models\Hotel;
|
||||||
|
use App\Models\RoomType;
|
||||||
|
use App\Models\RoomAvailability;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
use WithoutModelEvents;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Seed the application's database.
|
* Run the database seeds.
|
||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
// User::factory(10)->create();
|
// Админ
|
||||||
|
$admin = Admin::firstOrCreate([
|
||||||
|
'email' => 'admin@hotels.ru',
|
||||||
|
], [
|
||||||
|
'name' => 'Admin User',
|
||||||
|
'password' => Hash::make('password'),
|
||||||
|
]);
|
||||||
|
|
||||||
User::factory()->create([
|
// Отель
|
||||||
'name' => 'Test User',
|
$hotel = Hotel::create([
|
||||||
'email' => 'test@example.com',
|
'name' => 'Grand Hotel',
|
||||||
|
'address' => '123 Main St',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$roomType1 = RoomType::create([
|
||||||
|
'hotel_id' => $hotel->id,
|
||||||
|
'name' => 'Двухместный',
|
||||||
|
'capacity' => 2,
|
||||||
|
'base_price' => 5000,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$roomType2 = RoomType::create([
|
||||||
|
'hotel_id' => $hotel->id,
|
||||||
|
'name' => 'Люкс',
|
||||||
|
'capacity' => 4,
|
||||||
|
'base_price' => 10000,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$startDate = now()->startOfDay();
|
||||||
|
$endDate = now()->addDays(30)->startOfDay();
|
||||||
|
|
||||||
|
for ($date = $startDate; $date <= $endDate; $date->modify('+1 day')) {
|
||||||
|
RoomAvailability::create([
|
||||||
|
'room_type_id' => $roomType1->id,
|
||||||
|
'date' => $date->format('Y-m-d'),
|
||||||
|
'is_available' => true,
|
||||||
|
'price_override' => null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
RoomAvailability::create([
|
||||||
|
'room_type_id' => $roomType2->id,
|
||||||
|
'date' => $date->format('Y-m-d'),
|
||||||
|
'is_available' => true,
|
||||||
|
'price_override' => null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
2226
package-lock.json
generated
2226
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -1,17 +1,11 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"dev": "vite",
|
||||||
"dev": "vite"
|
"build": "vite build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/vite": "^4.0.0",
|
"laravel-vite-plugin": "^1.0",
|
||||||
"axios": "^1.11.0",
|
"vite": "^5.0"
|
||||||
"concurrently": "^9.0.1",
|
|
||||||
"laravel-vite-plugin": "^2.0.0",
|
|
||||||
"tailwindcss": "^4.0.0",
|
|
||||||
"vite": "^7.0.7"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
97
resources/views/admin/hotels/_calendar.blade.php
Normal file
97
resources/views/admin/hotels/_calendar.blade.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<div>
|
||||||
|
@if($roomTypes->isEmpty())
|
||||||
|
<p>Нет типов номеров. <a href="{{ route('admin.room-types.create') }}">Создать тип номера</a></p>
|
||||||
|
@else
|
||||||
|
@foreach($roomTypes as $type)
|
||||||
|
<div style="margin-bottom: 25px; padding: 15px; border: 1px solid #eee; border-radius: 6px;">
|
||||||
|
<h3>{{ $type->name }}</h3>
|
||||||
|
|
||||||
|
<!-- Форма добавления периода -->
|
||||||
|
<form class="availability-form" data-room-type-id="{{ $type->id }}" style="margin-bottom: 15px;">
|
||||||
|
@csrf
|
||||||
|
<div style="display: flex; gap: 10px; margin-bottom: 10px;">
|
||||||
|
<input type="date" name="start_date" required style="flex:1; padding:6px; border:1px solid #ccc; border-radius:4px;">
|
||||||
|
<input type="date" name="end_date" required style="flex:1; padding:6px; border:1px solid #ccc; border-radius:4px;">
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 10px;">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="is_available" value="1" checked> Доступен
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 10px;">
|
||||||
|
<input type="number" name="price" step="0.01" placeholder="Цена" style="width:100%; padding:6px; border:1px solid #ccc; border-radius:4px;">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn" style="padding:6px 12px;">Сохранить</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- Список периодов -->
|
||||||
|
@if($type->availabilities->isEmpty())
|
||||||
|
<p>Нет периодов.</p>
|
||||||
|
@else
|
||||||
|
<table style="width:100%; font-size:0.9rem;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>С</th>
|
||||||
|
<th>По</th>
|
||||||
|
<th>Статус</th>
|
||||||
|
<th>Цена</th>
|
||||||
|
<th>Действие</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($type->availabilities as $period)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $period->start_date }}</td>
|
||||||
|
<td>{{ $period->end_date }}</td>
|
||||||
|
<td>
|
||||||
|
@if($period->is_available)
|
||||||
|
<span style="color:green;">Доступен</span>
|
||||||
|
@else
|
||||||
|
<span style="color:red;">Недоступен</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>{{ $period->price ? number_format($period->price, 2) : '-' }}</td>
|
||||||
|
<td>
|
||||||
|
<form method="POST" action="/admin/availability/{{ $period->id }}" style="display:inline;">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-danger" style="padding:4px 8px; font-size:0.8rem;" onclick="return confirm('Удалить период?')">
|
||||||
|
Удалить
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.querySelectorAll('.availability-form').forEach(form => {
|
||||||
|
form.addEventListener('submit', async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const formData = new FormData(form);
|
||||||
|
const roomTypeId = form.dataset.roomTypeId;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`/admin/room-types/${roomTypeId}/availability`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData,
|
||||||
|
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
location.reload(); // Обновить модалку
|
||||||
|
} else {
|
||||||
|
alert('Ошибка сохранения');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
alert('Ошибка сети');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
32
resources/views/admin/hotels/create.blade.php
Normal file
32
resources/views/admin/hotels/create.blade.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
@extends('admin.layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div style="max-width: 600px;">
|
||||||
|
<h1>Добавить отель</h1>
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('admin.hotels.store') }}">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div style="margin-bottom: 15px;">
|
||||||
|
<label for="name" style="display: block; margin-bottom: 6px; font-weight: 500;">Название *</label>
|
||||||
|
<input type="text" name="name" id="name" required
|
||||||
|
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 15px;">
|
||||||
|
<label for="address" style="display: block; margin-bottom: 6px; font-weight: 500;">Адрес</label>
|
||||||
|
<textarea name="address" id="address" rows="3"
|
||||||
|
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 20px;">
|
||||||
|
<label for="phone" style="display: block; margin-bottom: 6px; font-weight: 500;">Телефон</label>
|
||||||
|
<input type="text" name="phone" id="phone"
|
||||||
|
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn">Сохранить</button>
|
||||||
|
<a href="{{ route('admin.hotels.index') }}" class="btn" style="background: #6a1b9a; margin-left: 10px;">Отмена</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endsections
|
||||||
33
resources/views/admin/hotels/edit.blade.php
Normal file
33
resources/views/admin/hotels/edit.blade.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
@extends('admin.layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div style="max-width: 600px;">
|
||||||
|
<h1>Редактировать отель</h1>
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('admin.hotels.update', $hotel) }}">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
|
||||||
|
<div style="margin-bottom: 15px;">
|
||||||
|
<label for="name" style="display: block; margin-bottom: 6px; font-weight: 500;">Название *</label>
|
||||||
|
<input type="text" name="name" id="name" value="{{ old('name', $hotel->name) }}" required
|
||||||
|
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 15px;">
|
||||||
|
<label for="address" style="display: block; margin-bottom: 6px; font-weight: 500;">Адрес</label>
|
||||||
|
<textarea name="address" id="address" rows="3"
|
||||||
|
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">{{ old('address', $hotel->address) }}</textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 20px;">
|
||||||
|
<label for="phone" style="display: block; margin-bottom: 6px; font-weight: 500;">Телефон</label>
|
||||||
|
<input type="text" name="phone" id="phone" value="{{ old('phone', $hotel->phone) }}"
|
||||||
|
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn">Сохранить</button>
|
||||||
|
<a href="{{ route('admin.hotels.index') }}" class="btn" style="background: #6a1b9a; margin-left: 10px;">Отмена</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
88
resources/views/admin/hotels/index.blade.php
Normal file
88
resources/views/admin/hotels/index.blade.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
@extends('admin.layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div>
|
||||||
|
<h1>Отели</h1>
|
||||||
|
|
||||||
|
<a href="{{ route('admin.hotels.create') }}" class="btn">Добавить отель</a>
|
||||||
|
|
||||||
|
@if($hotels->isEmpty())
|
||||||
|
<p>Нет отелей.</p>
|
||||||
|
@else
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Название</th>
|
||||||
|
<th>Адрес</th>
|
||||||
|
<th>Телефон</th>
|
||||||
|
<th>Действия</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($hotels as $hotel)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $hotel->name }}</td>
|
||||||
|
<td>{{ $hotel->address ?? '-' }}</td>
|
||||||
|
<td>{{ $hotel->phone ?? '-' }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ route('admin.hotels.edit', $hotel) }}" class="btn" style="margin-right: 5px;">
|
||||||
|
Редактировать
|
||||||
|
</a>
|
||||||
|
<form action="{{ route('admin.hotels.destroy', $hotel) }}" method="POST" style="display: inline;">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-danger" style="margin-right: 5px;" onclick="return confirm('Удалить отель?')">
|
||||||
|
Удалить
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<!-- Кнопка шахматки -->
|
||||||
|
<button type="button" class="btn btn-secondary open-calendar-modal" data-hotel-id="{{ $hotel->id }}">
|
||||||
|
Календарь
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Модальное окно для шахматки -->
|
||||||
|
<div id="calendarModal" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:1000;">
|
||||||
|
<div style="background:white;margin:50px auto;padding:25px;border-radius:8px;max-width:800px;box-shadow:0 4px 20px rgba(0,0,0,0.3);">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;">
|
||||||
|
<h2>Доступные даты: <span id="modalHotelName"></span></h2>
|
||||||
|
<button id="closeCalendarModal" style="background:none;border:none;font-size:1.5rem;cursor:pointer;">×</button>
|
||||||
|
</div>
|
||||||
|
<div id="calendarModalContent">Загрузка...</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const modal = document.getElementById('calendarModal');
|
||||||
|
const closeModalBtn = document.getElementById('closeCalendarModal');
|
||||||
|
|
||||||
|
document.querySelectorAll('.open-calendar-modal').forEach(button => {
|
||||||
|
button.addEventListener('click', async function () {
|
||||||
|
const hotelId = this.dataset.hotelId;
|
||||||
|
const hotelName = this.closest('tr').querySelector('td:first-child').textContent;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`/admin/hotels/${hotelId}/calendar`, {
|
||||||
|
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||||
|
});
|
||||||
|
document.getElementById('modalHotelName').textContent = hotelName;
|
||||||
|
document.getElementById('calendarModalContent').innerHTML = await response.text();
|
||||||
|
modal.style.display = 'block';
|
||||||
|
} catch (e) {
|
||||||
|
alert('Ошибка загрузки шахматки');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
closeModalBtn.onclick = () => modal.style.display = 'none';
|
||||||
|
window.onclick = (e) => { if (e.target === modal) modal.style.display = 'none'; };
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
91
resources/views/admin/layout.blade.php
Normal file
91
resources/views/admin/layout.blade.php
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>@yield('title', 'Админка')</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.wrapper {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
background-color: #4a148c;
|
||||||
|
color: white;
|
||||||
|
padding: 15px 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
nav a {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
nav a:hover {
|
||||||
|
background-color: #6a1b9a;
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
background: white;
|
||||||
|
padding: 25px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #4a148c;
|
||||||
|
color: white;
|
||||||
|
padding: 8px 16px;
|
||||||
|
text-decoration: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
.btn:hover { background-color: #6a1b9a; }
|
||||||
|
.btn-secondary { background-color: #7b1fa2; }
|
||||||
|
.btn-secondary:hover { background-color: #9c27b0; }
|
||||||
|
.btn-danger { background-color: #000000; }
|
||||||
|
.btn-danger:hover { background-color: #212121; }
|
||||||
|
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
|
||||||
|
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #eaeaea; }
|
||||||
|
th { background-color: #f1f1f1; font-weight: 600; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrapper">
|
||||||
|
<header>
|
||||||
|
<nav>
|
||||||
|
<a href="{{ route('admin.hotels.index') }}">Отели</a>
|
||||||
|
<form action="{{ route('admin.logout') }}" method="POST" style="display: inline;">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" style="background: none; border: none; color: white; cursor: pointer;">Выйти</button>
|
||||||
|
</form>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
@if(session('success'))
|
||||||
|
<div style="padding:12px;background:#e0f0e0;color:#2d5d2d;border-left:4px solid #4caf50;margin:16px 0;border-radius:4px;">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@yield('content')
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
30
resources/views/admin/login.blade.php
Normal file
30
resources/views/admin/login.blade.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
@extends('admin.layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div style="max-width: 400px; margin: 0 auto;">
|
||||||
|
<h2>Вход в админку</h2>
|
||||||
|
|
||||||
|
@if ($errors->any())
|
||||||
|
<div style="background: #ffeaea; color: #c0392b; padding: 12px; border-radius: 4px; margin-bottom: 20px;">
|
||||||
|
Неверные данные.
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('admin.login') }}">
|
||||||
|
@csrf
|
||||||
|
<div style="margin-bottom: 15px;">
|
||||||
|
<label for="email" style="display: block; margin-bottom: 6px;">Email</label>
|
||||||
|
<input type="email" name="email" id="email" required
|
||||||
|
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;" value="{{ old('email') }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 20px;">
|
||||||
|
<label for="password" style="display: block; margin-bottom: 6px;">Пароль</label>
|
||||||
|
<input type="password" name="password" id="password" required
|
||||||
|
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn" style="width: 100%;">Войти</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
19
resources/views/invoices/template.blade.php
Normal file
19
resources/views/invoices/template.blade.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Счёт №{{ $invoice->id }}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Счёт №{{ $invoice->id }}</h1>
|
||||||
|
<p>Дата выписки: {{ $invoice->issued_at->format('d.m.Y') }}</p>
|
||||||
|
<p>Срок оплаты: {{ $invoice->due_date->format('d.m.Y') }}</p>
|
||||||
|
|
||||||
|
<h2>Бронирование</h2>
|
||||||
|
<p>Гость: {{ $booking->guest_name }}</p>
|
||||||
|
<p>Тип номера: {{ $roomType->name }}</p>
|
||||||
|
<p>Даты: {{ $booking->check_in }} — {{ $booking->check_out }}</p>
|
||||||
|
|
||||||
|
<h2>Сумма</h2>
|
||||||
|
<p>{{ number_format($invoice->amount, 2, ',', ' ') }} ₽</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,24 +1,69 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\UsersController;
|
|
||||||
use Hamcrest\Number\OrderingComparison;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use App\Http\Controllers\AdminAuthController;
|
||||||
use App\Http\Controllers\OrdersController;
|
use App\Http\Controllers\OrdersController;
|
||||||
|
use App\Http\Controllers\RoomTypesController;
|
||||||
|
use App\Http\Controllers\HotelController;
|
||||||
|
use App\Http\Controllers\RoomAvailabilityController;
|
||||||
|
use App\Http\Controllers\BookingController;
|
||||||
|
use App\Http\Controllers\InvoiceController;
|
||||||
|
|
||||||
Route::get(uri: '/user', action: function (Request $request): mixed {
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
|
Route::post('/hotels', [HotelController::class, 'store']);
|
||||||
|
Route::get('/hotels', [HotelController::class, 'index']);
|
||||||
|
Route::get('/hotels/{id}', [HotelController::class, 'show']);
|
||||||
|
Route::put('/hotels/{id}', [HotelController::class, 'update']);
|
||||||
|
Route::delete('/hotels/{id}', [HotelController::class, 'destroy']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::get('/hotels/{hotel}/room-types', function ($hotelId) {
|
||||||
|
return \App\Models\RoomType::where('hotel_id', $hotelId)->get(['id', 'name']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::post('/admin/login', [AdminAuthController::class, 'login']);
|
||||||
|
Route::post('/admin/logout', [AdminAuthController::class, 'logout'])->middleware('auth:sanctum');
|
||||||
|
|
||||||
|
Route::middleware('auth:admin')->prefix('admin')->group(function () {
|
||||||
|
Route::get('/dashboard', function () {
|
||||||
|
return response()->json(['message' => 'Welcome to admin dashboard']);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
|
Route::get('/user', function (\Illuminate\Http\Request $request) {
|
||||||
return $request->user();
|
return $request->user();
|
||||||
})->middleware(middleware: 'auth:sanctum');
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Route::get(uri: '/orders', action: [OrdersController::class, 'index']);
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
|
Route::get('/hotels/{id}/rooms', [RoomTypeController::class, 'index']);
|
||||||
|
Route::post('/hotels/{hotelId}/room-types', [RoomTypeController::class, 'store']);
|
||||||
|
Route::put('/room-types/{id}', [RoomTypeController::class, 'update']);
|
||||||
|
Route::delete('/room-types/{id}', [RoomTypeController::class, 'destroy']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
|
Route::get('/room-types/{id}/availability', [RoomAvailabilityController::class, 'index']);
|
||||||
|
Route::post('/room-types/{id}/availability/bulk', [RoomAvailabilityController::class, 'bulkUpdate']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
|
Route::post('/bookings/{id}/invoice', [InvoiceController::class, 'generate']);
|
||||||
|
});
|
||||||
|
|
||||||
Route::get( 'orders', [OrdersController::class, 'index']);
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
Route::post('orders', [OrdersController::class, 'create']);
|
Route::post('/bookings', [BookingController::class, 'store']);
|
||||||
|
});
|
||||||
|
|
||||||
Route::get( 'room_types', [RoomTypesController::class, 'index']);
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
//Route::get( 'availabilite', [HotelsController::class, 'index']);
|
Route::post('/bookings/{id}/confirm', [BookingController::class, 'confirm']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
|
Route::post('/bookings/{id}/cancel', [BookingController::class, 'cancel']);
|
||||||
|
});
|
||||||
|
|
||||||
Route::post('users', [UsersController::class, 'create']);
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
|
Route::get('/bookings', [BookingController::class, 'index']);
|
||||||
|
});
|
||||||
@@ -1,7 +1,36 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use App\Http\Controllers\Admin\HotelController;
|
||||||
|
use App\Http\Controllers\Admin\AuthController;
|
||||||
|
|
||||||
Route::get('/', function () {
|
// Вход
|
||||||
return view('welcome');
|
Route::get('/admin/login', [\App\Http\Controllers\Admin\AuthController::class, 'showLoginForm'])->name('admin.login.form');
|
||||||
|
Route::post('/admin/login', [\App\Http\Controllers\Admin\AuthController::class, 'login'])->name('admin.login');
|
||||||
|
|
||||||
|
// Админка (требует авторизации)
|
||||||
|
Route::middleware('auth')->prefix('admin')->group(function () {
|
||||||
|
// Отели
|
||||||
|
Route::get('/hotels', [\App\Http\Controllers\Admin\HotelController::class, 'index'])->name('admin.hotels.index');
|
||||||
|
Route::get('/hotels/create', [\App\Http\Controllers\Admin\HotelController::class, 'create'])->name('admin.hotels.create');
|
||||||
|
Route::post('/hotels', [\App\Http\Controllers\Admin\HotelController::class, 'store'])->name('admin.hotels.store');
|
||||||
|
Route::get('/hotels/{hotel}/edit', [\App\Http\Controllers\Admin\HotelController::class, 'edit'])->name('admin.hotels.edit');
|
||||||
|
Route::put('/hotels/{hotel}', [\App\Http\Controllers\Admin\HotelController::class, 'update'])->name('admin.hotels.update');
|
||||||
|
Route::delete('/hotels/{hotel}', [\App\Http\Controllers\Admin\HotelController::class, 'destroy'])->name('admin.hotels.destroy');
|
||||||
|
// Шахматка для отеля
|
||||||
|
Route::get('/hotels/{hotelId}/calendar', [\App\Http\Controllers\Admin\HotelController::class, 'calendar'])->name('admin.hotels.calendar');
|
||||||
|
// Сохранение периода
|
||||||
|
Route::post('/room-types/{roomType}/availability', [\App\Http\Controllers\Admin\AvailabilityController::class, 'store'])->name('admin.availability.store');
|
||||||
|
// Удаление периода
|
||||||
|
Route::delete('/availability/{availability}', [\App\Http\Controllers\Admin\AvailabilityController::class, 'destroy'])->name('admin.availability.destroy');
|
||||||
|
// Бронирования
|
||||||
|
Route::get('/bookings/create', [\App\Http\Controllers\Admin\BookingController::class, 'create'])->name('admin.bookings.create');
|
||||||
|
Route::post('/bookings', [\App\Http\Controllers\Admin\BookingController::class, 'store'])->name('admin.bookings.store');
|
||||||
|
|
||||||
|
// Выход
|
||||||
|
Route::post('/logout', [\App\Http\Controllers\Admin\AuthController::class, 'logout'])->name('admin.logout');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Вход
|
||||||
|
Route::get('/admin/login', [\App\Http\Controllers\Admin\AuthController::class, 'showLoginForm'])->name('admin.login.form');
|
||||||
|
Route::post('/admin/login', [\App\Http\Controllers\Admin\AuthController::class, 'login'])->name('admin.login');
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { defineConfig } from 'vite';
|
|
||||||
import laravel from 'laravel-vite-plugin';
|
|
||||||
import tailwindcss from '@tailwindcss/vite';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [
|
|
||||||
laravel({
|
|
||||||
input: ['resources/css/app.css', 'resources/js/app.js'],
|
|
||||||
refresh: true,
|
|
||||||
}),
|
|
||||||
tailwindcss(),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user