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 :: laravel in array blade 
Php :: laravel pagination with get parameters 
Php :: laravel redirect back with errors and input 
Php :: get woocommerce order details 
Php :: php expire session 
Php :: php copy 
Php :: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known 
Php :: laravel foreach first 
Php :: minus day from carbon date 
Php :: routing code in drupal 8 
Php :: laravel-medialibrary change name of file 
Php :: phpcs 
Php :: mysqli last index php 
Php :: add hour minute in datetime in php 
Php :: PHP (WordPress) - Increase Maximum Upload File Size 
Php :: wp get tagline php 
Php :: php replace all spaces with dashes 
Php :: guzzlehttp form data 
Php :: laravel translate 
Php :: calculate 18 years back date in php 
Php :: laravel query latest 
Php :: cloudflare ip country 
Php :: laravel redirect with message to section 
Php :: laravel force delete 
Php :: php var_export to string 
Php :: array unique php 
Php :: ubuntu install php 8 nginx 
Php :: how to send data from one website to another in php 
Php :: how to use plugin shortcode in wordpress template 
Php :: remove seconds from time php 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =