change the migration columns and add form request
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class AzmayeshField extends Model
|
||||
{
|
||||
@@ -12,8 +13,15 @@ class AzmayeshField extends Model
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected function option(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => json_decode($value),
|
||||
);
|
||||
}
|
||||
|
||||
public function azmayeshTypes(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(AzmayeshType::class);
|
||||
return $this->belongsToMany(AzmayeshType::class, 'azmayesh_field_azmayesh_type');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user