first commit
This commit is contained in:
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',
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user