AttributeIlluminate\Database\Eloquent\Attributes\Table
#[Table]
In the Database / Eloquent group, #[Table] applies this configuration to the target Laravel element. It accepts 6 configuration parameters.
Available since
Laravel 13.0
Targets
class
Parameters
$name?stringDefines the "name" value used by the attribute. Expected type: ?string.
$key?stringKey used to resolve the value. Expected type: ?string.
$keyType?stringDefines the "keyType" value used by the attribute. Expected type: ?string.
$incrementing?boolDefines the "incrementing" value used by the attribute. Expected type: ?bool.
$timestamps?boolDefines the "timestamps" value used by the attribute. Expected type: ?bool.
$dateFormat?stringDefines the "dateFormat" value used by the attribute. Expected type: ?string.
Practical usage
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Attributes\Table;
#[Table('value', 'value', 'value', false, false, 'value')]
class Post extends Model
{
// ...
}