Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel model casts

<?php

namespace AppModels;

use IlluminateDatabaseEloquentModel;

class User extends Model
{
    /**
     * The attributes that should be cast.
     *
     * @var array
     */
    protected $casts = [
        'options' => 'array',
    ];
}
Comment

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 */
Comment

casts laravel

class Project extends Model
{
    // ...

    protected $casts = [
        'config' => 'array',
    ];

    // ...
}
Comment

laravel casts

<?php
  
use IlluminateDatabaseEloquentCastsAsCollection;

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

PREVIOUS NEXT
Code Example
Php :: php proper function comments 
Php :: ubuntu apache php version 
Php :: static php 
Php :: laravel check if email is real 
Php :: excel return integer from date column laravel 
Php :: php array pop by value 
Php :: rename migration laravel 
Php :: php get item position in array 
Php :: laravel find duplicate rows 
Php :: php get screen size 
Php :: Change WordPress Login Logo Url 
Php :: maintenance mode laravel 
Php :: get recoed between two datetime laravel 
Php :: Access-Control-Allow-Origin php laravel 
Php :: select option edit in laravel 
Php :: how to make a comment in php 
Php :: laravel count distance lat/longtidue 
Php :: laravel elequent query 
Php :: get all sort by laravel 
Php :: Laravel - Query Builder Left join 
Php :: curl error (code 3) url malformed laravel 
Php :: wordpress autosave 
Php :: add brackets to string php 
Php :: database seeder laravel 
Php :: function inside model laravel 
Php :: dispatch job with queue name in laravel 
Php :: laravel create on model 
Php :: php try json decode and check 
Php :: find value in array php 
Php :: php image rotate upload 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =