1
0
mirror of https://github.com/robonen/metr.git synced 2026-03-20 02:44:42 +00:00

All models

This commit is contained in:
2022-05-26 11:20:47 +07:00
parent 3146fb1fd0
commit c4f98fdb58
14 changed files with 248 additions and 26 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Offer extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'owner_id',
'name',
'type',
'price',
'rooms',
'yandex_mark',
'text',
'is_group',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
// 'is_group' => 'boolean',
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OfferPhoto extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'offer_id',
'file',
];
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Order extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'offer_id',
'user_id',
'start_date',
'end_date',
'price',
'discount',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'start_date' => 'datetime',
'end_date' => 'datetime',
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Review extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'offer_id',
'user_id',
'comment',
'rating',
];
}

View File

@@ -2,7 +2,6 @@
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;
@@ -18,8 +17,12 @@ class User extends Authenticatable
* @var array<int, string>
*/
protected $fillable = [
'name',
'first_name',
'last_name',
'middle_name',
'email',
'phone',
'photo',
'password',
];
@@ -30,7 +33,6 @@ class User extends Authenticatable
*/
protected $hidden = [
'password',
'remember_token',
];
/**
@@ -38,7 +40,7 @@ class User extends Authenticatable
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
// protected $casts = [
// 'email_verified_at' => 'datetime',
// ];
}