master

laravel/framework

Last updated at: 29/12/2023 09:21

Castable.php

TLDR

The Castable.php file in the Illuminate\Contracts\Database\Eloquent namespace is an interface that defines a method castUsing which returns the name of the caster class to use when casting from/to a specific target.

Methods

castUsing

This method returns the name of the caster class that should be used when casting to/from a specific target.

END

<?php

namespace Illuminate\Contracts\Database\Eloquent;

interface Castable
{
    /**
     * Get the name of the caster class to use when casting from / to this cast target.
     *
     * @param  array  $arguments
     * @return class-string<CastsAttributes|CastsInboundAttributes>|CastsAttributes|CastsInboundAttributes
     */
    public static function castUsing(array $arguments);
}