feat: add user enums and Persian validation messages
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum UserGender: int
|
||||
{
|
||||
case UNKNOWN =0;
|
||||
case MALE =1;
|
||||
case FEMALE =2;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum UserMarital:int
|
||||
{
|
||||
case SINGLE =0;
|
||||
case MARRIED =1;
|
||||
case DIVORCED =2;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum UserStatus: int
|
||||
{
|
||||
case DISABLE = 0;
|
||||
case ENABLE = 1;
|
||||
}
|
||||
+26
-9
@@ -8,8 +8,9 @@ namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticate;
|
||||
|
||||
/**
|
||||
* Class User
|
||||
@@ -17,7 +18,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property int $id
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property int $file_id
|
||||
* @property int|null $file_id
|
||||
* @property int|null $city_id
|
||||
* @property int|null $province_id
|
||||
* @property string $national_code
|
||||
* @property int $gender
|
||||
* @property int $marital_status
|
||||
@@ -26,19 +29,20 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property string $email
|
||||
* @property string $username
|
||||
* @property string $password
|
||||
* @property string|null $user_province
|
||||
* @property int|null $user_city
|
||||
* @property bool $status
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property string|null $deleted_at
|
||||
*
|
||||
* @property File $file
|
||||
* @property File|null $file
|
||||
* @property Province|null $province
|
||||
* @property City|null $city
|
||||
* @property Collection|Booking[] $bookings
|
||||
* @property Collection|Passenger[] $passengers
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class User extends Model
|
||||
class User extends Authenticate
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'users';
|
||||
@@ -46,9 +50,11 @@ class User extends Model
|
||||
|
||||
protected $casts = [
|
||||
'file_id' => 'int',
|
||||
'city_id' => 'int',
|
||||
'province_id' => 'int',
|
||||
'gender' => 'int',
|
||||
'marital_status' => 'int',
|
||||
'user_city' => 'int'
|
||||
'status' => 'bool'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
@@ -59,6 +65,8 @@ class User extends Model
|
||||
'first_name',
|
||||
'last_name',
|
||||
'file_id',
|
||||
'city_id',
|
||||
'province_id',
|
||||
'national_code',
|
||||
'gender',
|
||||
'marital_status',
|
||||
@@ -67,8 +75,7 @@ class User extends Model
|
||||
'email',
|
||||
'username',
|
||||
'password',
|
||||
'user_province',
|
||||
'user_city'
|
||||
'status'
|
||||
];
|
||||
|
||||
public function file()
|
||||
@@ -76,6 +83,16 @@ class User extends Model
|
||||
return $this->belongsTo(File::class);
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo(Province::class);
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo(City::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
|
||||
@@ -68,7 +68,7 @@ return [
|
||||
'string' => 'گزینه :attribute باید بزرگتر یا مساوی :value کاراکتر باشد',
|
||||
],
|
||||
'image' => 'گزینه :attribute باید از نوع تصویر باشد',
|
||||
'hex_color'=>'فیلد :attribute باید یک رنگ هگزادسیمال معتبر باشد.',
|
||||
'hex_color' => 'فیلد :attribute باید یک رنگ هگزادسیمال معتبر باشد.',
|
||||
'in' => 'گزینه انتخابی :attribute صحیح نمی باشد',
|
||||
'in_array' => 'گزینه :attribute در :other وجود ندارد',
|
||||
'integer' => 'گزینه :attribute باید از نوع عددی باشد',
|
||||
@@ -245,7 +245,14 @@ return [
|
||||
'value' => 'مقدار تنظیمات',
|
||||
'message' => 'متن پیام',
|
||||
'question' => 'سوال',
|
||||
'answer' => 'جواب'
|
||||
'answer' => 'جواب',
|
||||
'spouse_name' => 'مشخصات همسر',
|
||||
'marital_status' => 'وضعیت تاهل',
|
||||
'avatar' => 'تصویر',
|
||||
'province_id' => 'استان',
|
||||
'city_id' => 'شهر',
|
||||
'national_code' => 'کدملی'
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user