prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
ymfony\Component\Console\Output\OutputInterface; class Migrator { /** * The event dispatcher instance. * * @var \Illuminate\Contracts\Events\Dispatcher */ protected $events; /** * The migration repository implementation. * * @var \Illuminate\Database\Migrations\Migration...
minate\Database\ConnectionResolverInterface, ?string): \Illuminate\Database\Connection)|null */ protected static $connectionResolverCallback; /** * The name of the default connection. * * @var string */ protected $conn
* The connection resolver instance. * * @var \Illuminate\Database\ConnectionResolverInterface */ protected $resolver; /** * The custom connection resolver callback. * * @var (\Closure(\Illu
{ "filepath": "src/Illuminate/Database/Migrations/Migrator.php", "language": "php", "file_size": 24412, "cut_index": 1331, "middle_length": 229 }
nnections; use PDO; use Throwable; class Connector { use DetectsLostConnections; /** * The default PDO connection options. * * @var array */ protected $options = [ PDO::ATTR_CASE => PDO::CASE_NATURAL, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ORACLE...
ername, $password] = [ $config['username'] ?? null, $config['password'] ?? null, ]; try { return $this->createPdoConnection( $dsn, $username, $password, $options ); } catch (Excep
string $dsn * @param array $config * @param array $options * @return \PDO * * @throws \Exception */ public function createConnection($dsn, array $config, array $options) { [$us
{ "filepath": "src/Illuminate/Database/Connectors/Connector.php", "language": "php", "file_size": 3134, "cut_index": 614, "middle_length": 229 }
hPath; /** * The default PDO connection options. * * @var array */ protected $options = [ PDO::ATTR_CASE => PDO::CASE_NATURAL, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, PDO::ATTR_STRINGIFY_FETCHES => false, ...
$connection = $this->createConnection( $this->getDsn($config), $config, $this->getOptions($config) ); $this->configureIsolationLevel($connection, $config); // Next, we will check to see if a timezone has been specif
ate the basic DSN and connection instance connecting to the // using the configuration option specified by the developer. We will also // set the default character set on the connections to UTF-8 by default.
{ "filepath": "src/Illuminate/Database/Connectors/PostgresConnector.php", "language": "php", "file_size": 5945, "cut_index": 716, "middle_length": 229 }
. * * @var array */ protected $options = [ PDO::ATTR_CASE => PDO::CASE_NATURAL, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, PDO::ATTR_STRINGIFY_FETCHES => false, ]; /** * Establish a database connection. ...
* https://learn.microsoft.com/en-us/sql/t-sql/statements/set-transaction-isolation-level-transact-sql * * @param \PDO $connection * @param array $config * @return void */ protected function configureIsolationLevel($connecti
Connection($this->getDsn($config), $config, $options); $this->configureIsolationLevel($connection, $config); return $connection; } /** * Set the connection transaction isolation level. *
{ "filepath": "src/Illuminate/Database/Connectors/SqlServerConnector.php", "language": "php", "file_size": 6605, "cut_index": 716, "middle_length": 229 }
Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Collection as BaseCollection; class BroadcastableModelEventOccurred implements ShouldBroadcast { use InteractsWithSockets, SerializesModels; /** * T...
be used to queue the broadcast job. * * @var string */ public $connection; /** * The queue that should be used to queue the broadcast job. * * @var string */ public $queue; /** * Indicates whether t
* @var string */ protected $event; /** * The channels that the event should be broadcast on. * * @var array */ protected $channels = []; /** * The queue connection that should
{ "filepath": "src/Illuminate/Database/Eloquent/BroadcastableModelEventOccurred.php", "language": "php", "file_size": 3303, "cut_index": 614, "middle_length": 229 }
'torawsql', ]; /** * Applied global scopes. * * @var array */ protected $scopes = []; /** * Removed global scopes. * * @var array */ protected $removedScopes = []; /** * The callbacks that should be invoked after retrieving data from the databa...
query = $query; } /** * Create and return an un-saved model instance. * * @param array $attributes * @return TModel */ public function make(array $attributes = []) { return $this->newModelInstance($attrib
loneCallbacks = []; /** * Create a new Eloquent query builder instance. * * @param \Illuminate\Database\Query\Builder $query */ public function __construct(QueryBuilder $query) { $this->
{ "filepath": "src/Illuminate/Database/Eloquent/Builder.php", "language": "php", "file_size": 68428, "cut_index": 3790, "middle_length": 229 }
* @template TBuilder of \Illuminate\Database\Eloquent\Builder */ trait HasBuilder { /** * Begin querying the model. * * @return TBuilder */ public static function query() { return parent::query(); } /** * Create a new Eloquent query builder for the model. * ...
hat doesn't have any global scopes or eager loading. * * @return TBuilder */ public function newModelQuery() { return parent::newModelQuery(); } /** * Get a new query builder with no relationships loaded. *
; } /** * Get a new query builder for the model's table. * * @return TBuilder */ public function newQuery() { return parent::newQuery(); } /** * Get a new query builder t
{ "filepath": "src/Illuminate/Database/Eloquent/HasBuilder.php", "language": "php", "file_size": 2662, "cut_index": 563, "middle_length": 229 }
Connection; use Illuminate\Database\PostgresConnection; use Illuminate\Database\SQLiteConnection; use Illuminate\Database\SqlServerConnection; use Illuminate\Support\Arr; use InvalidArgumentException; use PDOException; class ConnectionFactory { /** * The IoC container instance. * * @var \Illuminate\...
* @param string|null $name * @return \Illuminate\Database\Connection */ public function make(array $config, $name = null) { $config = $this->parseConfig($config, $name); if (isset($config['read'])) { retu
ainer */ public function __construct(Container $container) { $this->container = $container; } /** * Establish a PDO connection based on the configuration. * * @param array $config
{ "filepath": "src/Illuminate/Database/Connectors/ConnectionFactory.php", "language": "php", "file_size": 8133, "cut_index": 716, "middle_length": 229 }
ception; class SQLiteConnector extends Connector implements ConnectorInterface { /** * Establish a database connection. * * @param array $config * @return \PDO */ public function connect(array $config) { $options = $this->getOptions($config); $path = $this->parse...
return $connection; } /** * Get the absolute database path. * * @param string $path * @return string * * @throws \Illuminate\Database\SQLiteDatabaseDoesNotExistException */ protected function pars
onfigureForeignKeyConstraints($connection, $config); $this->configureBusyTimeout($connection, $config); $this->configureJournalMode($connection, $config); $this->configureSynchronous($connection, $config);
{ "filepath": "src/Illuminate/Database/Connectors/SQLiteConnector.php", "language": "php", "file_size": 4354, "cut_index": 614, "middle_length": 229 }
function bootBroadcastsEvents() { static::created(function ($model) { $model->broadcastCreated(); }); static::updated(function ($model) { $model->broadcastUpdated(); }); if (method_exists(static::class, 'bootSoftDeletes')) { static::soft...
\Illuminate\Contracts\Broadcasting\HasBroadcastChannel|array|null $channels * @return \Illuminate\Broadcasting\PendingBroadcast */ public function broadcastCreated($channels = null) { return $this->broadcastIfBroadcastChannelsExi
}); } static::deleted(function ($model) { $model->broadcastDeleted(); }); } /** * Broadcast that the model was created. * * @param \Illuminate\Broadcasting\Channel|
{ "filepath": "src/Illuminate/Database/Eloquent/BroadcastsEvents.php", "language": "php", "file_size": 5796, "cut_index": 716, "middle_length": 229 }
te\Database\Eloquent; use Illuminate\Database\Eloquent\Attributes\CollectedBy; use ReflectionClass; /** * @template TCollection of \Illuminate\Database\Eloquent\Collection */ trait HasCollection { /** * The resolved collection class names by model. * * @var array<class-string<static>, class-strin...
te() ?? static::$collectionClass); $collection = new static::$resolvedCollectionClasses[static::class]($models); if (Model::isAutomaticallyEagerLoadingRelationships()) { $collection->withRelationshipAutoloading(); }
e\Database\Eloquent\Model> $models * @return TCollection */ public function newCollection(array $models = []) { static::$resolvedCollectionClasses[static::class] ??= ($this->resolveCollectionFromAttribu
{ "filepath": "src/Illuminate/Database/Eloquent/HasCollection.php", "language": "php", "file_size": 1645, "cut_index": 537, "middle_length": 229 }
is (\Illuminate\Contracts\Support\Arrayable<array-key, mixed>|array<mixed>) ? static : TModel|TFindDefault) */ public function find($key, $default = null) { if ($key instanceof Model) { $key = $key->getKey(); } if ($key instanceof Arrayable) { $key = $key->...
d $key * @return TModel * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException */ public function findOrFail($key) { $result = $this->find($key); if (is_array($key) && count($result) === count(array_u
eyName(), $key); } return Arr::first($this->items, fn ($model) => $model->getKey() == $key, $default); } /** * Find a model in the collection by key or throw an exception. * * @param mixe
{ "filepath": "src/Illuminate/Database/Eloquent/Collection.php", "language": "php", "file_size": 26087, "cut_index": 1331, "middle_length": 229 }
lements ConnectorInterface { /** * Establish a database connection. * * @param array $config * @return \PDO */ public function connect(array $config) { $dsn = $this->getDsn($config); $options = $this->getOptions($config); // We need to grab the PDO option...
connecting'])) { $connection->exec("use `{$config['database']}`;"); } $this->configureConnection($connection, $config); return $connection; } /** * Create a DSN string from a configuration. * *
the developers. $connection = $this->createConnection($dsn, $config, $options); if (! empty($config['database']) && (! isset($config['use_db_after_connecting']) || $config['use_db_after_
{ "filepath": "src/Illuminate/Database/Connectors/MySqlConnector.php", "language": "php", "file_size": 4538, "cut_index": 614, "middle_length": 229 }
e\Eloquent; use RuntimeException; class InvalidCastException extends RuntimeException { /** * The name of the affected Eloquent model. * * @var string */ public $model; /** * The name of the column. * * @var string */ public $column; /** * The name of...
ction __construct($model, $column, $castType) { $class = get_class($model); parent::__construct("Call to undefined cast [{$castType}] on column [{$column}] in model [{$class}]."); $this->model = $class; $this->column =
* @param string $castType */ public fun
{ "filepath": "src/Illuminate/Database/Eloquent/InvalidCastException.php", "language": "php", "file_size": 910, "cut_index": 547, "middle_length": 52 }
namespace Illuminate\Database\Eloquent; use Illuminate\Database\Events\ModelsPruned; use LogicException; trait MassPrunable { /** * Prune all prunable models in the database. * * @param int $chunkSize * @return int */ public function pruneAll(int $chunkSize = 1000) { $q...
$query->delete(); if ($count > 0) { event(new ModelsPruned(static::class, $total)); } } while ($count > 0); return $total; } /** * Get the prunable model query. * * @return \
nkSize); }); }); $total = 0; $softDeletable = static::isSoftDeletable(); do { $total += $count = $softDeletable ? $query->forceDelete() :
{ "filepath": "src/Illuminate/Database/Eloquent/MassPrunable.php", "language": "php", "file_size": 1228, "cut_index": 518, "middle_length": 229 }
yable; use InvalidArgumentException; use LogicException; /** * @implements Arrayable<string, mixed> * * @internal */ class ModelInfo implements Arrayable, ArrayAccess { /** * @template TModel of \Illuminate\Database\Eloquent\Model * * @param class-string<TModel> $class The model's fully-quali...
g, related: class-string<\Illuminate\Database\Eloquent\Model>}> $relations The relations defined on the model. * @param \Illuminate\Support\Collection<int, array{event: string, class: string}> $events The events that the model dispatches. *
pplies to the model. * @param \Illuminate\Support\Collection<int, array<string, mixed>> $attributes The attributes available on the model. * @param \Illuminate\Support\Collection<int, array{name: string, type: strin
{ "filepath": "src/Illuminate/Database/Eloquent/ModelInfo.php", "language": "php", "file_size": 4501, "cut_index": 614, "middle_length": 229 }
pace Illuminate\Database\Eloquent; use Illuminate\Database\RecordsNotFoundException; use Illuminate\Support\Arr; use function Illuminate\Support\enum_value; /** * @template TModel of \Illuminate\Database\Eloquent\Model */ class ModelNotFoundException extends RecordsNotFoundException { /** * Name of the af...
on setModel($model, $ids = []) { $this->model = $model; $this->ids = array_map(enum_value(...), Arr::wrap($ids)); $this->message = "No query results for model [{$model}]"; if ($this->ids !== []) { $this->m
cted $ids; /** * Set the affected Eloquent model and instance ids. * * @param class-string<TModel> $model * @param array<int, int|string>|int|string $ids * @return $this */ public functi
{ "filepath": "src/Illuminate/Database/Eloquent/ModelNotFoundException.php", "language": "php", "file_size": 1489, "cut_index": 524, "middle_length": 229 }
te\Database\Eloquent; use Illuminate\Contracts\Debug\ExceptionHandler; use Illuminate\Database\Events\ModelsPruned; use LogicException; use Throwable; trait Prunable { /** * Prune all prunable models in the database. * * @param int $chunkSize * @return int * * @throws \Throwable ...
$total++; } catch (Throwable $e) { $handler = app(ExceptionHandler::class); if ($handler) { $handler->report($e);
$query->withTrashed(); })->chunkById($chunkSize, function ($models) use (&$total) { $models->each(function ($model) use (&$total) { try { $model->prune();
{ "filepath": "src/Illuminate/Database/Eloquent/Prunable.php", "language": "php", "file_size": 1946, "cut_index": 537, "middle_length": 229 }
atabase\Eloquent\Builder<static> withTrashed(bool $withTrashed = true) * @method static \Illuminate\Database\Eloquent\Builder<static> onlyTrashed() * @method static \Illuminate\Database\Eloquent\Builder<static> withoutTrashed() * @method static static restoreOrCreate(array<string, mixed> $attributes = [], array<stri...
bootSoftDeletes() { static::addGlobalScope(new SoftDeletingScope); } /** * Initialize the soft deleting trait for an instance. * * @return void */ public function initializeSoftDeletes() { if (! isse
the model is currently force deleting. * * @var bool */ protected $forceDeleting = false; /** * Boot the soft deleting trait for a model. * * @return void */ public static function
{ "filepath": "src/Illuminate/Database/Eloquent/SoftDeletes.php", "language": "php", "file_size": 7936, "cut_index": 716, "middle_length": 229 }
\DatabaseManager; use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Support\Traits\CapsuleManagerTrait; use PDO; class Manager { use CapsuleManagerTrait; /** * The database manager instance. * * @var \Illuminate\Database\DatabaseManager */ protected $manager; /** ...
// manager work correctly out of the box without extreme configuration. $this->setupDefaultConfiguration(); $this->setupManager(); } /** * Setup the default database configuration options. * * @return void
$this->setupContainer($container ?: new Container); // Once we have the container setup, we will setup the default configuration // options in the container "config" binding. This will make the database
{ "filepath": "src/Illuminate/Database/Capsule/Manager.php", "language": "php", "file_size": 5357, "cut_index": 716, "middle_length": 229 }
/** * The number of models to return for pagination. * * @var int */ protected $perPage = 15; /** * Indicates if the model exists. * * @var bool */ public $exists = false; /** * Indicates if the model was inserted during the object's lifecycle. * ...
* The event dispatcher instance. * * @var \Illuminate\Contracts\Events\Dispatcher|null */ protected static $dispatcher; /** * The models that are currently being booted. * * @var array */ protected stat
bool */ protected $escapeWhenCastingToString = false; /** * The connection resolver instance. * * @var \Illuminate\Database\ConnectionResolverInterface */ protected static $resolver; /**
{ "filepath": "src/Illuminate/Database/Eloquent/Model.php", "language": "php", "file_size": 79641, "cut_index": 3790, "middle_length": 229 }
oquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphOneOrMany; use Illuminate\Support\Str; use Illuminate\Support\Stringable; /** * @template TIntermediateModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * @template TLocalRelations...
ng has-many-through or has-one-through relationship. * * @param TDeclaringModel $rootModel * @param TLocalRelationship $localRelationship */ public function __construct($rootModel, $localRelationship) { $this->rootMo
xists on. * * @var TDeclaringModel */ protected $rootModel; /** * The local relationship. * * @var TLocalRelationship */ protected $localRelationship; /** * Create a pendi
{ "filepath": "src/Illuminate/Database/Eloquent/PendingHasThroughRelationship.php", "language": "php", "file_size": 4750, "cut_index": 614, "middle_length": 229 }
<?php namespace Illuminate\Database\Eloquent; use RuntimeException; class RelationNotFoundException extends RuntimeException { /** * The name of the affected Eloquent model. * * @var string */ public $model; /** * The name of the relation. * * @var string */ p...
elation}] on model [{$class}]." : "Call to undefined relationship [{$relation}] on model [{$class}] of type [{$type}].", ); $instance->model = $class; $instance->relation = $relation; return $instance;
*/ public static function make($model, $relation, $type = null) { $class = get_class($model); $instance = new static( is_null($type) ? "Call to undefined relationship [{$r
{ "filepath": "src/Illuminate/Database/Eloquent/RelationNotFoundException.php", "language": "php", "file_size": 1001, "cut_index": 512, "middle_length": 229 }
nt\Model * * @implements \Illuminate\Database\Eloquent\Scope<TModel> */ class SoftDeletingScope implements Scope { /** * All of the extensions to be added to the builder. * * @var string[] */ protected $extensions = ['Restore', 'RestoreOrCreate', 'CreateOrRestore', 'WithTrashed', 'Without...
ed functions. * * @param \Illuminate\Database\Eloquent\Builder<*> $builder * @return void */ public function extend(Builder $builder) { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}
$model * @return void */ public function apply(Builder $builder, Model $model) { $builder->whereNull($model->getQualifiedDeletedAtColumn()); } /** * Extend the query builder with the need
{ "filepath": "src/Illuminate/Database/Eloquent/SoftDeletingScope.php", "language": "php", "file_size": 4895, "cut_index": 614, "middle_length": 229 }
pace Illuminate\Database\Eloquent\Casts; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; class AsArrayObject implements Castable { /** * Get the caster class to use when casting from / to this cast target. * * @param array $argument...
return; } $data = Json::decode($attributes[$key]); return is_array($data) ? new ArrayObject($data, ArrayObject::ARRAY_AS_PROPS) : null; } public function set($model, $key
ng(array $arguments) { return new class implements CastsAttributes { public function get($model, $key, $value, $attributes) { if (! isset($attributes[$key])) {
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsArrayObject.php", "language": "php", "file_size": 1296, "cut_index": 524, "middle_length": 229 }
; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\BinaryCodec; use InvalidArgumentException; class AsBinary implements Castable { /** * Get the caster class to use when casting from / to this cast target. * * @p...
$this->format = $this->arguments[0] ?? throw new InvalidArgumentException('The binary codec format is required.'); if (! in_array($this->format, BinaryCodec::formats(), true)) { throw new I
ing(array $arguments) { return new class($arguments) implements CastsAttributes { protected string $format; public function __construct(protected array $arguments) {
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsBinary.php", "language": "php", "file_size": 2188, "cut_index": 563, "middle_length": 229 }
ble; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Str; use InvalidArgumentException; class AsEncryptedCollection implements Castable { /** * Get the caster class to use when casting from / to this ca...
d array $arguments) { $this->arguments = array_pad(array_values($this->arguments), 2, ''); } public function get($model, $key, $value, $attributes) { $collectionClass = empty(
* @throws \InvalidArgumentException */ public static function castUsing(array $arguments) { return new class($arguments) implements CastsAttributes { public function __construct(protecte
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsEncryptedCollection.php", "language": "php", "file_size": 3051, "cut_index": 614, "middle_length": 229 }
; use BackedEnum; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\Collection; use function Illuminate\Support\enum_value; class AsEnumCollection implements Castable { /** * Get the caster class to use when casting from /...
otected $arguments; public function __construct(array $arguments) { $this->arguments = $arguments; } public function get($model, $key, $value, $attributes) { if (
utes<\Illuminate\Support\Collection<array-key, TEnum>, iterable<TEnum>> */ public static function castUsing(array $arguments) { return new class($arguments) implements CastsAttributes { pr
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsEnumCollection.php", "language": "php", "file_size": 2770, "cut_index": 563, "middle_length": 229 }
ontracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\Fluent; class AsFluent implements Castable { /** * Get the caster class to use when casting from / to this cast target. * * @param array $arguments * @return \Illuminate\Con...
el, $key, $value, $attributes) { return isset($value) ? new Fluent(Json::decode($value)) : null; } public function set($model, $key, $value, $attributes) { return isset($value
butes { public function get($mod
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsFluent.php", "language": "php", "file_size": 966, "cut_index": 582, "middle_length": 52 }
nt\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\Uri; class AsUri implements Castable { /** * Get the caster class to use when casting from / to this cast target. * * @param array $arguments * @return \Illuminate\Contracts\Database\Eloquent\Casts...
) { return isset($value) ? new Uri($value) : null; } public function set($model, $key, $value, $attributes) { return isset($value) ? (string) $value : null; }
ublic function get($model, $key, $value, $attributes
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsUri.php", "language": "php", "file_size": 929, "cut_index": 606, "middle_length": 52 }
delInspector { /** * The methods that can be called in a model to indicate a relation. * * @var list<string> */ protected $relationMethods = [ 'hasMany', 'hasManyThrough', 'hasOneThrough', 'belongsToMany', 'hasOne', 'belongsTo', 'morphO...
m class-string<\Illuminate\Database\Eloquent\Model>|string $model * @param string|null $connection * @return \Illuminate\Database\Eloquent\ModelInfo * * @throws \Illuminate\Contracts\Container\BindingResolutionException */
tracts\Foundation\Application $app The Laravel application instance. */ public function __construct(protected Application $app) { } /** * Extract model details for the given model. * * @para
{ "filepath": "src/Illuminate/Database/Eloquent/ModelInspector.php", "language": "php", "file_size": 13363, "cut_index": 921, "middle_length": 229 }
pace Illuminate\Database\Eloquent; use RuntimeException; class JsonEncodingException extends RuntimeException { /** * Create a new JSON encoding exception for the model. * * @param mixed $model * @param string $message * @return static */ public static function forModel($mode...
{ $model = $resource->resource; return new static('Error encoding resource ['.get_class($resource).'] with model ['.get_class($model).'] with ID ['.$model->getKey().'] to JSON: '.$message); } /** * Create a new JSON encod
exception for the resource. * * @param \Illuminate\Http\Resources\Json\JsonResource $resource * @param string $message * @return static */ public static function forResource($resource, $message)
{ "filepath": "src/Illuminate/Database/Eloquent/JsonEncodingException.php", "language": "php", "file_size": 1389, "cut_index": 524, "middle_length": 229 }
; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\Collection; use Illuminate\Support\Str; use InvalidArgumentException; class AsCollection implements Castable { /** * Get the caster class to use when casting from / to thi...
ected array $arguments) { $this->arguments = array_pad(array_values($this->arguments), 2, ''); } public function get($model, $key, $value, $attributes) { if (! isset($attribut
* @throws \InvalidArgumentException */ public static function castUsing(array $arguments) { return new class($arguments) implements CastsAttributes { public function __construct(prot
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsCollection.php", "language": "php", "file_size": 2992, "cut_index": 563, "middle_length": 229 }
; use BackedEnum; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\Collection; use function Illuminate\Support\enum_value; class AsEnumArrayObject implements Castable { /** * Get the caster class to use when casting from ...
{ protected $arguments; public function __construct(array $arguments) { $this->arguments = $arguments; } public function get($model, $key, $value, $attributes) {
butes<\Illuminate\Database\Eloquent\Casts\ArrayObject<array-key, TEnum>, iterable<TEnum>> */ public static function castUsing(array $arguments) { return new class($arguments) implements CastsAttributes
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsEnumArrayObject.php", "language": "php", "file_size": 2854, "cut_index": 563, "middle_length": 229 }
ontracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\HtmlString; class AsHtmlString implements Castable { /** * Get the caster class to use when casting from / to this cast target. * * @param array $arguments * @return \Illumi...
ublic function get($model, $key, $value, $attributes) { return isset($value) ? new HtmlString($value) : null; } public function set($model, $key, $value, $attributes) { return
s implements CastsAttributes { p
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsHtmlString.php", "language": "php", "file_size": 964, "cut_index": 582, "middle_length": 52 }
e Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * @template TResult * * @extends \Illuminate\Database\Eloquent\Relations\HasOneOrMany<TRelatedModel, TDeclaringM...
ram \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query * @param TDeclaringModel $parent * @param string $type * @param string $id * @param string $localKey */ public function __construct(Builder $query, Model
/** * The morph class of the parent model. * * @var class-string<TDeclaringModel>|string */ protected $morphClass; /** * Create a new morph one or many relationship instance. * * @pa
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php", "language": "php", "file_size": 4804, "cut_index": 614, "middle_length": 229 }
pace Illuminate\Database\Eloquent\Factories; use Countable; class Sequence implements Countable { /** * The sequence of return values. * * @var array */ protected $sequence; /** * The count of the sequence items. * * @var int */ public $count; /** * T...
*/ public function count(): int { return $this->count; } /** * Get the next value in the sequence. * * @param array<string, mixed> $attributes * @param \Illuminate\Database\Eloquent\Model|null $parent
*/ public function __construct(...$sequence) { $this->sequence = $sequence; $this->count = count($sequence); } /** * Get the current count of the sequence items. * * @return int
{ "filepath": "src/Illuminate/Database/Eloquent/Factories/Sequence.php", "language": "php", "file_size": 1284, "cut_index": 524, "middle_length": 229 }
pace Illuminate\Database\Eloquent\Casts; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\Facades\Crypt; class AsEncryptedArrayObject implements Castable { /** * Get the caster class to use when casting from / to this cast...
if (isset($attributes[$key])) { return new ArrayObject(Json::decode(Crypt::decryptString($attributes[$key])), ArrayObject::ARRAY_AS_PROPS); } return null; } public function s
ble> */ public static function castUsing(array $arguments) { return new class implements CastsAttributes { public function get($model, $key, $value, $attributes) {
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsEncryptedArrayObject.php", "language": "php", "file_size": 1453, "cut_index": 524, "middle_length": 229 }
te\Database\Eloquent\Casts; class Attribute { /** * The attribute accessor. * * @var callable */ public $get; /** * The attribute mutator. * * @var callable */ public $set; /** * Indicates if caching is enabled for this attribute. * * @var bo...
$this->get = $get; $this->set = $set; } /** * Create a new attribute accessor / mutator. * * @param callable|null $get * @param callable|null $set * @return static */ public static function mak
/** * Create a new attribute accessor / mutator. * * @param callable|null $get * @param callable|null $set */ public function __construct(?callable $get = null, ?callable $set = null) {
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/Attribute.php", "language": "php", "file_size": 1954, "cut_index": 537, "middle_length": 229 }
tes\Initialize; use Illuminate\Database\Eloquent\Attributes\Unguarded; trait GuardsAttributes { /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = []; /** * The attributes that aren't mass assignable. * * @var array<string...
* * @return void */ #[Initialize] public function initializeGuardsAttributes() { $this->mergeFillable(static::resolveClassAttribute(Fillable::class, 'columns') ?? []); if ($this->guarded === ['*']) { if
The actual columns that exist on the database and can be guarded. * * @var array<class-string,list<string>> */ protected static $guardableColumns = []; /** * Initialize the GuardsAttributes trait.
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php", "language": "php", "file_size": 7081, "cut_index": 716, "middle_length": 229 }
l. * * Allows for object-based events for native Eloquent events. * * @var array<string, class-string> */ protected $dispatchesEvents = []; /** * User exposed observable events. * * These are extra user-defined events observers may subscribe to. * * @var string...
rveAttributes() { $reflectionClass = new ReflectionClass(static::class); $isEloquentGrandchild = is_subclass_of(static::class, Model::class) && get_parent_class(static::class) !== Model::class; return (new Collecti
atic::whenBooted(fn () => static::observe(static::resolveObserveAttributes())); } /** * Resolve the observe class names from the attributes. * * @return array */ public static function resolveObse
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/HasEvents.php", "language": "php", "file_size": 12215, "cut_index": 921, "middle_length": 229 }
ontracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Support\Stringable; class AsStringable implements Castable { /** * Get the caster class to use when casting from / to this cast target. * * @param array $arguments * @return \Illumi...
public function get($model, $key, $value, $attributes) { return isset($value) ? new Stringable($value) : null; } public function set($model, $key, $value, $attributes) { retur
ss implements CastsAttributes {
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/AsStringable.php", "language": "php", "file_size": 965, "cut_index": 582, "middle_length": 52 }
rray', 'encrypted:collection', 'encrypted:json', 'encrypted:object', 'float', 'hashed', 'immutable_date', 'immutable_datetime', 'immutable_custom_datetime', 'int', 'integer', 'json', 'json:unicode', 'object', ...
public static $snakeAttributes = true; /** * The cache of the mutated attributes for each class. * * @var array */ protected static $mutatorCache = []; /** * The cache of the "Attribute" return type marked mutated at
* * The accessors to append to the model's array form. * * @var array */ protected $appends = []; /** * Indicates whether attributes are snake cased on arrays. * * @var bool */
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php", "language": "php", "file_size": 75926, "cut_index": 3790, "middle_length": 229 }
te\Database\Schema\Grammars; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Fluent; class MariaDbGrammar extends MySqlGrammar { /** @inheritDoc */ public function compileRenameColumn(Blueprint $blueprint, Fluent $command) { if (version_compare($this->connection->getServerVersion(...
nection->getServerVersion(), '10.7.0', '<')) { return 'char(36)'; } return 'uuid'; } /** * Create the column definition for a spatial Geometry type. * * @param \Illuminate\Support\Fluent $column *
* Create the column definition for a uuid type. * * @param \Illuminate\Support\Fluent $column * @return string */ protected function typeUuid(Fluent $column) { if (version_compare($this->con
{ "filepath": "src/Illuminate/Database/Schema/Grammars/MariaDbGrammar.php", "language": "php", "file_size": 1798, "cut_index": 537, "middle_length": 229 }
\Attributes\ScopedBy; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Arr; use Illuminate\Support\Collection; use InvalidArgumentException; use ReflectionAttribute; use ReflectionClass; trait HasGlobalScopes { /** * Boot the has global scopes trait for a ...
$attributes = (new Collection($reflectionClass->getAttributes(ScopedBy::class, ReflectionAttribute::IS_INSTANCEOF))); foreach ($reflectionClass->getTraits() as $trait) { $attributes->push(...$trait->getAttributes(ScopedBy::class, Refl
Resolve the global scope class names from the attributes. * * @return array */ public static function resolveGlobalScopeAttributes() { $reflectionClass = new ReflectionClass(static::class);
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php", "language": "php", "file_size": 4865, "cut_index": 614, "middle_length": 229 }
* @var mixed */ protected $relationAutoloadContext = null; /** * The many to many relationship methods. * * @var string[] */ public static $manyMethods = [ 'belongsToMany', 'morphToMany', 'morphedByMany', ]; /** * The relation resolver callbacks. * ...
resolver if defined or inherited, or return null. * * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * * @param class-string<TRelatedModel> $class * @param string $key * @return Closure|null */ pub
tion initializeHasRelationships() { if (empty($this->touches)) { $this->touches = static::resolveClassAttribute(Touches::class, 'relations') ?? []; } } /** * Get the dynamic relation
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php", "language": "php", "file_size": 40155, "cut_index": 2151, "middle_length": 229 }
idden; use Illuminate\Database\Eloquent\Attributes\Initialize; use Illuminate\Database\Eloquent\Attributes\Visible; trait HidesAttributes { /** * The attributes that should be hidden for serialization. * * @var array<string> */ protected $hidden = []; /** * The attributes that sho...
:class, 'columns') ?? []); } /** * Get the hidden attributes for the model. * * @return array<string> */ public function getHidden() { return $this->hidden; } /** * Set the hidden attributes for th
#[Initialize] public function initializeHidesAttributes() { $this->mergeHidden(static::resolveClassAttribute(Hidden::class, 'columns') ?? []); $this->mergeVisible(static::resolveClassAttribute(Visible:
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php", "language": "php", "file_size": 4235, "cut_index": 614, "middle_length": 229 }
n, $operator, $count, $boolean, $callback); } $relation = $this->getRelationWithoutConstraints($relation); } if ($relation instanceof MorphTo) { return $this->hasMorph($relation, ['*'], $operator, $count, $boolean, $callback); } // If we only need t...
y = $relation->{$method}( $relation->getRelated()->newQueryWithoutRelationships(), $this ); // Next we will call any given callback as an "anonymous" scope so they can get the // proper logical grouping of the where cla
queries run much faster compared with a count. $method = $this->canUseExistsForExistenceCheck($operator, $count) ? 'getRelationExistenceQuery' : 'getRelationExistenceCountQuery'; $hasQuer
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php", "language": "php", "file_size": 45114, "cut_index": 2151, "middle_length": 229 }
rns; use Illuminate\Database\Eloquent\Attributes\UseResource; use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Support\Str; use LogicException; use ReflectionClass; trait TransformsToResource { /** * Create a new resource object for the given resource. * * @param class-string<\Illum...
* @return \Illuminate\Http\Resources\Json\JsonResource * * @throws \LogicException */ protected function guessResource(): JsonResource { $resourceClass = $this->resolveResourceFromAttribute(static::class); if ($reso
JsonResource { if ($resourceClass === null) { return $this->guessResource(); } return $resourceClass::make($this); } /** * Guess the resource class for the model. *
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/TransformsToResource.php", "language": "php", "file_size": 3031, "cut_index": 563, "middle_length": 229 }
tes\WithoutTimestamps; use Illuminate\Support\Arr; use Illuminate\Support\Facades\Date; trait HasTimestamps { /** * Indicates if the model should be timestamped. * * @var bool */ public $timestamps = true; /** * The list of models classes that have timestamps temporarily disabled....
elseif (($table = static::resolveClassAttribute(Table::class)) && $table->timestamps !== null) { $this->timestamps = $table->timestamps; } } } /** * Update the model's update timestamp. * * @param
blic function initializeHasTimestamps() { if ($this->timestamps === true) { if (static::resolveClassAttribute(WithoutTimestamps::class) !== null) { $this->timestamps = false; }
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php", "language": "php", "file_size": 6104, "cut_index": 716, "middle_length": 229 }
rns; use Illuminate\Database\Eloquent\ModelNotFoundException; trait HasUniqueStringIds { /** * Generate a new unique key for the model. * * @return mixed */ abstract public function newUniqueId(); /** * Determine if given key is valid. * * @param mixed $value * @...
is->usesUniqueIds() ? [$this->getKeyName()] : parent::uniqueIds(); } /** * Retrieve the model for a bound value. * * @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation<*, *, *> $query
queStringIds() { $this->usesUniqueIds = true; } /** * Get the columns that should receive a unique identifier. * * @return array */ public function uniqueIds() { return $th
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/HasUniqueStringIds.php", "language": "php", "file_size": 2746, "cut_index": 563, "middle_length": 229 }
ions; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Illuminate\Database\Eloquent\Relations\Concerns\InteractsWithDictionary; /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TIntermediateModel of \Illuminate\Database\...
h" relationship. * * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough<TRelatedModel, TIntermediateModel, TDeclaringModel> */ public function one() { return HasOneThrough::noConstraints(fn () => new HasOneThrough(
TDeclaringModel, \Illuminate\Database\Eloquent\Collection<int, TRelatedModel>> */ class HasManyThrough extends HasOneOrManyThrough { use InteractsWithDictionary; /** * Convert the relationship to a "has one throug
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php", "language": "php", "file_size": 2626, "cut_index": 563, "middle_length": 229 }
sInverseRelations; /** * The foreign key of the parent model. * * @var string */ protected $foreignKey; /** * The local key of the parent model. * * @var string */ protected $localKey; /** * Create a new has one or many relationship instance. * ...
* * Create and return an un-saved instance of the related model. * * @param array $attributes * @return TRelatedModel */ public function make(array $attributes = []) { return tap($this->related->newInstance($attri
public function __construct(Builder $query, Model $parent, $foreignKey, $localKey) { $this->localKey = $localKey; $this->foreignKey = $foreignKey; parent::__construct($query, $parent); } /*
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php", "language": "php", "file_size": 18590, "cut_index": 1331, "middle_length": 229 }
upportsPartialRelations; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Concerns\CanBeOneOfMany; use Illuminate\Database\Eloquent\Relations\Concerns\ComparesRelatedModels; use...
minate\Database\Eloquent\Relations\HasOneOrManyThrough<TRelatedModel, TIntermediateModel, TDeclaringModel, ?TRelatedModel> */ class HasOneThrough extends HasOneOrManyThrough implements SupportsPartialRelations { use ComparesRelatedModels, CanBeOneOfMa
/** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TIntermediateModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * * @extends \Illu
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/HasOneThrough.php", "language": "php", "file_size": 4126, "cut_index": 614, "middle_length": 229 }
upportsPartialRelations; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Concerns\CanBeOneOfMany; use Illuminate\Database\Eloquent\Relations\Concerns\ComparesRelatedModels; use...
ts SupportsPartialRelations { use CanBeOneOfMany, ComparesRelatedModels, SupportsDefaultModels; /** @inheritDoc */ public function getResults() { if (is_null($this->getParentKey())) { return $this->getDefaultFor($this->
plate TDeclaringModel of \Illuminate\Database\Eloquent\Model * * @extends \Illuminate\Database\Eloquent\Relations\MorphOneOrMany<TRelatedModel, TDeclaringModel, ?TRelatedModel> */ class MorphOne extends MorphOneOrMany implemen
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/MorphOne.php", "language": "php", "file_size": 3973, "cut_index": 614, "middle_length": 229 }
pport\Onceable; use WeakMap; trait PreventsCircularRecursion { /** * The cache of objects processed to prevent infinite recursion. * * @var WeakMap<static, array<string, mixed>> */ protected static $recursionCache; /** * Prevent a method from being called multiple times on the sam...
ack); } $stack = static::getRecursiveCallStack($this); if (array_key_exists($onceable->hash, $stack)) { return is_callable($stack[$onceable->hash]) ? static::setRecursiveCallValue($this, $onceable->hash
efault = null) { $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); $onceable = Onceable::tryFromTrace($trace, $callback); if (is_null($onceable)) { return call_user_func($callb
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/PreventsCircularRecursion.php", "language": "php", "file_size": 3142, "cut_index": 614, "middle_length": 229 }
s\SupportsDefaultModels; use function Illuminate\Support\enum_value; /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * * @extends \Illuminate\Database\Eloquent\Relations\Relation<TRelatedModel, TDeclaringModel, ?TRelatedModel>...
model. * * @var string */ protected $ownerKey; /** * The name of the relationship. * * @var string */ protected $relationName; /** * Create a new belongs to relationship instance. * * @par
* * @var TDeclaringModel */ protected $child; /** * The foreign key of the parent model. * * @var string */ protected $foreignKey; /** * The associated key on the parent
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/BelongsTo.php", "language": "php", "file_size": 10878, "cut_index": 921, "middle_length": 229 }
te\Database\Eloquent\Relations; use Illuminate\Database\Eloquent\Collection as EloquentCollection; /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * * @extends \Illuminate\Database\Eloquent\Relations\HasOneOrMany<TRelatedModel...
$this->getQuery(), $this->parent, $this->foreignKey, $this->localKey ), function ($hasOne) { if ($inverse = $this->getInverseRelationship()) { $ha
* * @return \Illuminate\Database\Eloquent\Relations\HasOne<TRelatedModel, TDeclaringModel> */ public function one() { return HasOne::noConstraints(fn () => tap( new HasOne(
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/HasMany.php", "language": "php", "file_size": 1722, "cut_index": 537, "middle_length": 229 }
tions\Relation<TRelatedModel, TIntermediateModel, TResult> */ abstract class HasOneOrManyThrough extends Relation { use InteractsWithDictionary; /** * The "through" parent model instance. * * @var TIntermediateModel */ protected $throughParent; /** * The far parent model inst...
e local key on the intermediary model. * * @var string */ protected $secondLocalKey; /** * Create a new has many through relationship instance. * * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
* The far key on the relationship. * * @var string */ protected $secondKey; /** * The local key on the relationship. * * @var string */ protected $localKey; /** * Th
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/HasOneOrManyThrough.php", "language": "php", "file_size": 25953, "cut_index": 1331, "middle_length": 229 }
key of the parent model. * * @var string */ protected $foreignPivotKey; /** * The associated key of the relation. * * @var string */ protected $relatedPivotKey; /** * The key name of the parent model. * * @var string */ protected $parentKey; ...
ot table restrictions for where clauses. * * @var array */ protected $pivotWheres = []; /** * Any pivot table restrictions for whereIn clauses. * * @var array */ protected $pivotWhereIns = []; /** *
protected $relationName; /** * The pivot table columns to retrieve. * * @var array<string|\Illuminate\Contracts\Database\Query\Expression> */ protected $pivotColumns = []; /** * Any piv
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php", "language": "php", "file_size": 50852, "cut_index": 2151, "middle_length": 229 }
upportsPartialRelations; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Concerns\CanBeOneOfMany; use Illuminate\Database\Eloquent\Relations\Concerns\ComparesRelatedModels; use...
portsPartialRelations { use ComparesRelatedModels, CanBeOneOfMany, SupportsDefaultModels; /** @inheritDoc */ public function getResults() { if (is_null($this->getParentKey())) { return $this->getDefaultFor($this->parent
plate TDeclaringModel of \Illuminate\Database\Eloquent\Model * * @extends \Illuminate\Database\Eloquent\Relations\HasOneOrMany<TRelatedModel, TDeclaringModel, ?TRelatedModel> */ class HasOne extends HasOneOrMany implements Sup
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/HasOne.php", "language": "php", "file_size": 3724, "cut_index": 614, "middle_length": 229 }
te\Database\Eloquent\Relations; use Illuminate\Database\Eloquent\Collection as EloquentCollection; /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * * @extends \Illuminate\Database\Eloquent\Relations\MorphOneOrMany<TRelatedMod...
$this->getQuery(), $this->getParent(), $this->morphType, $this->foreignKey, $this->localKey ), function ($morphOne) { if ($inverse = $th
nship. * * @return \Illuminate\Database\Eloquent\Relations\MorphOne<TRelatedModel, TDeclaringModel> */ public function one() { return MorphOne::noConstraints(fn () => tap( new MorphOne(
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/MorphMany.php", "language": "php", "file_size": 1985, "cut_index": 537, "middle_length": 229 }
* The type of the polymorphic relation. * * Explicitly define this so it's not included in saved attributes. * * @var string */ protected $morphType; /** * The value of the polymorphic relation. * * Explicitly define this so it's not included in saved attributes. ...
veQuery($query); } /** * Set the keys for a select query. * * @param \Illuminate\Database\Eloquent\Builder<static> $query * @return \Illuminate\Database\Eloquent\Builder<static> */ protected function setKeysForSelect
$query * @return \Illuminate\Database\Eloquent\Builder<static> */ protected function setKeysForSaveQuery($query) { $query->where($this->morphType, $this->morphClass); return parent::setKeysForSa
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/MorphPivot.php", "language": "php", "file_size": 4598, "cut_index": 614, "middle_length": 229 }
/** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * @template TPivotModel of \Illuminate\Database\Eloquent\Relations\Pivot = \Illuminate\Database\Eloquent\Relations\MorphPivot * @template TAccessor of string = 'pivot' * * @exten...
* Indicates if we are connecting the inverse of the relation. * * This primarily affects the morphClass constraint. * * @var bool */ protected $inverse; /** * Create a new morph to many relationship instance. *
lymorphic relation. * * @var string */ protected $morphType; /** * The morph class of the morph type constraint. * * @var class-string|string */ protected $morphClass; /**
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/MorphToMany.php", "language": "php", "file_size": 6348, "cut_index": 716, "middle_length": 229 }
* @var \Illuminate\Database\Eloquent\Model */ public $pivotRelated; /** * The name of the foreign key column. * * @var string */ protected $foreignKey; /** * The name of the "other key" column. * * @var string */ protected $relatedKey; /** ...
tributes($attributes); // The pivot model is a "dynamic" model since we will set the tables dynamically // for the instance. This allows it work for any intermediate tables for the // many to many relationship that are defined by t
$exists * @return static */ public static function fromAttributes(Model $parent, $attributes, $table, $exists = false) { $instance = new static; $instance->timestamps = $instance->hasTimestampAt
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php", "language": "php", "file_size": 9367, "cut_index": 921, "middle_length": 229 }
ions\Concerns; use Illuminate\Contracts\Database\Eloquent\SupportsPartialRelations; use Illuminate\Database\Eloquent\Model; trait ComparesRelatedModels { /** * Determine if the model is the related instance of the relationship. * * @param \Illuminate\Database\Eloquent\Model|null $model * @re...
Many()) { return $this->query ->whereKey($model->getKey()) ->exists(); } return $match; } /** * Determine if the model is not the related instance of the relationship. * *
$this->related->getTable() === $model->getTable() && $this->related->getConnectionName() === $model->getConnectionName(); if ($match && $this instanceof SupportsPartialRelations && $this->isOneOf
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php", "language": "php", "file_size": 2071, "cut_index": 563, "middle_length": 229 }
removed from the join table by // checking which of the given ID/records is in the list of current records // and removing all of those rows from this "intermediate" joining table. $detach = array_values(array_intersect( $this->newPivotQuery()->pluck($this->relatedPivotKey)->all(), ...
results to the callers. $attach = array_diff_key($records, array_flip($detach)); if ($attach !== []) { $this->attach($attach, [], false); $changes['attached'] = array_keys($attach); } // Once we ha
// Finally, for all of the records which were not "detached", we'll attach the // records into the intermediate table. Then, we will add those attaches to // this change list and get ready to return these
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php", "language": "php", "file_size": 24656, "cut_index": 1331, "middle_length": 229 }
te\Database\Eloquent\Relations\Concerns; use Illuminate\Database\Eloquent\Model; trait SupportsDefaultModels { /** * Indicates if a default model instance should be used. * * Alternatively, may be a Closure or array. * * @var \Closure|array|bool */ protected $withDefault; /*...
public function withDefault($callback = true) { $this->withDefault = $callback; return $this; } /** * Get the default value for this relation. * * @param \Illuminate\Database\Eloquent\Model $parent *
ract protected function newRelatedInstanceFor(Model $parent); /** * Return a new model instance in case the relationship does not exist. * * @param \Closure|array|bool $callback * @return $this */
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php", "language": "php", "file_size": 1553, "cut_index": 537, "middle_length": 229 }
ries; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\MorphTo; class BelongsToRelationship { /** * The related factory instance. * * @var \Illuminate\Database\Eloquent\Factories\Factory|\Illuminate\Database\Eloquent\Model */ protected $factory; /** ...
nship */ public function __construct($factory, $relationship) { $this->factory = $factory; $this->relationship = $relationship; } /** * Get the parent model attributes and resolvers for the given child model.
ted $resolved; /** * Create a new "belongs to" relationship definition. * * @param \Illuminate\Database\Eloquent\Factories\Factory|\Illuminate\Database\Eloquent\Model $factory * @param string $relatio
{ "filepath": "src/Illuminate/Database/Eloquent/Factories/BelongsToRelationship.php", "language": "php", "file_size": 2721, "cut_index": 563, "middle_length": 229 }
* The model instances to always use when creating relationships. * * @var \Illuminate\Support\Collection */ protected $recycle; /** * The "after making" callbacks that will be applied to the model. * * @var \Illuminate\Support\Collection */ protected $afterMaking; ...
*/ protected $excludeRelationships = []; /** * The name of the database connection that will be used to create the models. * * @var \UnitEnum|string|null */ protected $connection; /** * The current Faker instan
relationships should not be automatically created. * * @var bool */ protected $expandRelationships = true; /** * The relationships that should not be automatically created. * * @var array
{ "filepath": "src/Illuminate/Database/Eloquent/Factories/Factory.php", "language": "php", "file_size": 35733, "cut_index": 2151, "middle_length": 229 }
<?php namespace Illuminate\Database\Eloquent\Concerns; trait HasUniqueIds { /** * Indicates if the model uses unique IDs. * * @var bool */ public $usesUniqueIds = false; /** * Determine if the model uses unique IDs. * * @return bool */ public function usesUniqu...
* @return string */ public function newUniqueId() { return null; } /** * Get the columns that should receive a unique identifier. * * @return array */ public function uniqueIds() { retu
foreach ($this->uniqueIds() as $column) { if (empty($this->{$column})) { $this->{$column} = $this->newUniqueId(); } } } /** * Generate a new key for the model. *
{ "filepath": "src/Illuminate/Database/Eloquent/Concerns/HasUniqueIds.php", "language": "php", "file_size": 1012, "cut_index": 512, "middle_length": 229 }
luminate\Database\Query\Expression; use Illuminate\Support\Collection as BaseCollection; use Illuminate\Support\Traits\ForwardsCalls; use Illuminate\Support\Traits\Macroable; /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * @te...
* * @var TDeclaringModel */ protected $parent; /** * The related model instance. * * @var TRelatedModel */ protected $related; /** * Indicates whether the eagerly loaded relation should implicitly retur
__call as macroCall; } /** * The Eloquent query builder instance. * * @var \Illuminate\Database\Eloquent\Builder<TRelatedModel> */ protected $query; /** * The parent model instance.
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/Relation.php", "language": "php", "file_size": 14930, "cut_index": 921, "middle_length": 229 }
?php namespace Illuminate\Database\Eloquent\Relations\Concerns; use InvalidArgumentException; use UnitEnum; use function Illuminate\Support\enum_value; trait InteractsWithDictionary { /** * Get a dictionary key attribute - casting it to a string if necessary. * * @param mixed $attribute * ...
if ($attribute instanceof UnitEnum) { return enum_value($attribute); } throw new InvalidArgumentException('Model attribute value is an object but does not have a __toString method.'); }
e) || is_int($attribute)) { return $attribute; } if (is_object($attribute)) { if (method_exists($attribute, '__toString')) { return $attribute->__toString(); }
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithDictionary.php", "language": "php", "file_size": 1035, "cut_index": 513, "middle_length": 229 }
del; use Illuminate\Database\Eloquent\RelationNotFoundException; use Illuminate\Support\Arr; use Illuminate\Support\Str; trait SupportsInverseRelations { /** * The name of the inverse relationship. * * @var string|null */ protected ?string $inverseRelationship = null; /** * Instru...
ery has run. * * @param string|null $relation * @return $this */ public function chaperone(?string $relation = null) { $relation ??= $this->guessInverseRelation(); if (! $relation || ! $this->getModel()->isRel
$this */ public function inverse(?string $relation = null) { return $this->chaperone($relation); } /** * Instruct Eloquent to link the related models back to the parent after the relationship qu
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsInverseRelations.php", "language": "php", "file_size": 4393, "cut_index": 614, "middle_length": 229 }
ries; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasOneOrMany; use Illuminate\Database\Eloquent\Relations\MorphOneOrMany; class Relationship { /** * The related factory instance. * * @var \Illuminate\D...
{ $this->factory = $factory; $this->relationship = $relationship; } /** * Create the child relationship for the given parent model. * * @param \Illuminate\Database\Eloquent\Model $parent * @return void */
a new child relationship instance. * * @param \Illuminate\Database\Eloquent\Factories\Factory $factory * @param string $relationship */ public function __construct(Factory $factory, $relationship)
{ "filepath": "src/Illuminate/Database/Eloquent/Factories/Relationship.php", "language": "php", "file_size": 2342, "cut_index": 563, "middle_length": 229 }
l * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * * @extends \Illuminate\Database\Eloquent\Relations\BelongsTo<TRelatedModel, TDeclaringModel> */ class MorphTo extends BelongsTo { use InteractsWithDictionary; /** * The type of the polymorphic relation. * * @var string ...
cted $dictionary = []; /** * A buffer of dynamic calls to query macros. * * @var array */ protected $macroBuffer = []; /** * A map of relations to load for each individual morph type. * * @var array */
ns are being eager loaded. * * @var \Illuminate\Database\Eloquent\Collection<int, TDeclaringModel> */ protected $models; /** * All of the models keyed by ID. * * @var array */ prote
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/MorphTo.php", "language": "php", "file_size": 12742, "cut_index": 921, "middle_length": 229 }
ries; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; class BelongsToManyRelationship { /** * The related factory instance. * * @var \Illuminate\Database\Eloquent\Factories\Factory|\Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array */ protec...
se\Eloquent\Model|array $factory * @param callable|array $pivot * @param string $relationship */ public function __construct($factory, $pivot, $relationship) { $this->factory = $factory; $this->pivot = $pivot;
ar string */ protected $relationship; /** * Create a new attached relationship definition. * * @param \Illuminate\Database\Eloquent\Factories\Factory|\Illuminate\Support\Collection|\Illuminate\Databa
{ "filepath": "src/Illuminate/Database/Eloquent/Factories/BelongsToManyRelationship.php", "language": "php", "file_size": 2267, "cut_index": 563, "middle_length": 229 }
te\Database\Schema; use Illuminate\Support\Stringable; class ForeignIdColumnDefinition extends ColumnDefinition { /** * The schema builder blueprint instance. * * @var \Illuminate\Database\Schema\Blueprint */ protected $blueprint; /** * Create a new foreign ID column definition. ...
@param string|null $table * @param string|null $column * @param string|null $indexName * @return \Illuminate\Database\Schema\ForeignKeyDefinition */ public function constrained($table = null, $column = null, $indexName = null
parent::__construct($attributes); $this->blueprint = $blueprint; } /** * Create a foreign key constraint on this column referencing the "id" column of the conventionally related table. * *
{ "filepath": "src/Illuminate/Database/Schema/ForeignIdColumnDefinition.php", "language": "php", "file_size": 1655, "cut_index": 537, "middle_length": 229 }
te\Database\Eloquent\Factories; use Illuminate\Database\Eloquent\Attributes\UseFactory; /** * @template TFactory of \Illuminate\Database\Eloquent\Factories\Factory */ trait HasFactory { /** * Get a new factory instance for the model. * * @param (callable(array<string, mixed>, static|null): array...
unt : null) ->state(is_callable($count) || is_array($count) ? $count : $state); } /** * Create a new factory instance for the model. * * @return TFactory|null */ protected static function newFactory() {
*/ public static function factory($count = null, $state = []) { $factory = static::newFactory() ?? Factory::factoryForModel(static::class); return $factory ->count(is_numeric($count) ? $co
{ "filepath": "src/Illuminate/Database/Eloquent/Factories/HasFactory.php", "language": "php", "file_size": 1724, "cut_index": 537, "middle_length": 229 }
/** * The column to add new columns after. * * @var string */ public $after; /** * The blueprint state instance. * * @var \Illuminate\Database\Schema\BlueprintState|null */ protected $state; /** * Create a new schema blueprint. * * @param \Illumi...
); } } /** * Execute the blueprint against the database. * * @return void */ public function build() { foreach ($this->toSql() as $statement) { $this->connection->statement($statement);
, ?Closure $callback = null) { $this->connection = $connection; $this->grammar = $connection->getSchemaGrammar(); $this->table = $table; if (! is_null($callback)) { $callback($this
{ "filepath": "src/Illuminate/Database/Schema/Blueprint.php", "language": "php", "file_size": 56651, "cut_index": 2151, "middle_length": 229 }
* The default string length for migrations. * * @var non-negative-int|null */ public static $defaultStringLength = 255; /** * The default time precision for migrations. */ public static ?int $defaultTimePrecision = 0; /** * The default relationship morph key type. *...
ng length for migrations. * * @param non-negative-int $length * @return void */ public static function defaultStringLength($length) { static::$defaultStringLength = $length; } /** * Set the default time p
tion $connection */ public function __construct(Connection $connection) { $this->connection = $connection; $this->grammar = $connection->getSchemaGrammar(); } /** * Set the default stri
{ "filepath": "src/Illuminate/Database/Schema/Builder.php", "language": "php", "file_size": 21899, "cut_index": 1331, "middle_length": 229 }
lluminate\Support\Fluent; /** * @method $this after(string $column) Place the column "after" another column (MySQL) * @method $this always(bool $value = true) Used as a modifier for generatedAs() (PostgreSQL) * @method $this autoIncrement() Set INTEGER columns as auto-increment (primary key) * @method $this change...
e (MySQL) * @method $this from(int $startingValue) Set the starting value of an auto-incrementing field (MySQL/PostgreSQL) * @method $this fulltext(bool|string $indexName = null) Add a fulltext index * @method $this generatedAs(string|\Illuminate\Contra
* @method $this comment(string $comment) Add a comment to the column (MySQL/PostgreSQL) * @method $this default(mixed $value) Specify a "default" value for the column * @method $this first() Place the column "first" in the tabl
{ "filepath": "src/Illuminate/Database/Schema/ColumnDefinition.php", "language": "php", "file_size": 2860, "cut_index": 563, "middle_length": 229 }
lluminate\Support\Fluent; /** * @method ForeignKeyDefinition deferrable(bool $value = true) Set the foreign key as deferrable (PostgreSQL) * @method ForeignKeyDefinition initiallyImmediate(bool $value = true) Set the default time to check the constraint (PostgreSQL) * @method ForeignKeyDefinition lock(('none'|'shar...
referenced column(s) */ class ForeignKeyDefinition extends Fluent { /** * Indicate that updates should cascade. * * @return $this */ public function cascadeOnUpdate() { return $this->onUpdate('cascade'); }
eignKeyDefinition onDelete(string $action) Add an ON DELETE action * @method ForeignKeyDefinition onUpdate(string $action) Add an ON UPDATE action * @method ForeignKeyDefinition references(string|string[] $columns) Specify the
{ "filepath": "src/Illuminate/Database/Schema/ForeignKeyDefinition.php", "language": "php", "file_size": 2414, "cut_index": 563, "middle_length": 229 }
te\Database\Schema; use Symfony\Component\Process\Exception\ProcessFailedException; class MariaDbSchemaState extends MySqlSchemaState { /** * Load the given schema file into the database. * * @param string $path * @return void */ public function load($path) { $versionInf...
the base dump command arguments for MariaDB as a string. * * @return string */ protected function baseDumpCommand() { $versionInfo = $this->detectClientVersion(); $command = 'mariadb-dump '.$this->connectionString($
$this->makeProcess($command)->setTimeout(null); $process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ 'LARAVEL_LOAD_PATH' => $path, ])); } /** * Get
{ "filepath": "src/Illuminate/Database/Schema/MariaDbSchemaState.php", "language": "php", "file_size": 1862, "cut_index": 537, "middle_length": 229 }
use Symfony\Component\Process\Process; class MySqlSchemaState extends SchemaState { /** * Dump the database's schema into a file. * * @param \Illuminate\Database\Connection $connection * @param string $path * @return void */ public function dump(Connection $connection, $path) ...
>appendMigrationData($path); } } /** * Remove the auto-incrementing state from the given schema dump. * * @param string $path * @return void */ protected function removeAutoIncrementingState(string $path)
erge($this->baseVariables($this->connection->getConfig()), [ 'LARAVEL_LOAD_PATH' => $path, ])); $this->removeAutoIncrementingState($path); if ($this->hasMigrationTable()) { $this-
{ "filepath": "src/Illuminate/Database/Schema/MySqlSchemaState.php", "language": "php", "file_size": 7504, "cut_index": 716, "middle_length": 229 }
rt\Collection; class PostgresSchemaState extends SchemaState { /** * Dump the database's schema into a file. * * @param \Illuminate\Database\Connection $connection * @param string $path * @return void */ public function dump(Connection $connection, $path) { $comman...
->connection->getConfig()), [ 'LARAVEL_LOAD_PATH' => $path, ])); }); } /** * Load the given schema file into the database. * * @param string $path * @return void */ public function
).' -t '.$this->getMigrationTable().' --data-only >> '.$path); } $commands->map(function ($command, $path) { $this->makeProcess($command)->mustRun($this->output, array_merge($this->baseVariables($this
{ "filepath": "src/Illuminate/Database/Schema/PostgresSchemaState.php", "language": "php", "file_size": 3120, "cut_index": 614, "middle_length": 229 }
ystem\Filesystem; use Symfony\Component\Process\Process; abstract class SchemaState { /** * The connection instance. * * @var \Illuminate\Database\Connection */ protected $connection; /** * The filesystem instance. * * @var \Illuminate\Filesystem\Filesystem */ p...
e. * * @param \Illuminate\Database\Connection $connection * @param \Illuminate\Filesystem\Filesystem|null $files * @param callable|null $processFactory */ public function __construct(Connection $connection, ?Filesystem $f
ory callback. * * @var callable */ protected $processFactory; /** * The output callable instance. * * @var callable */ protected $output; /** * Create a new dumper instanc
{ "filepath": "src/Illuminate/Database/Schema/SchemaState.php", "language": "php", "file_size": 3227, "cut_index": 614, "middle_length": 229 }
lluminate\Database\Connection; use Illuminate\Support\Collection; class SqliteSchemaState extends SchemaState { /** * Dump the database's schema into a file. * * @param \Illuminate\Database\Connection $connection * @param string $path * @return void */ public function dump(Con...
grations.PHP_EOL); if ($this->hasMigrationTable()) { $this->appendMigrationData($path); } } /** * Append the migration data to the schema dump. * * @param string $path * @return void */ p
->baseVariables($this->connection->getConfig()), [ // ])); $migrations = preg_replace('/CREATE TABLE sqlite_.+?\);[\r\n]+/is', '', $process->getOutput()); $this->files->put($path, $mi
{ "filepath": "src/Illuminate/Database/Schema/SqliteSchemaState.php", "language": "php", "file_size": 2873, "cut_index": 563, "middle_length": 229 }
false; /** * The name of the relationship. * * @var string */ protected $relationName; /** * The one of many inner join subselect query builder instance. * * @var \Illuminate\Database\Eloquent\Builder<*>|null */ protected $oneOfManySubQuery; /** * Add ...
ups. * * @return array|string */ abstract public function getOneOfManySubQuerySelectColumns(); /** * Add join query constraints for one of many relationships. * * @param \Illuminate\Database\Query\JoinClause $join
ring|null $aggregate * @return void */ abstract public function addOneOfManySubQueryConstraints(Builder $query, $column = null, $aggregate = null); /** * Get the columns the determine the relationship gro
{ "filepath": "src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php", "language": "php", "file_size": 9896, "cut_index": 921, "middle_length": 229 }
\Support\Str; class BlueprintState { /** * The blueprint instance. * * @var \Illuminate\Database\Schema\Blueprint */ protected $blueprint; /** * The connection instance. * * @var \Illuminate\Database\Connection */ protected $connection; /** * The colum...
e\Database\Schema\ForeignKeyDefinition[] */ private $foreignKeys; /** * Create a new blueprint state instance. * * @param \Illuminate\Database\Schema\Blueprint $blueprint * @param \Illuminate\Database\Connection $conne
ion|null */ private $primaryKey; /** * The indexes. * * @var \Illuminate\Database\Schema\IndexDefinition[] */ private $indexes; /** * The foreign keys. * * @var \Illuminat
{ "filepath": "src/Illuminate/Database/Schema/BlueprintState.php", "language": "php", "file_size": 7166, "cut_index": 716, "middle_length": 229 }
luent; /** * @method $this algorithm(string $algorithm) Specify an algorithm for the index (MySQL/PostgreSQL) * @method $this deferrable(bool $value = true) Specify that the unique index is deferrable (PostgreSQL) * @method $this initiallyImmediate(bool $value = true) Specify the default time to check the unique in...
ion (MySQL) * @method $this nullsNotDistinct(bool $value = true) Specify that the null values should not be treated as distinct (PostgreSQL) * @method $this online(bool $value = true) Specify that index creation should not lock the table (PostgreSQL/SqlS
alue) Specify the DDL lock mode for the index operat
{ "filepath": "src/Illuminate/Database/Schema/IndexDefinition.php", "language": "php", "file_size": 949, "cut_index": 582, "middle_length": 52 }
lluminate\Database\Concerns\ParsesSearchPath; class PostgresBuilder extends Builder { use ParsesSearchPath; /** * Drop all tables from the database. * * @return void */ public function dropAllTables() { $tables = []; $excludedTables = $this->connection->getConfig('...
$this->grammar->compileDropAllTables($tables) ); } /** * Drop all views from the database. * * @return void */ public function dropAllViews() { $views = array_column($this->getViews($this->getCurrent
ified_name']], $excludedTables))) { $tables[] = $table['schema_qualified_name']; } } if (empty($tables)) { return; } $this->connection->statement(
{ "filepath": "src/Illuminate/Database/Schema/PostgresBuilder.php", "language": "php", "file_size": 2570, "cut_index": 563, "middle_length": 229 }
se Illuminate\Support\Arr; class SqlServerBuilder extends Builder { /** * Drop all tables from the database. * * @return void */ public function dropAllTables() { $this->connection->statement($this->grammar->compileDropAllForeignKeys()); $this->connection->statement($th...
); } /** * Get the default schema name for the connection. * * @return string|null */ public function getCurrentSchemaName() { return Arr::first($this->getSchemas(), fn ($schema) => $schema['default'])['name'];
ion->statement($this->grammar->compileDropAllViews()
{ "filepath": "src/Illuminate/Database/Schema/SqlServerBuilder.php", "language": "php", "file_size": 875, "cut_index": 559, "middle_length": 52 }
\Envelope; use Symfony\Component\Mailer\Exception\TransportException; use Symfony\Component\Mailer\SentMessage; use Symfony\Component\Mailer\Transport\AbstractTransport; use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\MessageConverter; use Symfony\Contracts\HttpClient\Ht...
ent::__construct(); $this->client = $client ?? HttpClient::create(); } /** * {@inheritDoc} * * @throws TransportException */ protected function doSend(SentMessage $message): void { try { $re
ew Cloudflare transport instance. */ public function __construct( protected string $accountId, #[SensitiveParameter] protected string $key, ?HttpClientInterface $client = null, ) { par
{ "filepath": "src/Illuminate/Mail/Transport/CloudflareTransport.php", "language": "php", "file_size": 5653, "cut_index": 716, "middle_length": 229 }
lve the middleware name to a class name(s) preserving passed parameters. * * @param \Closure|string $name * @param array $map * @param array $middlewareGroups * @return \Closure|string|array */ public static function resolve($name, $map, $middlewareGroups) { // When t...
} // If the middleware is the name of a middleware group, we will return the array // of middlewares that belong to the group. This allows developers to group a // set of middleware under single keys that can be conveniently
when the developers are experimenting with them. if ($name instanceof Closure) { return $name; } if (isset($map[$name]) && $map[$name] instanceof Closure) { return $map[$name];
{ "filepath": "src/Illuminate/Routing/MiddlewareNameResolver.php", "language": "php", "file_size": 3178, "cut_index": 614, "middle_length": 229 }
espace Illuminate\Container\Attributes; use Attribute; use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Container\ContextualAttribute; use UnitEnum; #[Attribute(Attribute::TARGET_PARAMETER)] class Auth implements ContextualAttribute { /** * Create a new class instance. */ publi...
ntainer\Container $container * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard */ public static function resolve(self $attribute, Container $container) { return $container->make('auth')->guard($a
e\Contracts\Co
{ "filepath": "src/Illuminate/Container/Attributes/Auth.php", "language": "php", "file_size": 818, "cut_index": 522, "middle_length": 14 }
upport\Arr; use Illuminate\Support\Facades\File; class SQLiteBuilder extends Builder { /** * Create a database in the schema. * * @param string $name * @return bool */ public function createDatabase($name) { return File::put($name, '') !== false; } /** * Dro...
} catch (QueryException) { $withSize = false; } if (version_compare($this->connection->getServerVersion(), '3.37.0', '<')) { $schema ??= array_column($this->getSchemas(), 'name'); $tables = [];
::exists($name) || File::delete($name); } /** @inheritDoc */ public function getTables($schema = null) { try { $withSize = $this->connection->scalar($this->grammar->compileDbstatExists());
{ "filepath": "src/Illuminate/Database/Schema/SQLiteBuilder.php", "language": "php", "file_size": 4902, "cut_index": 614, "middle_length": 229 }
use CompilesJsonPaths; /** * The possible column modifiers. * * @var string[] */ protected $modifiers = []; /** * If this Grammar supports schema changes wrapped in a transaction. * * @var bool */ protected $transactions = false; /** * The commands t...
database if exists command. * * @param string $name * @return string */ public function compileDropDatabaseIfExists($name) { return sprintf('drop database if exists %s', $this->wrapValue($name) );
string $name * @return string */ public function compileCreateDatabase($name) { return sprintf('create database %s', $this->wrapValue($name), ); } /** * Compile a drop
{ "filepath": "src/Illuminate/Database/Schema/Grammars/Grammar.php", "language": "php", "file_size": 15049, "cut_index": 921, "middle_length": 229 }
public function compileSchemas() { return 'select schema_name as name, schema_name = schema() as `default` from information_schema.schemata where ' .$this->compileSchemaWhereClause(null, 'schema_name') .' order by schema_name'; } /** * Compile the query to determine if...
$schema ? $this->quoteString($schema) : 'schema()', $this->quoteString($table) ); } /** * Compile the query to determine the tables. * * @param string|string[]|null $schema * @return string */ pu
return sprintf( 'select exists (select 1 from information_schema.tables where ' ."table_schema = %s and table_name = %s and table_type in ('BASE TABLE', 'SYSTEM VERSIONED')) as `exists`",
{ "filepath": "src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php", "language": "php", "file_size": 43048, "cut_index": 2151, "middle_length": 229 }
' .$this->compileSchemaWhereClause(null, 'nspname') .' order by nspname'; } /** * Compile the query to determine if the given table exists. * * @param string|null $schema * @param string $table * @return string */ public function compileTableExists(...
* * @param string|string[]|null $schema * @return string */ public function compileTables($schema) { return 'select c.relname as name, n.nspname as schema, pg_total_relation_size(c.oid) as size, ' ."obj_descrip
', 'p') and n.oid = c.relnamespace)", $schema ? $this->quoteString($schema) : 'current_schema()', $this->quoteString($table) ); } /** * Compile the query to determine the tables.
{ "filepath": "src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php", "language": "php", "file_size": 41031, "cut_index": 2151, "middle_length": 229 }