“Laravel Casts” Code-Antworten

$ this-Attribut Laravel

To define a mutator, define a setFooAttribute method on your model where Foo
  is the "studly" cased name of the column you wish to access. So, again,
lets define a mutator for the first_name attribute. This mutator will
be automatically called when we attempt to set the value of the first_name
attribute on the model:

class User extends Model
{
    public function setFirstNameAttribute($value)
    {
        $this->attributes['first_name'] = strtolower($value);
    }
}
Lokesh003

Laravel Casts

<?php
  
use Illuminate\Database\Eloquent\Casts\AsCollection;

protected $casts = [
    'options' => AsCollection::class,
];
Tiago F2

Laravel Casts

/* array
AsStringable::class
boolean
collection
date
datetime
immutable_date
immutable_datetime
decimal:<digits>
double
encrypted
encrypted:array
encrypted:collection
encrypted:object
float
integer
object
real
string
timestamp */
Witness

Ähnliche Antworten wie “Laravel Casts”

Fragen ähnlich wie “Laravel Casts”

Weitere verwandte Antworten zu “Laravel Casts” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen