first commit
This commit is contained in:
32
app/Console/Kernel.php
Executable file
32
app/Console/Kernel.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
41
app/Exceptions/Handler.php
Executable file
41
app/Exceptions/Handler.php
Executable file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
20
app/Helpers/functions.php
Executable file
20
app/Helpers/functions.php
Executable file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
if(!function_exists('slider_file_path')){
|
||||
|
||||
function slider_file_path()
|
||||
{
|
||||
return \App\Models\Slider::FILE_PATH;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!function_exists('post_file_path')){
|
||||
|
||||
function post_file_path()
|
||||
{
|
||||
return \App\Models\Post::FILE_PATH;
|
||||
}
|
||||
|
||||
}
|
||||
|
48
app/Http/Controllers/Admin/CountryController.php
Executable file
48
app/Http/Controllers/Admin/CountryController.php
Executable file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Country;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CountryController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$countries = Country::orderBy('id','desc')->get();
|
||||
|
||||
return view('admin.country.index', compact('countries'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('admin.country.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
Country::create();
|
||||
|
||||
return redirect()->route('admin.countries.index')->with('success','country has been created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Country $country)
|
||||
{
|
||||
return view('admin.country.edit',compact('country'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Country $country)
|
||||
{
|
||||
$country->updated_at = time();
|
||||
$country->save();
|
||||
|
||||
return redirect()->route('admin.countries.index')->with('success','country Has Been updated successfully');
|
||||
}
|
||||
|
||||
public function destroy(Country $country)
|
||||
{
|
||||
$country->delete();
|
||||
return redirect()->route('admin.countries.index')->with('success','country has been deleted successfully');
|
||||
}
|
||||
}
|
145
app/Http/Controllers/Admin/PostController.php
Executable file
145
app/Http/Controllers/Admin/PostController.php
Executable file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\PostStoreRequest;
|
||||
use App\Models\Localization;
|
||||
use App\Models\Post;
|
||||
use App\Models\PostTranslation;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PostController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$posts = Post::with('translations')->latest()->get();
|
||||
|
||||
return view('admin.posts.index', compact('posts'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$localizations = Cache::get('localizations');
|
||||
return view('admin.posts.create', compact('localizations'));
|
||||
}
|
||||
|
||||
public function store(PostStoreRequest $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
try{
|
||||
DB::transaction(function() use ($request) {
|
||||
if ($request->hasFile('image')) {
|
||||
$data['image'] = $this->fileUpload($request->file('image'));
|
||||
}
|
||||
|
||||
$localizationId=Localization::first()->id;
|
||||
|
||||
$data['slug']=\Str::slug($request->translations[$localizationId]['title']);
|
||||
|
||||
$post=Post::create($data);
|
||||
|
||||
foreach($request->translations as $key=>$value){
|
||||
$post->translations()->create([
|
||||
'localization_id'=>$key,
|
||||
'title'=>$value['title'],
|
||||
'description'=>$value['description'],
|
||||
'body'=>$value['body'],
|
||||
]);
|
||||
}
|
||||
});
|
||||
}catch(\Exception $e){
|
||||
return redirect()->back()->with('error', $e->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('admin.posts.index')->with('success', 'Новость создан успешно !');
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function show(Post $post)
|
||||
{
|
||||
$localizations = Cache::get('localizations');
|
||||
return view('admin.posts.show', compact('post','localizations'));
|
||||
}
|
||||
|
||||
public function edit(Post $post)
|
||||
{
|
||||
$localizations = Cache::get('localizations');
|
||||
|
||||
return view('admin.posts.edit', compact('localizations', 'post'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Post $post)
|
||||
{
|
||||
$request->validate([
|
||||
'translations'=>'required',
|
||||
]);
|
||||
|
||||
try{
|
||||
|
||||
DB::transaction(function() use ($request,$post){
|
||||
$data = $request->all();
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
$data['image'] = $this->fileUpload($request->file('image'));
|
||||
}
|
||||
|
||||
$localizationId=Localization::first()->id;
|
||||
|
||||
$data['slug']=\Str::slug($request->translations[$localizationId]['title']);
|
||||
|
||||
$post->update($data);
|
||||
|
||||
foreach($request->translations as $key=>$value){
|
||||
$post->translations()->updateOrCreate(['id'=>$value['id']],[
|
||||
'localization_id'=>$key,
|
||||
'title'=>$value['title'],
|
||||
'description'=>$value['description'],
|
||||
'body'=>$value['body'],
|
||||
]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}catch(\Exception $e){
|
||||
return redirect()->back()->with('error', $e->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('admin.posts.index')->with('success', 'Новость обновлен успешно !');
|
||||
|
||||
}
|
||||
|
||||
public function destroy(Post $post)
|
||||
{
|
||||
$post->delete();
|
||||
return redirect()->route('admin.posts.index')->with('success', 'Новость удален успешно !');
|
||||
}
|
||||
|
||||
public function fileUpload($file)
|
||||
{
|
||||
$filename = time().'_'.$file->getClientOriginalName();
|
||||
$file->move(public_path(Post::FILE_PATH), $filename);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
public function storeImage(Request $request)
|
||||
{
|
||||
if ($request->hasFile('upload')) {
|
||||
$fileName = time().'_'.$request->file('upload')->getClientOriginalName();
|
||||
$request->file('upload')->move(public_path(Post::FILE_PATH), $fileName);
|
||||
|
||||
$CKEditorFuncNum = $request->input('CKEditorFuncNum');
|
||||
$url = asset(Post::FILE_PATH.$fileName);
|
||||
$msg = 'Image uploaded successfully';
|
||||
$response = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url', '$msg')</script>";
|
||||
|
||||
@header('Content-type: text/html; charset=utf-8');
|
||||
echo $response;
|
||||
}
|
||||
}
|
||||
}
|
104
app/Http/Controllers/Admin/ProjectController.php
Executable file
104
app/Http/Controllers/Admin/ProjectController.php
Executable file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Project;
|
||||
use App\Models\Region;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProjectController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$projects = Project::orderBy('id', 'desc')->get();
|
||||
|
||||
return view('admin.project.index', compact('projects'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$regions = Region::all();
|
||||
|
||||
return view('admin.project.create', compact('regions'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'region_id' => 'required',
|
||||
'apartments' => 'required',
|
||||
'floors' => 'required',
|
||||
'card_image' => 'required|image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'background_image' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'logo' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'yard_image' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'hall_image' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'slug' => 'required|unique:projects',
|
||||
]);
|
||||
$project = new Project();
|
||||
$project->fill($request->post());
|
||||
if ($request->post('status') == null) {
|
||||
$project->status = 1;
|
||||
}
|
||||
$project->card_image = $this->uploadImage('card_image', $request);
|
||||
$project->background_image = $this->uploadImage('background_image', $request);
|
||||
$project->logo = $this->uploadImage('logo', $request);
|
||||
$project->yard_image = $this->uploadImage('yard_image', $request);
|
||||
$project->hall_image = $this->uploadImage('hall_image', $request);
|
||||
|
||||
$project->save();
|
||||
|
||||
return redirect()->route('admin.projects.index')->with('success', 'project has been created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Project $project)
|
||||
{
|
||||
$regions = Region::all();
|
||||
|
||||
return view('admin.project.edit', compact('project', 'regions'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Project $project)
|
||||
{
|
||||
$request->validate([
|
||||
'region_id' => 'required',
|
||||
'apartments' => 'required',
|
||||
'floors' => 'required',
|
||||
'card_image' => 'image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'background_image' => 'image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'logo' => 'image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'yard_image' => 'image|mimes:jpeg,png,jpg,gif,svg',
|
||||
'hall_image' => 'image|mimes:jpeg,png,jpg,gif,svg',
|
||||
]);
|
||||
|
||||
$project->fill($request->post());
|
||||
if ($request->post('status') == null) {
|
||||
$project->status = 1;
|
||||
}
|
||||
$project->card_image = $this->uploadImage('card_image', $request);
|
||||
$project->background_image = $this->uploadImage('background_image', $request);
|
||||
$project->logo = $this->uploadImage('logo', $request);
|
||||
$project->yard_image = $this->uploadImage('yard_image', $request);
|
||||
$project->hall_image = $this->uploadImage('hall_image', $request);
|
||||
|
||||
$project->save();
|
||||
|
||||
return redirect()->route('admin.projects.index')->with('success', 'project Has Been updated successfully');
|
||||
}
|
||||
|
||||
public function destroy(Project $project)
|
||||
{
|
||||
$project->delete();
|
||||
return redirect()->route('admin.projects.index')->with('success', 'project has been deleted successfully');
|
||||
}
|
||||
|
||||
public function uploadImage($attribute, $request)
|
||||
{
|
||||
if ($request->file($attribute)) {
|
||||
$request->file($attribute)->move(public_path() . '/uploads/images/', $request->file($attribute)->getClientOriginalName());
|
||||
|
||||
return $request->file($attribute)->getClientOriginalName();
|
||||
}
|
||||
}
|
||||
}
|
59
app/Http/Controllers/Admin/RegionController.php
Executable file
59
app/Http/Controllers/Admin/RegionController.php
Executable file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Country;
|
||||
use App\Models\Region;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RegionController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$regions = Region::orderBy('id','desc')->get();
|
||||
|
||||
return view('admin.region.index', compact('regions'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$countries = Country::all();
|
||||
|
||||
return view('admin.region.create', compact('countries'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'country_id' => 'required',
|
||||
]);
|
||||
Region::create($request->post());
|
||||
|
||||
return redirect()->route('admin.regions.index')->with('success','region has been created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Region $region)
|
||||
{
|
||||
$countries = Country::all();
|
||||
|
||||
return view('admin.region.edit',compact('region', 'countries'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Region $region)
|
||||
{
|
||||
$request->validate([
|
||||
'country_id' => 'required',
|
||||
]);
|
||||
|
||||
$region->fill($request->post())->save();
|
||||
|
||||
return redirect()->route('admin.regions.index')->with('success','regions Has Been updated successfully');
|
||||
}
|
||||
|
||||
public function destroy(Region $region)
|
||||
{
|
||||
$region->delete();
|
||||
return redirect()->route('admin.regions.index')->with('success','regions has been deleted successfully');
|
||||
}
|
||||
}
|
72
app/Http/Controllers/Admin/SliderController.php
Executable file
72
app/Http/Controllers/Admin/SliderController.php
Executable file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\SliderRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Slider;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class SliderController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$sliders = Slider::latest()->get();
|
||||
|
||||
return view('admin.sliders.index', compact('sliders'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('admin.sliders.create');
|
||||
}
|
||||
|
||||
public function store(SliderRequest $request): RedirectResponse
|
||||
{
|
||||
$data = $request->validated();
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
$data['image'] = $this->fileUpload($request->file('image'));
|
||||
}
|
||||
Slider::create($data);
|
||||
|
||||
return redirect()->route('admin.sliders.index')->with('success', 'Слайдер создан успешно !');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function edit(Slider $slider)
|
||||
{
|
||||
return view('admin.sliders.edit', compact('slider'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Slider $slider)
|
||||
{
|
||||
$data = $request->all();
|
||||
if ($request->hasFile('image')) {
|
||||
$data['image'] = $this->fileUpload($request->file('image'));
|
||||
}
|
||||
|
||||
$slider->update($data);
|
||||
|
||||
return redirect()->route('admin.sliders.index')->with('success', 'Слайдер обновлен успешно !');
|
||||
}
|
||||
|
||||
public function destroy(Slider $slider)
|
||||
{
|
||||
$slider->delete();
|
||||
return redirect()->route('admin.sliders.index')->with('success', 'Слайдер удален успешно !');
|
||||
}
|
||||
|
||||
public function fileUpload($file)
|
||||
{
|
||||
$filename = time().'_'.$file->getClientOriginalName();
|
||||
$file->move(public_path(Slider::FILE_PATH), $filename);
|
||||
return $filename;
|
||||
}
|
||||
}
|
40
app/Http/Controllers/Auth/ConfirmPasswordController.php
Executable file
40
app/Http/Controllers/Auth/ConfirmPasswordController.php
Executable file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password confirmations and
|
||||
| uses a simple trait to include the behavior. You're free to explore
|
||||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
22
app/Http/Controllers/Auth/ForgotPasswordController.php
Executable file
22
app/Http/Controllers/Auth/ForgotPasswordController.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
}
|
42
app/Http/Controllers/Auth/LoginController.php
Executable file
42
app/Http/Controllers/Auth/LoginController.php
Executable file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
|
||||
|
||||
}
|
73
app/Http/Controllers/Auth/RegisterController.php
Executable file
73
app/Http/Controllers/Auth/RegisterController.php
Executable file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\Models\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
30
app/Http/Controllers/Auth/ResetPasswordController.php
Executable file
30
app/Http/Controllers/Auth/ResetPasswordController.php
Executable file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
}
|
42
app/Http/Controllers/Auth/VerificationController.php
Executable file
42
app/Http/Controllers/Auth/VerificationController.php
Executable file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling email verification for any
|
||||
| user that recently registered with the application. Emails may also
|
||||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
13
app/Http/Controllers/Controller.php
Executable file
13
app/Http/Controllers/Controller.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
28
app/Http/Controllers/HomeController.php
Executable file
28
app/Http/Controllers/HomeController.php
Executable file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('home');
|
||||
}
|
||||
}
|
69
app/Http/Kernel.php
Executable file
69
app/Http/Kernel.php
Executable file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
\App\Http\Middleware\Localization::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\Localization::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
21
app/Http/Middleware/Authenticate.php
Executable file
21
app/Http/Middleware/Authenticate.php
Executable file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
17
app/Http/Middleware/EncryptCookies.php
Executable file
17
app/Http/Middleware/EncryptCookies.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
31
app/Http/Middleware/Localization.php
Executable file
31
app/Http/Middleware/Localization.php
Executable file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Localization
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if(empty(Cache::get('localizations'))){
|
||||
Cache::remember('localizations', 2000000, function () {
|
||||
return DB::table('localizations')->orderBy('id', 'desc')->get();
|
||||
});
|
||||
}
|
||||
|
||||
session(['locale_id'=>2]);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Executable file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
32
app/Http/Middleware/RedirectIfAuthenticated.php
Executable file
32
app/Http/Middleware/RedirectIfAuthenticated.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param string|null ...$guards
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
19
app/Http/Middleware/TrimStrings.php
Executable file
19
app/Http/Middleware/TrimStrings.php
Executable file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
20
app/Http/Middleware/TrustHosts.php
Executable file
20
app/Http/Middleware/TrustHosts.php
Executable file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Middleware/TrustProxies.php
Executable file
28
app/Http/Middleware/TrustProxies.php
Executable file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
17
app/Http/Middleware/VerifyCsrfToken.php
Executable file
17
app/Http/Middleware/VerifyCsrfToken.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
39
app/Http/Requests/PostStoreRequest.php
Executable file
39
app/Http/Requests/PostStoreRequest.php
Executable file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PostStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'translations'=>'required|array',
|
||||
'translations.*.title'=>'required|unique:post_translations',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'translations.*.title.required'=>'Поле обязательно для заполнения',
|
||||
'translations.*.title.unique'=>'Заголовок должен быть уникальным',
|
||||
];
|
||||
}
|
||||
}
|
30
app/Http/Requests/SliderRequest.php
Executable file
30
app/Http/Requests/SliderRequest.php
Executable file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SliderRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'image' => 'required|image|mimes:png,jpg,jpeg|max:10000',
|
||||
];
|
||||
}
|
||||
}
|
18
app/Models/Advantage.php
Executable file
18
app/Models/Advantage.php
Executable file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Advantage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['icon'];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(AdvantageTranslation::class);
|
||||
}
|
||||
}
|
13
app/Models/AdvantageTranslation.php
Executable file
13
app/Models/AdvantageTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdvantageTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['project_advantage_id','localization_id','title','description'];
|
||||
}
|
18
app/Models/Area.php
Executable file
18
app/Models/Area.php
Executable file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Area extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['room_type_id','name'];
|
||||
|
||||
public function flat()
|
||||
{
|
||||
return $this->hasOne(Flat::class);
|
||||
}
|
||||
}
|
23
app/Models/Company.php
Executable file
23
app/Models/Company.php
Executable file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Company extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['image'];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(CompanyTranslation::class);
|
||||
}
|
||||
|
||||
public function images()
|
||||
{
|
||||
return $this->hasMany(CompanyImage::class);
|
||||
}
|
||||
}
|
13
app/Models/CompanyImage.php
Executable file
13
app/Models/CompanyImage.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CompanyImage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['company_id','image'];
|
||||
}
|
13
app/Models/CompanyTranslation.php
Executable file
13
app/Models/CompanyTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CompanyTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['company_id','localization_id','title','body','second_block_title','second_block_text', 'booklet'];
|
||||
}
|
18
app/Models/Contact.php
Executable file
18
app/Models/Contact.php
Executable file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Contact extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['phone','email','location','facebook','instagram','whatsapp','vk','youtube'];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(ContactTranslation::class);
|
||||
}
|
||||
}
|
13
app/Models/ContactTranslation.php
Executable file
13
app/Models/ContactTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContactTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['contact_id','localization_id','address'];
|
||||
}
|
19
app/Models/Country.php
Executable file
19
app/Models/Country.php
Executable file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Country extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=[];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(CountryTranslation::class);
|
||||
}
|
||||
|
||||
}
|
13
app/Models/CountryTranslation.php
Executable file
13
app/Models/CountryTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CountryTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['country_id','localization_id','name'];
|
||||
}
|
22
app/Models/Event.php
Executable file
22
app/Models/Event.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Event extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['project_id','image','date'];
|
||||
|
||||
protected $casts = [
|
||||
'date' => 'date:d.m.Y',
|
||||
];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(EventTranslation::class);
|
||||
}
|
||||
}
|
13
app/Models/EventTranslation.php
Executable file
13
app/Models/EventTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EventTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['event_id','localization_id','title','description'];
|
||||
}
|
29
app/Models/Flat.php
Executable file
29
app/Models/Flat.php
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Flat extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['project_id','area_id','floor_number','price','price_for_m2','image','number'];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(FlatTranslation::class);
|
||||
}
|
||||
|
||||
public function images()
|
||||
{
|
||||
return $this->hasMany(FlatImage::class);
|
||||
}
|
||||
|
||||
public function area()
|
||||
{
|
||||
return $this->belongsTo(Area::class);
|
||||
}
|
||||
|
||||
}
|
14
app/Models/FlatImage.php
Executable file
14
app/Models/FlatImage.php
Executable file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FlatImage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['flat_id','image'];
|
||||
|
||||
}
|
13
app/Models/FlatTranslation.php
Executable file
13
app/Models/FlatTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FlatTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['flat_id','localization_id','name','description','place','room_number','body'];
|
||||
}
|
13
app/Models/Lead.php
Executable file
13
app/Models/Lead.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Lead extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['name','phone','project'];
|
||||
}
|
14
app/Models/Localization.php
Executable file
14
app/Models/Localization.php
Executable file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Localization extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['name'];
|
||||
|
||||
}
|
45
app/Models/Post.php
Executable file
45
app/Models/Post.php
Executable file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class Post extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['image','slug'];
|
||||
|
||||
const FILE_PATH = '/admin/images/posts/';
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::deleting(function($item){
|
||||
if(file_exists(self::FILE_PATH.$item->image)){
|
||||
unlink(self::FILE_PATH.$item->image);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(PostTranslation::class);
|
||||
}
|
||||
|
||||
public function getTranslatedAttributes($localeId)
|
||||
{
|
||||
return $this->translations->where('localization_id', $localeId)->first();
|
||||
}
|
||||
|
||||
|
||||
protected function title(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => $this->translations->where('localization_id', session('locale_id'))->first()->title
|
||||
);
|
||||
}
|
||||
}
|
13
app/Models/PostTranslation.php
Executable file
13
app/Models/PostTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PostTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['post_id','localization_id','title','description','body'];
|
||||
}
|
18
app/Models/Program.php
Executable file
18
app/Models/Program.php
Executable file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Program extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['image_card','image_background','slug','images'];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(ProgramTranslation::class);
|
||||
}
|
||||
}
|
13
app/Models/ProgramTranslation.php
Executable file
13
app/Models/ProgramTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProgramTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['program_id','localization_id','title','description','body'];
|
||||
}
|
50
app/Models/Project.php
Executable file
50
app/Models/Project.php
Executable file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Project extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['region_id','apartments','floors','card_image','background_image','logo','status','3d_tour_one','3d_tour_two','yard_image','hall_image','location','slug'];
|
||||
|
||||
protected $attributes=['status'=>1];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(AdvantageTranslation::class);
|
||||
}
|
||||
|
||||
public function region()
|
||||
{
|
||||
return $this->belongsTo(Region::class);
|
||||
}
|
||||
|
||||
public function flats()
|
||||
{
|
||||
return $this->hasMany(Flat::class);
|
||||
}
|
||||
|
||||
public function events()
|
||||
{
|
||||
return $this->hasMany(Event::class);
|
||||
}
|
||||
|
||||
public function roomTypes()
|
||||
{
|
||||
return $this->hasMany(RoomType::class);
|
||||
}
|
||||
|
||||
public function images()
|
||||
{
|
||||
return $this->hasMany(ProjectImage::class);
|
||||
}
|
||||
|
||||
public function advantages()
|
||||
{
|
||||
return $this->belongsToMany(ProjectAdvantage::class, 'project_advantages_project');
|
||||
}
|
||||
}
|
18
app/Models/ProjectAdvantage.php
Executable file
18
app/Models/ProjectAdvantage.php
Executable file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectAdvantage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['icon'];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(ProjectAdvantageTranslation::class);
|
||||
}
|
||||
}
|
13
app/Models/ProjectAdvantageTranslation.php
Executable file
13
app/Models/ProjectAdvantageTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectAdvantageTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['project_advantage_id','localization_id','title'];
|
||||
}
|
13
app/Models/ProjectImage.php
Executable file
13
app/Models/ProjectImage.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectImage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['project_id','image'];
|
||||
}
|
13
app/Models/ProjectTranslation.php
Executable file
13
app/Models/ProjectTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['project_id','localization_id','name','body','addres','yard_text','hall_text','booklet'];
|
||||
}
|
23
app/Models/Region.php
Executable file
23
app/Models/Region.php
Executable file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Region extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['country_id'];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(RegionTranslation::class);
|
||||
}
|
||||
|
||||
public function projects()
|
||||
{
|
||||
return $this->hasMany(Project::class);
|
||||
}
|
||||
}
|
13
app/Models/RegionTranslation.php
Executable file
13
app/Models/RegionTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RegionTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['region_id', 'localization_id', 'name'];
|
||||
}
|
29
app/Models/RoomType.php
Executable file
29
app/Models/RoomType.php
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoomType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['project_id'];
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(RoomTypeTranslation::class);
|
||||
}
|
||||
|
||||
public function areas()
|
||||
{
|
||||
return $this->hasMany(Area::class);
|
||||
}
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
}
|
13
app/Models/RoomTypeTranslation.php
Executable file
13
app/Models/RoomTypeTranslation.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoomTypeTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['room_type_id','localization_id','name'];
|
||||
}
|
31
app/Models/Slider.php
Executable file
31
app/Models/Slider.php
Executable file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Slider extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
const FILE_PATH = '/admin/images/sliders/';
|
||||
|
||||
protected $fillable=['image','url'];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
/**
|
||||
* Write code on Method
|
||||
*
|
||||
* @return response()
|
||||
*/
|
||||
|
||||
static::deleting(function($item){
|
||||
if(file_exists(self::FILE_PATH.$item->image)){
|
||||
unlink(self::FILE_PATH.$item->image);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
13
app/Models/Statistic.php
Executable file
13
app/Models/Statistic.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Statistic extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['num_projects','num_clients','year','area'];
|
||||
}
|
44
app/Models/User.php
Executable file
44
app/Models/User.php
Executable file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
}
|
29
app/Providers/AppServiceProvider.php
Executable file
29
app/Providers/AppServiceProvider.php
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Paginator::useBootstrap();
|
||||
}
|
||||
}
|
30
app/Providers/AuthServiceProvider.php
Executable file
30
app/Providers/AuthServiceProvider.php
Executable 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<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
21
app/Providers/BroadcastServiceProvider.php
Executable file
21
app/Providers/BroadcastServiceProvider.php
Executable file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
32
app/Providers/EventServiceProvider.php
Executable file
32
app/Providers/EventServiceProvider.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event 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()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
63
app/Providers/RouteServiceProvider.php
Executable file
63
app/Providers/RouteServiceProvider.php
Executable file
@ -0,0 +1,63 @@
|
||||
<?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 the "home" route for your application.
|
||||
*
|
||||
* This is used by Laravel authentication to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/admin/dashboard';
|
||||
|
||||
/**
|
||||
* The controller namespace for the application.
|
||||
*
|
||||
* When present, controller route declarations will automatically be prefixed with this namespace.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
// protected $namespace = 'App\\Http\\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.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());
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user