reupload
This commit is contained in:
51
app/Models/Legal/LegalPage.php
Normal file
51
app/Models/Legal/LegalPage.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Legal;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class LegalPage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected $table = 'legal_pages';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'title',
|
||||
'content',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* Translatable fields
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
public $translatable = ['title', 'content'];
|
||||
|
||||
/**
|
||||
* Retrieve the model for a bound value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|null $field
|
||||
* @return \Illuminate\Database\Eloquent\Model|null
|
||||
*/
|
||||
public function resolveRouteBinding($value, $field = null)
|
||||
{
|
||||
return $this->where('slug', $value)
|
||||
->where('is_active', true)
|
||||
->firstOrFail();
|
||||
}
|
||||
}
|
||||
74
app/Models/Legal/User/EntrepreneurDocs.php
Normal file
74
app/Models/Legal/User/EntrepreneurDocs.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Legal\User;
|
||||
|
||||
use App\Models\Concerns\HasSchemalessAttributes;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class EntrepreneurDocs extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasSchemalessAttributes;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected $table = 'entrepreneur_docs';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'corporation_type',
|
||||
'corporation_name',
|
||||
'options',
|
||||
'user_id',
|
||||
];
|
||||
|
||||
/**
|
||||
* Translatable fields
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
public $translatable = ['corporation_name'];
|
||||
|
||||
/**
|
||||
* User, Document owner, Entrepreneur
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatted corporation type
|
||||
*/
|
||||
protected function formattedCorporationType(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => match ($this->corporation_type) {
|
||||
'hk' => __('Private enterprise'),
|
||||
'hj' => __('Partnership enterprise'),
|
||||
default => __('Entrepreneur')
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Corporatoin name full name: "Web ulgam" HJ
|
||||
*/
|
||||
protected function formattedCorporationName(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => $this->corporation_name.' '.$this->formatted_corporation_type
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user