prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
y a MIT style // license that can be found in the LICENSE file. //go:build !jsoniter && !go_json && !(sonic && (linux || windows || darwin)) package json import ( "encoding/json" "io" ) // Package indicates what library is being used for JSON encoding. const Package = "encoding/json" func init() { API = jsonApi...
dent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent) } func (j jsonApi) NewEncoder(writer io.Writer) Encoder { return json.NewEncoder(writer) } func (j jsonApi) NewDecoder(reader io.Reader) Decoder { return json.NewDecoder(reade
} func (j jsonApi) MarshalIndent(v any, prefix, in
{ "filepath": "codec/json/json.go", "language": "go", "file_size": 919, "cut_index": 606, "middle_length": 52 }
tp" "reflect" "github.com/gin-gonic/gin/internal/bytesconv" ) type plainBinding struct{} func (plainBinding) Name() string { return "plain" } func (plainBinding) Bind(req *http.Request, obj any) error { all, err := io.ReadAll(req.Body) if err != nil { return err } return decodePlain(all, obj) } func (pla...
return nil } v = v.Elem() } if v.Kind() == reflect.String { v.SetString(bytesconv.BytesToString(data)) return nil } if _, ok := v.Interface().([]byte); ok { v.SetBytes(data) return nil } return fmt.Errorf("type (%T) unknown type", v) }
for v.Kind() == reflect.Ptr { if v.IsNil() {
{ "filepath": "binding/plain.go", "language": "go", "file_size": 868, "cut_index": 559, "middle_length": 52 }
ource code is governed by a MIT style // license that can be found in the LICENSE file. //go:build jsoniter package json import ( "io" jsoniter "github.com/json-iterator/go" ) // Package indicates what library is being used for JSON encoding. const Package = "github.com/json-iterator/go" func init() { API = js...
rn json.Unmarshal(data, v) } func (j jsoniterApi) MarshalIndent(v any, prefix, indent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent) } func (j jsoniterApi) NewEncoder(writer io.Writer) Encoder { return json.NewEncoder(writer) }
iterApi) Unmarshal(data []byte, v any) error { retu
{ "filepath": "codec/json/jsoniter.go", "language": "go", "file_size": 985, "cut_index": 582, "middle_length": 52 }
t/http" "os" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) type mockFileSystem struct { open func(name string) (http.File, error) } func (m *mockFileSystem) Open(name string) (http.File, error) { return m.open(name) } func TestFileSystem_Open(t *testing.T) { var testF...
TestFileSystem_Open_err(t *testing.T) { testError := errors.New("mock") mockFS := &mockFileSystem{ open: func(_ string) (http.File, error) { return nil, testError }, } fs := &FileSystem{mockFS} file, err := fs.Open("foo") require.ErrorIs(t,
or(t, err) assert.Equal(t, testFile, file) } func
{ "filepath": "internal/fs/fs_test.go", "language": "go", "file_size": 894, "cut_index": 547, "middle_length": 52 }
d. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. package bytesconv import ( "bytes" cRand "crypto/rand" "math/rand" "strings" "testing" "time" ) var ( testString = "Albert Einstein: Logic will get you from A to B. Imagination will take you everywhere."...
ToStringEmpty(t *testing.T) { if got := BytesToString([]byte{}); got != "" { t.Fatalf("BytesToString([]byte{}) = %q; want empty string", got) } if got := BytesToString(nil); got != "" { t.Fatalf("BytesToString(nil) = %q; want empty string", got) }
(t *testing.T) { data := make([]byte, 1024) for range 100 { _, err := cRand.Read(data) if err != nil { t.Fatal(err) } if rawBytesToStr(data) != BytesToString(data) { t.Fatal("don't match") } } } func TestBytes
{ "filepath": "internal/bytesconv/bytesconv_test.go", "language": "go", "file_size": 2810, "cut_index": 563, "middle_length": 229 }
l rights reserved. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. //go:build go_json package json import ( "io" "github.com/goccy/go-json" ) // Package indicates what library is being used for JSON encoding. const Package = "github.com/goccy/go-json" func...
i) MarshalIndent(v any, prefix, indent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent) } func (j gojsonApi) NewEncoder(writer io.Writer) Encoder { return json.NewEncoder(writer) } func (j gojsonApi) NewDecoder(reader io.Reader) D
return json.Unmarshal(data, v) } func (j gojsonAp
{ "filepath": "codec/json/go_json.go", "language": "go", "file_size": 898, "cut_index": 547, "middle_length": 52 }
ource code is governed by a MIT style // license that can be found in the LICENSE file. //go:build sonic && (linux || windows || darwin) package json import ( "io" "github.com/bytedance/sonic" ) // Package indicates what library is being used for JSON encoding. const Package = "github.com/bytedance/sonic" func ...
v) } func (j sonicApi) MarshalIndent(v any, prefix, indent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent) } func (j sonicApi) NewEncoder(writer io.Writer) Encoder { return json.NewEncoder(writer) } func (j sonicApi) NewDecoder
[]byte, v any) error { return json.Unmarshal(data,
{ "filepath": "codec/json/sonic.go", "language": "go", "file_size": 953, "cut_index": 582, "middle_length": 52 }
l\StrlenZeroToIdenticalEmptyStringRector; use Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector; use Rector\CodingStyle\Rector\Closure\ClosureDelegatingCallToFirstClassCallableRector; use Rector\CodingStyle\Rector\FuncCall\ClosureFromCallableToFirstClassCallableRector; use Re...
ctor\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector; use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector; use Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector; use Rector\Php71\Rector\BinaryOp\BinaryOpBet
55\Rector\Class_\ClassConstantToSelfClassRector; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php56\Rector\FuncCall\PowToExpRector; use Rector\Php70\Rector\FuncCall\RandomFunctionRector; use Re
{ "filepath": "rector.php", "language": "php", "file_size": 7355, "cut_index": 716, "middle_length": 229 }
Builder; use Illuminate\Database\Query\Builder; use function PHPStan\Testing\assertType; /** @param \Illuminate\Database\Eloquent\Builder<\User> $userQuery */ function test(Builder $query, EloquentBuilder $userQuery): void { assertType('stdClass|null', $query->first()); assertType('stdClass|null', $query->fin...
sertType('Illuminate\Database\Query\Builder', $query->joinSub($userQuery, 'alias', 'foo')); assertType('Illuminate\Database\Query\Builder', $query->joinLateral($userQuery, 'alias')); assertType('Illuminate\Database\Query\Builder', $query->leftJoinL
', $query->selectSub($userQuery, 'alias')); assertType('Illuminate\Database\Query\Builder', $query->fromSub($userQuery, 'alias')); assertType('Illuminate\Database\Query\Builder', $query->from($userQuery, 'alias')); as
{ "filepath": "types/Database/Query/Builder.php", "language": "php", "file_size": 3689, "cut_index": 614, "middle_length": 229 }
Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\HasCollection; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Carbon; use User; use function PHPStan\Testing\assertType; function test(User $user, Post $post, Comment $comment, Article $article): void { assertType('UserFact...
})); User::addGlobalScope('ancient', function ($builder) { assertType('Illuminate\Database\Eloquent\Builder<User>', $builder); $builder->where('created_at', '<', Carbon::now()->subYears(2000)); }); assertType('Illuminate\Da
})); assertType('UserFactory', User::factory(42, function ($attributes, $model) { assertType('array<string, mixed>', $attributes); assertType('User|null', $model); return ['string' => 'string'];
{ "filepath": "types/Database/Eloquent/Model.php", "language": "php", "file_size": 3460, "cut_index": 614, "middle_length": 229 }
an\Testing\assertType; assertType( 'Illuminate\Contracts\Database\Eloquent\CastsAttributes<Illuminate\Database\Eloquent\Casts\ArrayObject<(int|string), mixed>, iterable>', \Illuminate\Database\Eloquent\Casts\AsArrayObject::castUsing([]), ); assertType( 'Illuminate\Contracts\Database\Eloquent\CastsAttribut...
e\Eloquent\CastsAttributes<Illuminate\Support\Collection<(int|string), mixed>, iterable>', \Illuminate\Database\Eloquent\Casts\AsEncryptedCollection::castUsing([]), ); assertType( 'Illuminate\Contracts\Database\Eloquent\CastsAttributes<Illuminate\
ent\CastsAttributes<Illuminate\Database\Eloquent\Casts\ArrayObject<(int|string), mixed>, iterable>', \Illuminate\Database\Eloquent\Casts\AsEncryptedArrayObject::castUsing([]), ); assertType( 'Illuminate\Contracts\Databas
{ "filepath": "types/Database/Eloquent/Casts/Castable.php", "language": "php", "file_size": 1637, "cut_index": 537, "middle_length": 229 }
php use Illuminate\Contracts\Cache\Repository; use Illuminate\Support\Carbon; use function PHPStan\Testing\assertType; /** @var Repository $cache */ $cache = resolve(Repository::class); assertType('mixed', $cache->get('key')); assertType('mixed', $cache->get('cache', 27)); assertType('mixed', $cache->get('cache', f...
sertType('33', $cache->sear('cache', function (): int { return 33; })); assertType('36', $cache->remember('cache', Carbon::now(), function (): int { return 36; })); assertType('36', $cache->rememberForever('cache', function (): int { return 36;
rn 30; })); as
{ "filepath": "types/Contracts/Cache/Repository.php", "language": "php", "file_size": 790, "cut_index": 514, "middle_length": 14 }
rt\LazyCollection<int, int>', LazyCollection::make($iterable)); assertType('Illuminate\Support\LazyCollection<int, string>', LazyCollection::make($traversable)); assertType('Illuminate\Support\LazyCollection<int, User>', LazyCollection::make($generator)); assertType('Illuminate\Support\LazyCollection<int, User>', $col...
n::range(1, 100)); assertType('Illuminate\Support\LazyCollection<(int|string), string>', $collection::wrap('string')); assertType('Illuminate\Support\LazyCollection<(int|string), User>', $collection::wrap(new User)); assertType('Illuminate\Support\LazyCo
return new User; })); assertType('Illuminate\Support\LazyCollection<int, User>', $collection->each(function ($user) { assertType('User', $user); })); assertType('Illuminate\Support\LazyCollection<int, int>', $collectio
{ "filepath": "types/Support/LazyCollection.php", "language": "php", "file_size": 44704, "cut_index": 2151, "middle_length": 229 }
leware = new Middleware(); $middleware->convertEmptyStringsToNull(except: [ fn (Request $request): bool => $request->has('skip-all-1'), fn (Request $request): bool => $request->has('skip-all-2'), ]); $middleware->trimStrings(except: [ 'aaa', fn (Request $request): bool => $request->has('skip-all'), ])...
DER_X_FORWARDED_AWS_ELB); $middleware->trustHosts(); $middleware->trustHosts(at: ['laravel.test']); $middleware->trustHosts(at: ['laravel.test'], subdomains: false); $middleware->encryptCookies(); $middleware->encryptCookies([ 'cookie1', 'cookie2
B); $middleware->trustProxies(headers: Request::HEA
{ "filepath": "types/Foundation/Configuration/Middleware.php", "language": "php", "file_size": 921, "cut_index": 606, "middle_length": 52 }
gin a fluent query against a database table. * * @param \Closure|\Illuminate\Database\Query\Builder|\UnitEnum|string $table * @param string|null $as * @return \Illuminate\Database\Query\Builder */ public function table($table, $as = null); /** * Get a new raw query expression....
do = true); /** * Run a select statement and return the first column of the first row. * * @param string $query * @param array $bindings * @param bool $useReadPdo * @return mixed * * @throws \Illuminate\Da
tement and return a single result. * * @param string $query * @param array $bindings * @param bool $useReadPdo * @return mixed */ public function selectOne($query, $bindings = [], $useReadP
{ "filepath": "src/Illuminate/Database/ConnectionInterface.php", "language": "php", "file_size": 4417, "cut_index": 614, "middle_length": 229 }
implements LostConnectionDetectorContract { /** * Determine if the given exception was caused by a lost connection. * * @param \Throwable $e * @return bool */ public function causedByLostConnection(Throwable $e): bool { $message = $e->getMessage(); return Str::con...
r writing data to the connection', 'Resource deadlock avoided', 'Transaction() on null', 'child connection forced to terminate due to client_idle_limit', 'query_wait_timeout', 'reset by peer',
enabled', 'Error while sending', 'decryption failed or bad record mac', 'server closed the connection unexpectedly', 'SSL connection has been closed unexpectedly', 'Erro
{ "filepath": "src/Illuminate/Database/LostConnectionDetector.php", "language": "php", "file_size": 5425, "cut_index": 716, "middle_length": 229 }
iqueConstraintViolationException extends QueryException { /** * The unique index which prevented the query. * * @var string|null */ public ?string $index = null; /** * The columns which caused the violation. * * @var list<string> */ public array $columns = []; ...
} /** * Set the columns that caused the violation. * * @param list<string> $columns * @return $this */ public function setColumns(array $columns): self { $this->columns = $columns; return $this;
$this->index = $index; return $this;
{ "filepath": "src/Illuminate/Database/UniqueConstraintViolationException.php", "language": "php", "file_size": 876, "cut_index": 559, "middle_length": 52 }
nsole\ConfirmableTrait; use Illuminate\Console\Prohibitable; use Illuminate\Database\ConnectionResolverInterface as Resolver; use Illuminate\Database\Eloquent\Model; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; #[...
* @var \Illuminate\Database\ConnectionResolverInterface */ protected $resolver; /** * Create a new database seed command instance. * * @param \Illuminate\Database\ConnectionResolverInterface $resolver */ public funct
d $name = 'db:seed'; /** * The console command description. * * @var string */ protected $description = 'Seed the database with records'; /** * The connection resolver instance. *
{ "filepath": "src/Illuminate/Database/Console/Seeds/SeedCommand.php", "language": "php", "file_size": 3554, "cut_index": 614, "middle_length": 229 }
use Illuminate\Support\Collection; use Illuminate\Support\Stringable; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; #[AsCommand(name: 'migrate:status')] class StatusCommand extends BaseCommand { /** * The console command name. * * @var string ...
inate\Database\Migrations\Migrator $migrator */ public function __construct(Migrator $migrator) { parent::__construct(); $this->migrator = $migrator; } /** * Execute the console command. * * @return in
'; /** * The migrator instance. * * @var \Illuminate\Database\Migrations\Migrator */ protected $migrator; /** * Create a new migration rollback command instance. * * @param \Illum
{ "filepath": "src/Illuminate/Database/Console/Migrations/StatusCommand.php", "language": "php", "file_size": 4388, "cut_index": 614, "middle_length": 229 }
?php use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\MassPrunable; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Not...
ctory = UserFactory::class; } /** @extends Factory<User> */ class UserFactory extends Factory { protected $model = User::class; public function definition(): array { return []; } } class Post extends Model { } enum UserType { }
use SoftDeletes; protected static string $fa
{ "filepath": "types/Autoload.php", "language": "php", "file_size": 821, "cut_index": 513, "middle_length": 52 }
ate\Types\Builder\User>', $query->orWhere('name', 'John')); assertType('Illuminate\Database\Eloquent\Builder<Illuminate\Types\Builder\User>', $query->whereNot('status', 'active')); assertType('Illuminate\Database\Eloquent\Builder<Illuminate\Types\Builder\User>', $query->with('relation')); assertType('Illumi...
es\Builder\User>', $query->without('relation')); assertType('Illuminate\Database\Eloquent\Builder<Illuminate\Types\Builder\User>', $query->withOnly(['relation'])); assertType('Illuminate\Database\Eloquent\Builder<Illuminate\Types\Builder\User>', $q
uilder\User>', $query->with(['relation' => function ($query) { // assertType('Illuminate\Database\Eloquent\Relations\Relation<*,*,*>', $query); }])); assertType('Illuminate\Database\Eloquent\Builder<Illuminate\Typ
{ "filepath": "types/Database/Eloquent/Builder.php", "language": "php", "file_size": 20275, "cut_index": 1331, "middle_length": 229 }
t, User>', $collection->load('string')); assertType('Illuminate\Database\Eloquent\Collection<int, User>', $collection->load(['string'])); assertType('Illuminate\Database\Eloquent\Collection<int, User>', $collection->load(['string' => ['foo' => fn ($q) => $q]])); assertType('Illuminate\Database\Eloquent\Collection<int, ...
\Collection<int, User>', $collection->loadAggregate(['string' => ['foo' => fn ($q) => $q]], 'string')); assertType('Illuminate\Database\Eloquent\Collection<int, User>', $collection->loadAggregate(['string'], 'string', 'string')); assertType('Illuminate\Dat
Collection<int, User>', $collection->loadAggregate('string', 'string')); assertType('Illuminate\Database\Eloquent\Collection<int, User>', $collection->loadAggregate(['string'], 'string')); assertType('Illuminate\Database\Eloquent
{ "filepath": "types/Database/Eloquent/Collection.php", "language": "php", "file_size": 11306, "cut_index": 921, "middle_length": 229 }
<?php namespace Illuminate\Types\Scope; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use function PHPStan\Testing\assertType; /** * @implements Scope<User> */ class UserScope implements Scope { public function apply(Builder $builder,...
nate\Database\Eloquent\Model>', $builder); assertType('Illuminate\Database\Eloquent\Model', $model); } } class User extends Model { } $user = new User(); $query = User::query(); (new UserScope())->apply($query, $user); (new GenericScope())->a
); } } /** * @implements Scope<Model> */ class GenericScope implements Scope { public function apply(Builder $builder, Model $model): void { assertType('Illuminate\Database\Eloquent\Builder<covariant Illumi
{ "filepath": "types/Database/Eloquent/Scope.php", "language": "php", "file_size": 1018, "cut_index": 512, "middle_length": 229 }
mment $comment, ChildUser $child): void { assertType('Illuminate\Database\Eloquent\Relations\HasOne<Illuminate\Types\Relations\Address, Illuminate\Types\Relations\User>', $user->address()); assertType('Illuminate\Types\Relations\Address|null', $user->address()->getResults()); assertType('Illuminate\Database...
ype('Illuminate\Types\Relations\Address', $child->address()->make()); assertType('Illuminate\Types\Relations\Address', $child->address()->create([])); assertType('Illuminate\Types\Relations\Address', $child->address()->getRelated()); assertType
nate\Types\Relations\Address', $user->address()->create()); assertType('Illuminate\Database\Eloquent\Relations\HasOne<Illuminate\Types\Relations\Address, Illuminate\Types\Relations\ChildUser>', $child->address()); assertT
{ "filepath": "types/Database/Eloquent/Relations.php", "language": "php", "file_size": 23136, "cut_index": 1331, "middle_length": 229 }
{ protected $model = User::class; /** @return array<string, mixed> */ public function definition(): array { return []; } } /** @extends Illuminate\Database\Eloquent\Factories\Factory<Post> */ class PostFactory extends Factory { protected $model = Post::class; /** @return array<st...
ry->definition()); assertType('UserFactory', $factory::times(10)); assertType('UserFactory', $factory->configure()); assertType('array<int|string, mixed>', $factory->raw()); assertType('array<int|string, mixed>', $factory->raw(['string' => 'string']));
'string' => 'string'])); assertType('UserFactory', UserFactory::new(function ($attributes) { assertType('array<string, mixed>', $attributes); return ['string' => 'string']; })); assertType('array<string, mixed>', $facto
{ "filepath": "types/Database/Eloquent/Factories/Factory.php", "language": "php", "file_size": 7151, "cut_index": 716, "middle_length": 229 }
hp use Illuminate\Config\Repository; use Illuminate\Container\Container; use function PHPStan\Testing\assertType; $container = resolve(Container::class); assertType('stdClass', $container->instance('foo', new stdClass)); assertType('mixed', $container->get('foo')); assertType('Illuminate\Config\Repository', $conta...
makeWith(Repository::class)); assertType('Illuminate\Config\Repository', $container->build(Repository::class)); assertType('Illuminate\Config\Repository', $container->build(function (Container $container, array $parameters) { return new Repository($pa
rtType('mixed', $container->make('foo')); assertType('Illuminate\Config\Repository', $container->make(Repository::class)); assertType('mixed', $container->makeWith('foo')); assertType('Illuminate\Config\Repository', $container->
{ "filepath": "types/Container/Container.php", "language": "php", "file_size": 1103, "cut_index": 515, "middle_length": 229 }
$array = [new User]; /** @var iterable<int, User> $iterable */ $iterable = []; /** @var Traversable<int, User> $traversable */ $traversable = new ArrayIterator([new User]); assertType('User|null', Arr::first($array)); assertType('User|null', Arr::first($array, function ($user) { assertType('User', $user); ret...
tring'|User", Arr::first($iterable, function ($user) { assertType('User', $user); return false; }, 'string')); assertType("'string'|User", Arr::first($iterable, null, function () { return 'string'; })); assertType('User|null', Arr::first($tra
null, function () { return 'string'; })); assertType('User|null', Arr::first($iterable)); assertType('User|null', Arr::first($iterable, function ($user) { assertType('User', $user); return true; })); assertType("'s
{ "filepath": "types/Support/Arr.php", "language": "php", "file_size": 6501, "cut_index": 716, "middle_length": 229 }
>', $collection::make($collection)); assertType('Illuminate\Support\Collection<int, User>', $collection::make($collection)); assertType('Illuminate\Support\Collection<int, int>', $collection::make($iterable)); assertType('Illuminate\Support\Collection<int, string>', $collection::make($traversable)); assertType('Illumi...
ection<int, int>', $collection::range(1, 100)); assertType('Illuminate\Support\Collection<(int|string), string>', $collection::wrap('string')); assertType('Illuminate\Support\Collection<(int|string), User>', $collection::wrap(new User)); assertType('Illu
$collection::times(10, function () { return new User; })); assertType('Illuminate\Support\Collection<int, User>', $collection->each(function ($user) { assertType('User', $user); })); assertType('Illuminate\Support\Coll
{ "filepath": "types/Support/Collection.php", "language": "php", "file_size": 50339, "cut_index": 2151, "middle_length": 229 }
hp use Illuminate\Support\Fluent; use function PHPStan\Testing\assertType; $fluent = new Fluent(['name' => 'Taylor', 'age' => 25, 'user' => new User]); assertType("Illuminate\Support\Fluent<string, 25|'Taylor'|User>", $fluent); assertType('Illuminate\Support\Fluent<string, string>', new Fluent(['name' => 'Taylor'])...
|null", $fluent->get('foobar')); assertType("25|'Taylor'|'zonda'|User", $fluent->get('foobar', 'zonda')); assertType("array<string, 25|'Taylor'|User>", $fluent->getAttributes()); assertType("array<string, 25|'Taylor'|User>", $fluent->toArray()); assertType
ylor'|User|null", $fluent['name']); assertType("25|'Taylor'|User|null", $fluent['age']); assertType("25|'Taylor'|User|null", $fluent['age']); assertType("25|'Taylor'|User|null", $fluent->get('name')); assertType("25|'Taylor'|User
{ "filepath": "types/Support/Fluent.php", "language": "php", "file_size": 1063, "cut_index": 515, "middle_length": 229 }
led($value)) { assertType('bool|float|int|non-empty-string', $value); } else { assertType('string|null', $value); } if (blank($value)) { assertType('string|null', $value); } else { assertType('bool|float|int|non-empty-string', $value); } assertType('User', object_get(new User(), null)); assertType('Us...
})); assertType('1', retry(5, fn () => 1)); assertType('object', str()); assertType('Illuminate\Support\Stringable', str('foo')); assertType('User', tap(new User(), function ($user) { assertType('User', $user); })); assertType('Illuminate\Support\H
id (testing void) */ })); assertType('Illuminate\Support\Optional', optional()); assertType('null', optional(null, fn () => 1)); assertType('1', optional('foo', function ($value) { assertType("'foo'", $value); return 1;
{ "filepath": "types/Support/Helpers.php", "language": "php", "file_size": 3537, "cut_index": 614, "middle_length": 229 }
* @var mixed $ulid * @var mixed $url * @var mixed $uuid * @var string $strStartsWith */ if (Str::isJson($json)) { assertType('non-empty-string', $json); } else { assertType('mixed', $json); } if (Str::isUlid($ulid)) { assertType('non-empty-string', $ulid); } else { assertType('mixed', $ulid); } i...
assertType('string', $strStartsWith); } else { assertType('non-empty-string', $strStartsWith); } /** * @var string $search * @var string $replace * @var string $subject */ assertType('string', Str::replace($search, $replace, $subject)); assertTyp
sertType('mixed', $uuid); } if (Str::startsWith($strStartsWith, '')) { assertType('non-empty-string', $strStartsWith); } else { assertType('string', $strStartsWith); } if (Str::doesntStartWith($strStartsWith, '')) {
{ "filepath": "types/Support/Str.php", "language": "php", "file_size": 4520, "cut_index": 614, "middle_length": 229 }
use function PHPStan\Testing\assertType; assertType("'foo'", value('foo', 42)); assertType('42', value(fn () => 42)); assertType('42', value(function ($foo) { assertType('true', $foo); return 42; }, true)); assertType("'foo'", when(true, 'foo')); assertType("'foo'", when(true, 'foo', 42)); assertType('null'...
en(-42, 'foo')); assertType('null', when(null, 'foo')); assertType('42', when(['foo'], 42)); assertType('null', when([], 42)); assertType('42|null', when(random_int(0, 1), 42)); assertType('42|1337', when(random_int(0, 1), 42, 1337)); assertType("array{'ba
', when(false, fn () => 'foo')); assertType('42', when(false, fn () => 'foo', fn () => 42)); assertType("'foo'", when(1, 'foo', 42)); assertType("'foo'", when(42, 'foo')); assertType('null', when(0, 'foo')); assertType('null', wh
{ "filepath": "types/Collections/helpers.php", "language": "php", "file_size": 1191, "cut_index": 518, "middle_length": 229 }
<?php use Illuminate\Config\Repository; use Illuminate\Foundation\Application; use function PHPStan\Testing\assertType; $app = resolve(Application::class); assertType('stdClass', $app->instance('foo', new stdClass)); assertType('mixed', $app->get('foo')); assertType('Illuminate\Config\Repository', $app->get(Reposi...
e\Config\Repository', $app->build(Repository::class)); assertType('Illuminate\Config\Repository', $app->build(function (Application $app, array $parameters) { return new Repository($parameters); })); assertType('stdClass', $app->build(function () {
foo')); assertType('Illuminate\Config\Repository', $app->make(Repository::class)); assertType('mixed', $app->makeWith('foo')); assertType('Illuminate\Config\Repository', $app->makeWith(Repository::class)); assertType('Illuminat
{ "filepath": "types/Foundation/Application.php", "language": "php", "file_size": 1026, "cut_index": 512, "middle_length": 229 }
esponse; use Illuminate\Http\Response; use Illuminate\Testing\TestResponse; use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\StreamedResponse; use function PHPStan\Testing\assertType; $response = TestResponse::fromBaseResponse(response('Laravel', 200)); assertType(Response...
ertType(BinaryFileResponse::class, $response->baseResponse); $response = TestResponse::fromBaseResponse(response()->json()); assertType(JsonResponse::class, $response->baseResponse); $response = TestResponse::fromBaseResponse(response()->streamDownload(f
nse::fromBaseResponse(response()->download('')); ass
{ "filepath": "types/Testing/TestResponse.php", "language": "php", "file_size": 965, "cut_index": 582, "middle_length": 52 }
ion PHPStan\Testing\assertType; assertType('Illuminate\Foundation\Application', app()); assertType('mixed', app('foo')); assertType('Illuminate\Config\Repository', app(Repository::class)); assertType('Illuminate\Contracts\Auth\Factory', auth()); assertType('Illuminate\Contracts\Auth\Guard', auth('foo')); assertType(...
d', context('foo')); assertType('Illuminate\Cookie\CookieJar', cookie()); assertType('Symfony\Component\HttpFoundation\Cookie', cookie('foo')); assertType('Illuminate\Foundation\Bus\PendingDispatch', dispatch('foo')); assertType('Illuminate\Foundation\Bu
Type('null', config(['foo' => 'bar'])); assertType('mixed', config('foo')); assertType('Illuminate\Log\Context\Repository', context()); assertType('Illuminate\Log\Context\Repository', context(['foo' => 'bar'])); assertType('mixe
{ "filepath": "types/Foundation/Helpers.php", "language": "php", "file_size": 2566, "cut_index": 563, "middle_length": 229 }
?php use Illuminate\Cache\Repository; use Illuminate\Support\Carbon; use function PHPStan\Testing\assertType; /** @var Repository $cache */ $cache = resolve(Repository::class); assertType('mixed', $cache->get('key')); assertType('mixed', $cache->get('cache', 27)); assertType('mixed', $cache->get('cache', function (...
tType('33', $cache->sear('cache', function (): int { return 33; })); assertType('36', $cache->remember('cache', Carbon::now(), function (): int { return 36; })); assertType('36', $cache->rememberForever('cache', function (): int { return 36; })
30; })); asser
{ "filepath": "types/Cache/Repository.php", "language": "php", "file_size": 786, "cut_index": 513, "middle_length": 14 }
namespace Illuminate\Types\Foundation\Testing; use Illuminate\Contracts\Foundation\Application; use Illuminate\Foundation\Testing\Concerns\InteractsWithContainer; use User; use function PHPStan\Testing\assertType; class InteractsWithContainerTestCase { use InteractsWithContainer; protected Application $app...
assertType('Mockery\MockInterface&User', $this->spy(User::class)); assertType('Mockery\MockInterface&User', $this->spy(User::class, function ($mock) { })); assertType('Mockery\MockInterface', $this->mock('my.service'));
function ($mock) { })); assertType('Mockery\MockInterface&User', $this->partialMock(User::class)); assertType('Mockery\MockInterface&User', $this->partialMock(User::class, function ($mock) { }));
{ "filepath": "types/Foundation/Testing/InteractsWithContainer.php", "language": "php", "file_size": 1159, "cut_index": 518, "middle_length": 229 }
sting; use Illuminate\Foundation\Testing\Concerns\InteractsWithTime; use Illuminate\Support\Carbon; use function PHPStan\Testing\assertType; class InteractsWithTimeTestCase { use InteractsWithTime; public function test(): void { assertType(Carbon::class, $this->freezeTime()); assertType(...
pe('42', $this->freezeSecond(fn (Carbon $date) => 42)); // @phpstan-ignore method.void assertType('null', $this->travelTo(Carbon::now(), function () { })); assertType('42', $this->travelTo(Carbon::now(), fn () => 42));
$this->freezeSecond(fn () => 42)); assertTy
{ "filepath": "types/Foundation/Testing/InteractsWithTime.php", "language": "php", "file_size": 871, "cut_index": 559, "middle_length": 52 }
pace Illuminate\Database; use Illuminate\Contracts\Database\ConcurrencyErrorDetector as ConcurrencyErrorDetectorContract; use Illuminate\Support\Str; use PDOException; use Throwable; class ConcurrencyErrorDetector implements ConcurrencyErrorDetectorContract { /** * Determine if the given exception was caused...
'Deadlock found when trying to get lock', 'deadlock detected', 'The database file is locked', 'database is locked', 'database table is locked', 'A table in the database is locked',
: bool { if ($e instanceof PDOException && ($e->getCode() === 40001 || $e->getCode() === '40001')) { return true; } $message = $e->getMessage(); return Str::contains($message, [
{ "filepath": "src/Illuminate/Database/ConcurrencyErrorDetector.php", "language": "php", "file_size": 1316, "cut_index": 524, "middle_length": 229 }
e = new Wormhole(1); $voidFunction = function () { }; assertType('42', $wormhole->seconds(fn () => 42)); assertType('42', $wormhole->second(fn () => 42)); assertType('42', $wormhole->minutes(fn () => 42)); assertType('42', $wormhole->minute(fn () => 42)); assertType('42', $wormhole->hours(fn () => 42)); assertType('4...
; assertType('42', $wormhole->microseconds(fn () => 42)); assertType('42', $wormhole->microsecond(fn () => 42)); assertType('42', $wormhole->milliseconds(fn () => 42)); assertType('42', $wormhole->millisecond(fn () => 42)); /** @phpstan-ignore method.void
2', $wormhole->week(fn () => 42)); assertType('42', $wormhole->months(fn () => 42)); assertType('42', $wormhole->month(fn () => 42)); assertType('42', $wormhole->years(fn () => 42)); assertType('42', $wormhole->year(fn () => 42))
{ "filepath": "types/Foundation/Testing/Wormhole.php", "language": "php", "file_size": 4057, "cut_index": 614, "middle_length": 229 }
atabase; /** * The type of the connection. * * @var string|null */ protected $readWriteType; /** * The table prefix for the connection. * * @var string */ protected $tablePrefix = ''; /** * The database connection configuration options. * * @...
* @var \Illuminate\Database\Schema\Grammars\Grammar */ protected $schemaGrammar; /** * The query post processor implementation. * * @var \Illuminate\Database\Query\Processors\Processor */ protected $postProcessor;
tected $reconnector; /** * The query grammar implementation. * * @var \Illuminate\Database\Query\Grammars\Grammar */ protected $queryGrammar; /** * The schema grammar implementation. *
{ "filepath": "src/Illuminate/Database/Connection.php", "language": "php", "file_size": 46662, "cut_index": 2151, "middle_length": 229 }
ination\CursorPaginator; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\Paginator; use function PHPStan\Testing\assertType; $items = [new Post(), new Post(), new Post()]; /** @var Paginator<int, Post> $paginator */ $paginator = new Paginator($items, 1, 1); assertType('array<int, Post>', $...
assertType('ArrayIterator<int, Post>', $lengthAwarePaginator->getIterator()); $lengthAwarePaginator->each(function ($post) { assertType('Post', $post); }); foreach ($lengthAwarePaginator as $post) { assertType('Post', $post); } /** @var CursorP
assertType('Post', $post); } /** @var LengthAwarePaginator<int, Post> $lengthAwarePaginator */ $lengthAwarePaginator = new LengthAwarePaginator($items, 1, 1); assertType('array<int, Post>', $lengthAwarePaginator->items());
{ "filepath": "types/Pagination/Paginator.php", "language": "php", "file_size": 1738, "cut_index": 537, "middle_length": 229 }
Generator; use Illuminate\Contracts\Database\ConcurrencyErrorDetector as ConcurrencyErrorDetectorContract; use Illuminate\Contracts\Database\LostConnectionDetector as LostConnectionDetectorContract; use Illuminate\Contracts\Queue\EntityResolver; use Illuminate\Database\Connectors\ConnectionFactory; use Illuminate\Datab...
del::setConnectionResolver($this->app['db']); Model::setEventDispatcher($this->app['events']); } /** * Register the service provider. * * @return void */ public function register() { Model::clearBootedM
ray of resolved Faker instances. * * @var array */ protected static $fakers = []; /** * Bootstrap the application events. * * @return void */ public function boot() { Mo
{ "filepath": "src/Illuminate/Database/DatabaseServiceProvider.php", "language": "php", "file_size": 3822, "cut_index": 614, "middle_length": 229 }
ection<int, \Illuminate\Database\DatabaseTransactionRecord> */ protected $committedTransactions; /** * All of the pending transactions. * * @var \Illuminate\Support\Collection<int, \Illuminate\Database\DatabaseTransactionRecord> */ protected $pendingTransactions; /** * Th...
* @param int $level * @return void */ public function begin($connection, $level) { $this->pendingTransactions->push( $newTransaction = new DatabaseTransactionRecord( $connection, $l
__construct() { $this->committedTransactions = new Collection; $this->pendingTransactions = new Collection; } /** * Start a new database transaction. * * @param string $connection
{ "filepath": "src/Illuminate/Database/DatabaseTransactionsManager.php", "language": "php", "file_size": 8640, "cut_index": 716, "middle_length": 229 }
Grammar { use Macroable; /** * The connection used for escaping values. * * @var \Illuminate\Database\Connection */ protected $connection; /** * Create a new grammar instance. * * @param \Illuminate\Database\Connection $connection */ public function __con...
* * @param \Illuminate\Contracts\Database\Query\Expression|string $table * @param string|null $prefix * @return string */ public function wrapTable($table, $prefix = null) { if ($this->isExpression($table)) {
pression|string> $values * @return array<string> */ public function wrapArray(array $values) { return array_map($this->wrap(...), $values); } /** * Wrap a table in keyword identifiers.
{ "filepath": "src/Illuminate/Database/Grammar.php", "language": "php", "file_size": 8211, "cut_index": 716, "middle_length": 229 }
ction Illuminate\Support\enum_value; /** * @mixin \Illuminate\Database\Connection */ class DatabaseManager implements ConnectionResolverInterface { use Macroable { __call as macroCall; } /** * The application instance. * * @var \Illuminate\Contracts\Foundation\Application */ ...
* * @var array<string, array> */ protected $dynamicConnectionConfigurations = []; /** * The custom connection resolvers. * * @var array<string, callable> */ protected $extensions = []; /** * The callbac
* The active connection instances. * * @var array<string, \Illuminate\Database\Connection> */ protected $connections = []; /** * The dynamically configured (DB::build) connection configurations.
{ "filepath": "src/Illuminate/Database/DatabaseManager.php", "language": "php", "file_size": 13999, "cut_index": 921, "middle_length": 229 }
seTransactionRecord { /** * The name of the database connection. * * @var string */ public $connection; /** * The transaction level. * * @var int */ public $level; /** * The parent instance of this transaction. * * @var \Illuminate\Database\Da...
string $connection * @param int $level * @param \Illuminate\Database\DatabaseTransactionRecord|null $parent */ public function __construct($connection, $level, ?DatabaseTransactionRecord $parent = null) { $this->connect
/** * The callbacks that should be executed after rollback. * * @var array */ protected $callbacksForRollback = []; /** * Create a new database transaction record instance. * * @param
{ "filepath": "src/Illuminate/Database/DatabaseTransactionRecord.php", "language": "php", "file_size": 2447, "cut_index": 563, "middle_length": 229 }
te\Database; class ConnectionResolver implements ConnectionResolverInterface { /** * All of the registered connections. * * @var \Illuminate\Database\ConnectionInterface[] */ protected $connections = []; /** * The default connection name. * * @var string */ prot...
* * @param string|null $name * @return \Illuminate\Database\ConnectionInterface */ public function connection($name = null) { if (is_null($name)) { $name = $this->getDefaultConnection(); } retu
on __construct(array $connections = []) { foreach ($connections as $name => $connection) { $this->addConnection($name, $connection); } } /** * Get a database connection instance.
{ "filepath": "src/Illuminate/Database/ConnectionResolver.php", "language": "php", "file_size": 1980, "cut_index": 537, "middle_length": 229 }
<?php namespace Illuminate\Database; use Illuminate\Container\Container; use Illuminate\Contracts\Database\ConcurrencyErrorDetector as ConcurrencyErrorDetectorContract; use Throwable; trait DetectsConcurrencyErrors { /** * Determine if the given exception was caused by a concurrency error such as a deadlock...
$detector = $container->bound(ConcurrencyErrorDetectorContract::class) ? $container[ConcurrencyErrorDetectorContract::class] : new ConcurrencyErrorDetector(); return $detector->causedByConcurrencyError($e); }
getInstance();
{ "filepath": "src/Illuminate/Database/DetectsConcurrencyErrors.php", "language": "php", "file_size": 784, "cut_index": 512, "middle_length": 14 }
ate\Database\Console\Migrations\InstallCommand; use Illuminate\Database\Console\Migrations\MigrateCommand; use Illuminate\Database\Console\Migrations\MigrateMakeCommand; use Illuminate\Database\Console\Migrations\RefreshCommand; use Illuminate\Database\Console\Migrations\ResetCommand; use Illuminate\Database\Console\Mi...
* * @var array */ protected $commands = [ 'Migrate' => MigrateCommand::class, 'MigrateFresh' => FreshCommand::class, 'MigrateInstall' => InstallCommand::class, 'MigrateRefresh' => RefreshCommand::class,
Creator; use Illuminate\Database\Migrations\Migrator; use Illuminate\Support\ServiceProvider; class MigrationServiceProvider extends ServiceProvider implements DeferrableProvider { /** * The commands to be registered.
{ "filepath": "src/Illuminate/Database/MigrationServiceProvider.php", "language": "php", "file_size": 6313, "cut_index": 716, "middle_length": 229 }
rammar as QueryGrammar; use Illuminate\Database\Query\Processors\PostgresProcessor; use Illuminate\Database\Schema\Grammars\PostgresGrammar as SchemaGrammar; use Illuminate\Database\Schema\PostgresBuilder; use Illuminate\Database\Schema\PostgresSchemaState; use Illuminate\Filesystem\Filesystem; class PostgresConnectio...
value for safe SQL embedding. * * @param bool $value * @return string */ protected function escapeBool($value) { return $value ? 'true' : 'false'; } /** * Determine if the given database exception was ca
edding. * * @param string $value * @return string */ protected function escapeBinary($value) { $hex = bin2hex($value); return "'\x{$hex}'::bytea"; } /** * Escape a bool
{ "filepath": "src/Illuminate/Database/PostgresConnection.php", "language": "php", "file_size": 3530, "cut_index": 614, "middle_length": 229 }
mmar as QueryGrammar; use Illuminate\Database\Query\Processors\SQLiteProcessor; use Illuminate\Database\Schema\Grammars\SQLiteGrammar as SchemaGrammar; use Illuminate\Database\Schema\SQLiteBuilder; use Illuminate\Database\Schema\SqliteSchemaState; use Illuminate\Filesystem\Filesystem; class SQLiteConnection extends Co...
$this->getPdo()->exec("BEGIN {$mode} TRANSACTION"); return; } $this->getPdo()->beginTransaction(); } /** * Escape a binary value for safe SQL embedding. * * @param string $value * @return s
* @return void */ protected function executeBeginTransactionStatement() { if (version_compare(PHP_VERSION, '8.4.0', '>=')) { $mode = $this->getConfig('transaction_mode') ?? 'DEFERRED';
{ "filepath": "src/Illuminate/Database/SQLiteConnection.php", "language": "php", "file_size": 3726, "cut_index": 614, "middle_length": 229 }
ars\SqlServerGrammar as QueryGrammar; use Illuminate\Database\Query\Processors\SqlServerProcessor; use Illuminate\Database\Schema\Grammars\SqlServerGrammar as SchemaGrammar; use Illuminate\Database\Schema\SqlServerBuilder; use Illuminate\Filesystem\Filesystem; use RuntimeException; use Throwable; class SqlServerConnec...
1; $a <= $attempts; $a++) { if ($this->getDriverName() === 'sqlsrv') { return parent::transaction($callback, $attempts); } $this->getPdo()->exec('BEGIN TRAN'); // We'll simply execute the gi
ion. * * @param \Closure $callback * @param int $attempts * @return mixed * * @throws \Throwable */ public function transaction(Closure $callback, $attempts = 1) { for ($a =
{ "filepath": "src/Illuminate/Database/SqlServerConnection.php", "language": "php", "file_size": 4591, "cut_index": 614, "middle_length": 229 }
te\Database\Query\Grammars\MariaDbGrammar as QueryGrammar; use Illuminate\Database\Query\Processors\MariaDbProcessor; use Illuminate\Database\Schema\Grammars\MariaDbGrammar as SchemaGrammar; use Illuminate\Database\Schema\MariaDbBuilder; use Illuminate\Database\Schema\MariaDbSchemaState; use Illuminate\Filesystem\Files...
nection. * * @return string */ public function getServerVersion(): string { return Str::between(parent::getServerVersion(), '5.5.5-', '-MariaDB'); } /** * Get the default query grammar instance. * * @r
} /** * Determine if the connected database is a MariaDB database. * * @return bool */ public function isMaria() { return true; } /** * Get the server version for the con
{ "filepath": "src/Illuminate/Database/MariaDbConnection.php", "language": "php", "file_size": 2451, "cut_index": 563, "middle_length": 229 }
use PDOException; use Throwable; class QueryException extends PDOException { /** * The database connection name. * * @var string */ public $connectionName; /** * The SQL for the query. * * @var string */ protected $sql; /** * The bindings for the query...
* @param string $connectionName * @param string $sql * @param array $bindings * @param \Throwable $previous * @param array $connectionDetails * @param null|'read'|'write' $readWriteType */ public function __co
teType; /** * The connection details for the query (host, port, database, etc.). * * @var array */ protected $connectionDetails = []; /** * Create a new query exception instance. *
{ "filepath": "src/Illuminate/Database/QueryException.php", "language": "php", "file_size": 4219, "cut_index": 614, "middle_length": 229 }
mar as QueryGrammar; use Illuminate\Database\Query\Processors\MySqlProcessor; use Illuminate\Database\Schema\Grammars\MySqlGrammar as SchemaGrammar; use Illuminate\Database\Schema\MySqlBuilder; use Illuminate\Database\Schema\MySqlSchemaState; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Str; use PDO; c...
* @param array $bindings * @param string|null $sequence * @return bool */ public function insert($query, $bindings = [], $sequence = null) { return $this->run($query, $bindings, function ($query, $bindings) use ($sequence
@inheritdoc} */ public function getDriverTitle() { return $this->isMaria() ? 'MariaDB' : 'MySQL'; } /** * Run an insert statement against the database. * * @param string $query
{ "filepath": "src/Illuminate/Database/MySqlConnection.php", "language": "php", "file_size": 4871, "cut_index": 614, "middle_length": 229 }
ponents\TwoColumnDetail; use Illuminate\Contracts\Container\Container; use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Support\Arr; use InvalidArgumentException; abstract class Seeder { /** * The container instance. * * @var \Illuminate\Contracts\Container\Container */ ...
$parameters * @return $this */ public function call($class, $silent = false, array $parameters = []) { $classes = Arr::wrap($class); foreach ($classes as $class) { $seeder = $this->resolve($class);
lled at least one time. * * @var array */ protected static $called = []; /** * Run the given seeder class. * * @param array|string $class * @param bool $silent * @param array
{ "filepath": "src/Illuminate/Database/Seeder.php", "language": "php", "file_size": 4731, "cut_index": 614, "middle_length": 229 }
ss\Exception\ProcessFailedException; use Symfony\Component\Process\Process; use UnexpectedValueException; #[AsCommand(name: 'db')] class DbCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'db {connection? : The database...
$connection = $this->getConnection(); if (! isset($connection['host']) && $connection['driver'] !== 'sqlite') { $this->components->error('No host specified for this database connection.'); $this->line(' Use the <options=bo
iption. * * @var string */ protected $description = 'Start a new database CLI session'; /** * Execute the console command. * * @return int */ public function handle() {
{ "filepath": "src/Illuminate/Database/Console/DbCommand.php", "language": "php", "file_size": 7588, "cut_index": 716, "middle_length": 229 }
ate\Database\ConnectionResolverInterface; use Illuminate\Database\Events\DatabaseBusy; use Illuminate\Support\Collection; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'db:monitor')] class MonitorCommand extends DatabaseInspectionCommand { /** * The name and signature of the console com...
database'; /** * The connection resolver instance. * * @var \Illuminate\Database\ConnectionResolverInterface */ protected $connection; /** * The events dispatcher instance. * * @var \Illuminate\Contracts\Ev
of connections that can be open before an event is dispatched}'; /** * The console command description. * * @var string */ protected $description = 'Monitor the number of connections on the specified
{ "filepath": "src/Illuminate/Database/Console/MonitorCommand.php", "language": "php", "file_size": 3944, "cut_index": 614, "middle_length": 229 }
ort\Arr; use Illuminate\Support\Collection; use Illuminate\Support\Number; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'db:show')] class ShowCommand extends DatabaseInspectionCommand { /** * The name and signature of the console command. * * @var string */ protected...
types}'; /** * The console command description. * * @var string */ protected $description = 'Display information about the given database'; /** * Execute the console command. * * @param \Illuminate\Database
ptions=bold> Note: This can be slow on large databases </>} {--views : Show the database views <bg=red;options=bold> Note: This can be slow on large databases </>} {--types : Show the user defined
{ "filepath": "src/Illuminate/Database/Console/ShowCommand.php", "language": "php", "file_size": 9102, "cut_index": 716, "middle_length": 229 }
/** * The name and signature of the console command. * * @var string */ protected $signature = 'db:table {table? : The name of the table} {--database= : The database connection} {--json : Output the table in...
')); $tables = (new Collection($connection->getSchemaBuilder()->getTables())) ->keyBy('schema_qualified_name')->all(); $tableNames = (new Collection($tables))->keys(); $tableName = $this->argument('table') ?: search(
/** * Execute the console command. * * @return int */ public function handle(ConnectionResolverInterface $connections) { $connection = $connections->connection($this->input->getOption('database
{ "filepath": "src/Illuminate/Database/Console/TableCommand.php", "language": "php", "file_size": 9553, "cut_index": 921, "middle_length": 229 }
pace Illuminate\Database\Console; use Illuminate\Console\Command; use Illuminate\Database\ConnectionInterface; use Illuminate\Support\Arr; abstract class DatabaseInspectionCommand extends Command { /** * Get a human-readable name for the given connection. * * @param \Illuminate\Database\Connection...
* * @deprecated */ protected function getConnectionCount(ConnectionInterface $connection) { return $connection->threadCount(); } /** * Get the connection configuration details for the given connection. *
ase) { return $connection->getDriverTitle(); } /** * Get the number of open connections for a database. * * @param \Illuminate\Database\ConnectionInterface $connection * @return int|null
{ "filepath": "src/Illuminate/Database/Console/DatabaseInspectionCommand.php", "language": "php", "file_size": 1281, "cut_index": 524, "middle_length": 229 }
ngFinished; use Illuminate\Database\Events\ModelPruningStarting; use Illuminate\Database\Events\ModelsPruned; use Illuminate\Support\Collection; use Illuminate\Support\Str; use InvalidArgumentException; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Finder\Finder; #[AsCommand(name: 'model:pru...
here models are located} {--chunk=1000 : The number of models to retrieve per chunk of models to be deleted} {--pretend : Display the number of prunable records found instead of deleting them}
-model=* : Class names of the models to be pruned} {--except=* : Class names of the models to be excluded from pruning} {--path=* : Absolute path(s) to directories w
{ "filepath": "src/Illuminate/Database/Console/PruneCommand.php", "language": "php", "file_size": 5813, "cut_index": 716, "middle_length": 229 }
ConfirmableTrait; use Illuminate\Console\Prohibitable; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; #[AsCommand(name: 'db:wipe')] class WipeCommand extends Command { use ConfirmableTrait, Prohibitable; /** * The console command name. * * @v...
:FAILURE; } $database = $this->input->getOption('database'); if ($this->option('drop-views')) { $this->dropAllViews($database); $this->components->info('Dropped all views successfully.'); }
types'; /** * Execute the console command. * * @return int */ public function handle() { if ($this->isProhibited() || ! $this->confirmToProceed()) { return Command:
{ "filepath": "src/Illuminate/Database/Console/WipeCommand.php", "language": "php", "file_size": 3136, "cut_index": 614, "middle_length": 229 }
Prohibitable; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Database\Connection; use Illuminate\Database\ConnectionResolverInterface; use Illuminate\Database\Events\MigrationsPruned; use Illuminate\Database\Events\SchemaDumped; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Facades\Config; us...
prune : Delete all existing migration files}'; /** * The console command description. * * @var string */ protected $description = 'Dump the given database schema'; /** * Execute the console command. * * @par
* @var string */ protected $signature = 'schema:dump {--database= : The database connection to use} {--path= : The path where the schema dump file should be stored} {--
{ "filepath": "src/Illuminate/Database/Console/DumpCommand.php", "language": "php", "file_size": 3181, "cut_index": 614, "middle_length": 229 }
te\Database\Console\Seeds; use Illuminate\Console\GeneratorCommand; use Illuminate\Support\Str; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'make:seeder')] class SeederMakeCommand extends GeneratorCommand { /** * The console command name. * * @var string */ protect...
(); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->resolveStubPath('/stubs/seeder.stub'); } /** * Resolve the fully-qualified path t
of class being generated. * * @var string */ protected $type = 'Seeder'; /** * Execute the console command. * * @return void */ public function handle() { parent::handle
{ "filepath": "src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php", "language": "php", "file_size": 1954, "cut_index": 537, "middle_length": 229 }
te\Console\ConfirmableTrait; use Illuminate\Console\Prohibitable; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Database\Events\DatabaseRefreshed; use Illuminate\Database\Migrations\Migrator; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; use Throwable; ...
ce. * * @var \Illuminate\Database\Migrations\Migrator */ protected $migrator; /** * Create a new fresh command instance. * * @param \Illuminate\Database\Migrations\Migrator $migrator */ public function __co
protected $name = 'migrate:fresh'; /** * The console command description. * * @var string */ protected $description = 'Drop all tables and re-run all migrations'; /** * The migrator instan
{ "filepath": "src/Illuminate/Database/Console/Migrations/FreshCommand.php", "language": "php", "file_size": 4822, "cut_index": 614, "middle_length": 229 }
r; use PDOException; use RuntimeException; use Symfony\Component\Console\Attribute\AsCommand; use Throwable; use function Laravel\Prompts\confirm; #[AsCommand(name: 'migrate')] class MigrateCommand extends BaseCommand implements Isolatable { use ConfirmableTrait; /** * The name and signature of the cons...
: The path to a schema dump file} {--pretend : Dump the SQL queries that would be run} {--seed : Indicates if the seed task should be re-run} {--seeder= : The class name of the root seeder} {
production} {--path=* : The path(s) to the migrations files to be executed} {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths} {--schema-path=
{ "filepath": "src/Illuminate/Database/Console/Migrations/MigrateCommand.php", "language": "php", "file_size": 11377, "cut_index": 921, "middle_length": 229 }
atcher; use Illuminate\Database\Events\DatabaseRefreshed; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; #[AsCommand(name: 'migrate:refresh')] class RefreshCommand extends Command { use ConfirmableTrait, Prohibitable; /** * The console command name. ...
return Command::FAILURE; } // Next we'll gather some of the options so that we can have the right options // to pass to the commands. This includes options such as which database to // use and the path to use for the m
and re-run all migrations'; /** * Execute the console command. * * @return int */ public function handle() { if ($this->isProhibited() || ! $this->confirmToProceed()) {
{ "filepath": "src/Illuminate/Database/Console/Migrations/RefreshCommand.php", "language": "php", "file_size": 5104, "cut_index": 716, "middle_length": 229 }
ions; use Illuminate\Console\Command; use Illuminate\Console\ConfirmableTrait; use Illuminate\Console\Prohibitable; use Illuminate\Database\Migrations\Migrator; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; #[AsCommand('migrate:rollback')] class RollbackCommand ex...
igrator */ protected $migrator; /** * Create a new migration rollback command instance. * * @param \Illuminate\Database\Migrations\Migrator $migrator */ public function __construct(Migrator $migrator) { p
* The console command description. * * @var string */ protected $description = 'Rollback the last database migration'; /** * The migrator instance. * * @var \Illuminate\Database\Migrations\M
{ "filepath": "src/Illuminate/Database/Console/Migrations/RollbackCommand.php", "language": "php", "file_size": 2768, "cut_index": 563, "middle_length": 229 }
lutionException; use Illuminate\Database\Eloquent\ModelInfo; use Illuminate\Database\Eloquent\ModelInspector; use Illuminate\Support\Collection; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Output\OutputInterface; use function Laravel\Prompts\suggest; #[AsCommand(name: 'model:show'...
console command signature. * * @var string */ protected $signature = 'model:show {model : The model to show} {--database= : The database connection to use} {--json : Output the model as JSON}'; /**
g */ protected $name = 'model:show {model}'; /** * The console command description. * * @var string */ protected $description = 'Show information about an Eloquent model'; /** * The
{ "filepath": "src/Illuminate/Database/Console/ShowModelCommand.php", "language": "php", "file_size": 5592, "cut_index": 716, "middle_length": 229 }
te\Database\Console\Migrations; use Illuminate\Console\Command; use Illuminate\Database\Migrations\MigrationRepositoryInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; #[AsCommand(name: 'migrate:install')] class InstallCommand extends Command { /** ...
* Create a new migration install command instance. * * @param \Illuminate\Database\Migrations\MigrationRepositoryInterface $repository */ public function __construct(MigrationRepositoryInterface $repository) { parent::__con
rotected $description = 'Create the migration repository'; /** * The repository instance. * * @var \Illuminate\Database\Migrations\MigrationRepositoryInterface */ protected $repository; /**
{ "filepath": "src/Illuminate/Database/Console/Migrations/InstallCommand.php", "language": "php", "file_size": 1726, "cut_index": 537, "middle_length": 229 }
ions; use Illuminate\Console\Command; use Illuminate\Console\ConfirmableTrait; use Illuminate\Console\Prohibitable; use Illuminate\Database\Migrations\Migrator; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; #[AsCommand(name: 'migrate:reset')] class ResetCommand ex...
*/ protected $migrator; /** * Create a new migration rollback command instance. * * @param \Illuminate\Database\Migrations\Migrator $migrator */ public function __construct(Migrator $migrator) { parent::
he console command description. * * @var string */ protected $description = 'Rollback all database migrations'; /** * The migrator instance. * * @var \Illuminate\Database\Migrations\Migrator
{ "filepath": "src/Illuminate/Database/Console/Migrations/ResetCommand.php", "language": "php", "file_size": 2750, "cut_index": 563, "middle_length": 229 }
MySqlProcessor extends Processor { /** * Process the results of a column listing query. * * @deprecated Will be removed in a future Laravel version. * * @param array $results * @return array */ public function processColumnListing($results) { return array_map(fun...
ll) { $query->getConnection()->insert($sql, $values, $sequence); $id = $query->getConnection()->getLastInsertId(); return is_numeric($id) ? (int) $id : $id; } /** @inheritDoc */ public function processColumns($res
Query\Builder $query * @param string $sql * @param array $values * @param string|null $sequence * @return int */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = nu
{ "filepath": "src/Illuminate/Database/Query/Processors/MySqlProcessor.php", "language": "php", "file_size": 3236, "cut_index": 614, "middle_length": 229 }
* @return TReturn * * @throws \Throwable */ public function transaction(Closure $callback, $attempts = 1) { for ($currentAttempt = 1; $currentAttempt <= $attempts; $currentAttempt++) { $this->beginTransaction(); // We'll simply execute the given callback within...
s. If we are out of attempts we will just throw the // exception back out, and let the developer handle an uncaught exception. catch (Throwable $e) { $this->handleTransactionException( $e, $curren
anent fashion. try { $callbackResult = $callback($this); } // If we catch an exception we'll rollback this transaction and try again if we // are not out of attempt
{ "filepath": "src/Illuminate/Database/Concerns/ManagesTransactions.php", "language": "php", "file_size": 10323, "cut_index": 921, "middle_length": 229 }
?php namespace Illuminate\Database\Eloquent; /** * @mixin \Illuminate\Database\Eloquent\Builder */ class HigherOrderBuilderProxy { /** * The collection being operated on. * * @var \Illuminate\Database\Eloquent\Builder<*> */ protected $builder; /** * The method being proxied. ...
* @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { return $this->builder->{$this->method}(function ($value) use ($method, $parameters) { retur
ng $method */ public function __construct(Builder $builder, $method) { $this->method = $method; $this->builder = $builder; } /** * Proxy a scope call onto the query builder. *
{ "filepath": "src/Illuminate/Database/Eloquent/HigherOrderBuilderProxy.php", "language": "php", "file_size": 1055, "cut_index": 513, "middle_length": 229 }
as BaseArrayObject; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Support\Collection; use JsonSerializable; /** * @template TKey of array-key * @template TItem * * @extends \ArrayObject<TKey, TItem> */ class ArrayObject extends BaseArrayObject implements Arrayable, JsonSerializable { /** * ...
n array. * * @return array */ public function toArray() { return $this->getArrayCopy(); } /** * Get the array that should be JSON serialized. * * @return array */ public function jsonSerialize
Copy()); } /** * Get the instance as a
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/ArrayObject.php", "language": "php", "file_size": 952, "cut_index": 582, "middle_length": 52 }
pace Illuminate\Database\Console\Migrations; use Illuminate\Console\Command; use Illuminate\Support\Collection; class BaseCommand extends Command { /** * Get all of the migration paths. * * @return string[] */ protected function getMigrationPaths() { // Here, we will check to s...
gRealPath() ? $this->laravel->basePath().'/'.$path : $path; })->all(); } return array_merge( $this->migrator->paths(), [$this->getMigrationPath()] ); } /**
zed path from within the application. if ($this->input->hasOption('path') && $this->option('path')) { return (new Collection($this->option('path')))->map(function ($path) { return ! $this->usin
{ "filepath": "src/Illuminate/Database/Console/Migrations/BaseCommand.php", "language": "php", "file_size": 1473, "cut_index": 524, "middle_length": 229 }
namespace Illuminate\Database\Eloquent\Casts; class Json { /** * The custom JSON encoder. * * @var callable|null */ protected static $encoder; /** * The custom JSON decode. * * @var callable|null */ protected static $decoder; /** * Encode the given va...
ic::$decoder)($value, $associative) : json_decode($value, $associative); } /** * Encode all values using the given callable. */ public static function encodeUsing(?callable $encoder): void { static::$encoder =
json_encode($value, $flags); } /** * Decode the given value. */ public static function decode(mixed $value, ?bool $associative = true): mixed { return isset(static::$decoder) ? (stat
{ "filepath": "src/Illuminate/Database/Eloquent/Casts/Json.php", "language": "php", "file_size": 1204, "cut_index": 518, "middle_length": 229 }
te\Database\Query\Grammars; use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\JoinLateralClause; use RuntimeException; class MariaDbGrammar extends MySqlGrammar { /** * Compile a "lateral join" clause. * * @param \Illuminate\Database\Query\JoinLateralClause $join * @param ...
public function compileJsonValueCast($value) { return "json_query({$value}, '$')"; } /** * Compile a query to get the number of open connections for a database. * * @return string */ public function compileThre
throw new RuntimeException('This database engine does not support lateral joins.'); } /** * Compile a "JSON value cast" statement into SQL. * * @param string $value * @return string */
{ "filepath": "src/Illuminate/Database/Query/Grammars/MariaDbGrammar.php", "language": "php", "file_size": 1732, "cut_index": 537, "middle_length": 229 }
issingInput; use Illuminate\Database\Migrations\MigrationCreator; use Illuminate\Support\Composer; use Illuminate\Support\Str; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'make:migration')] class MigrateMakeCommand extends BaseCommand implements PromptsForMissingInput { /** * The cons...
tput the full path of the migration (Deprecated)}'; /** * The console command description. * * @var string */ protected $description = 'Create a new migration file'; /** * The migration creator instance. * *
table= : The table to migrate} {--path= : The location where the migration file should be created} {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths} {--fullpath : Ou
{ "filepath": "src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php", "language": "php", "file_size": 4611, "cut_index": 614, "middle_length": 229 }
E_PATTERNS = [ '/^create_(\w+)_table$/', '/^create_(\w+)$/', ]; const CHANGE_PATTERNS = [ '/.+_(to|from|in)_(\w+)_table$/', '/.+_(to|from|in)_(\w+)$/', ]; /** * Attempt to guess the table name and "creation" status of the given migration. * * @param stri...
urn [$matches[1], $create = true]; } } foreach (self::CHANGE_PATTERNS as $pattern) { if (preg_match($pattern, $migration, $matches)) { return [$matches[2], $create = false]; } }
attern, $migration, $matches)) { ret
{ "filepath": "src/Illuminate/Database/Console/Migrations/TableGuesser.php", "language": "php", "file_size": 921, "cut_index": 606, "middle_length": 52 }
Illuminate\Support\Str; use Illuminate\Support\Stringable; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; #[AsCommand(name: 'make:factory')] class FactoryMakeCommand extends GeneratorCommand { /** * The console command name. * * @var string *...
) { return $this->resolveStubPath('/stubs/factory.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) {
* The type of class being generated. * * @var string */ protected $type = 'Factory'; /** * Get the stub file for the generator. * * @return string */ protected function getStub(
{ "filepath": "src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php", "language": "php", "file_size": 3724, "cut_index": 614, "middle_length": 229 }
hey have not been defined. if (isset($query->groupLimit)) { if (is_null($query->columns)) { $query->columns = ['*']; } return $this->compileGroupLimit($query); } // If the query does not have any columns set, we'll set the columns to the ...
ll just call the compiler // function for the component which is responsible for making the SQL. $sql = trim($this->concatenate( $this->compileComponents($query)) ); if ($query->unions) { $sql = $thi
if (is_null($query->columns)) { $query->columns = ['*']; } // To compile the query, we'll spin through each component of the query and // see if that component exists. If it does we'
{ "filepath": "src/Illuminate/Database/Query/Grammars/Grammar.php", "language": "php", "file_size": 47088, "cut_index": 2151, "middle_length": 229 }
s = []; /** * The grammar specific bitwise operators. * * @var array */ protected $bitwiseOperators = [ '~', '&', '|', '#', '<<', '>>', '<<=', '>>=', ]; /** * Indicates if the cascade option should be used when truncating. * * @var bool */ protected ...
ap($where['column']), $where['operator'], $this->parameter($where['value']) ); } return parent::whereBasic($query, $where); } /** * Compile a bitwise operator where clause. *
g */ protected function whereBasic(Builder $query, $where) { if (str_contains(strtolower($where['operator']), 'like')) { return sprintf( '%s::text %s %s', $this->wr
{ "filepath": "src/Illuminate/Database/Query/Grammars/PostgresGrammar.php", "language": "php", "file_size": 25332, "cut_index": 1331, "middle_length": 229 }
$operators = [ '=', '<', '>', '<=', '>=', '!<', '!>', '<>', '!=', 'like', 'not like', 'ilike', '&', '&=', '|', '|=', '^', '^=', ]; /** * The components that make up a select clause. * * @var string[] */ protected $selectComponents = [ 'aggregate', ...
lause is required for SQL Server offset to function... if ($query->offset && empty($query->orders)) { $query->orders[] = ['sql' => '(SELECT 0)']; } return parent::compileSelect($query); } /** * Compile the
]; /** * Compile a select query into SQL. * * @param \Illuminate\Database\Query\Builder $query * @return string */ public function compileSelect(Builder $query) { // An order by c
{ "filepath": "src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php", "language": "php", "file_size": 16060, "cut_index": 921, "middle_length": 229 }
cessor = $processor ?: $connection->getPostProcessor(); } /** * Set the columns to be selected. * * @param mixed $columns * @return $this */ public function select($columns = ['*']) { $this->columns = []; $this->bindings['select'] = []; $columns = is_...
ate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string $query * @param string $as * @return $this * * @throws \InvalidArgumentException */ public function selectSub($query, $as) { [$query, $bi
$column, $as); } else { $this->columns[] = $column; } } return $this; } /** * Add a subselect expression to the query. * * @param \Closure|\Illumin
{ "filepath": "src/Illuminate/Database/Query/Builder.php", "language": "php", "file_size": 149234, "cut_index": 7068, "middle_length": 229 }
* The type of join being performed. * * @var string */ public $type; /** * The table the join clause is joining to. * * @var \Illuminate\Contracts\Database\Query\Expression|string */ public $table; /** * The connection of the parent query builder. * ...
/** * The class name of the parent query builder. * * @var string */ protected $parentClass; /** * Create a new join clause instance. * * @param \Illuminate\Database\Query\Builder $parentQuery * @param st
ry\Grammars\Grammar */ protected $parentGrammar; /** * The processor of the parent query builder. * * @var \Illuminate\Database\Query\Processors\Processor */ protected $parentProcessor;
{ "filepath": "src/Illuminate/Database/Query/JoinClause.php", "language": "php", "file_size": 3856, "cut_index": 614, "middle_length": 229 }
ect\b/i', 'select /*+ MAX_EXECUTION_TIME('.$milliseconds.') */', $sql, 1 ); } /** * Compile a "where like" clause. * * @param \Illuminate\Database\Query\Builder $query * @param array $where * @return string */ protected function ...
protected function whereNullSafeEquals(Builder $query, $where) { return $this->wrap($where['column']).' <=> '.$this->parameter($where['value']); } /** * Add a "where null" clause to the query. * * @param \Illuminate\D
rn $this->whereBasic($query, $where); } /** * Compile a "where null safe equals" clause. * * @param \Illuminate\Database\Query\Builder $query * @param array $where * @return string */
{ "filepath": "src/Illuminate/Database/Query/Grammars/MySqlGrammar.php", "language": "php", "file_size": 17483, "cut_index": 1331, "middle_length": 229 }
param \Illuminate\Database\Query\Builder $query * @param string $sql * @param array $values * @param string|null $sequence * @return int */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) { $connection = $query->getConnection(); ...
$result = (object) $result; return [ 'name' => $result->name, 'schema' => $result->schema, 'schema_qualified_name' => $result->schema.'.'.$result->name, 'implicit' => (bool)
) ? $result->{$sequence} : $result[$sequence]; return is_numeric($id) ? (int) $id : $id; } /** @inheritDoc */ public function processTypes($results) { return array_map(function ($result) {
{ "filepath": "src/Illuminate/Database/Query/Processors/PostgresProcessor.php", "language": "php", "file_size": 5189, "cut_index": 716, "middle_length": 229 }
/** @inheritDoc */ public function processColumns($results, $sql = '') { $hasPrimaryKey = array_sum(array_column($results, 'primary')) === 1; return array_map(function ($result) use ($hasPrimaryKey, $sql) { $result = (object) $result; $type = strtolower($result->type); ...
Generated && preg_match( '/\b'.$safeName.'\b[^,]+\s+as\s+\(((?:[^()]+|\((?:[^()]+|\([^()]*\))*\))*)\)/i', $sql, $matches ) === 1 ? $matches[1] : null; return [ 'name'
)?[^,]*)*collate\s+["\'`]?(\w+)/i', $sql, $matches ) === 1 ? strtolower($matches[1]) : null; $isGenerated = in_array($result->extra, [2, 3]); $expression = $is
{ "filepath": "src/Illuminate/Database/Query/Processors/SQLiteProcessor.php", "language": "php", "file_size": 3313, "cut_index": 614, "middle_length": 229 }
* The database connection resolver instance. * * @var \Illuminate\Database\ConnectionResolverInterface */ protected $resolver; /** * The name of the migration table. * * @var string */ protected $table; /** * The name of the database connection to use. * ...
tions. * * @return string[] */ public function getRan() { return $this->table() ->orderBy('batch', 'asc') ->orderBy('migration', 'asc') ->pluck('migration')->all(); } /** * Ge
$resolver * @param string $table */ public function __construct(Resolver $resolver, $table) { $this->table = $table; $this->resolver = $resolver; } /** * Get the completed migra
{ "filepath": "src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php", "language": "php", "file_size": 5642, "cut_index": 716, "middle_length": 229 }
filesystem instance. * * @var \Illuminate\Filesystem\Filesystem */ protected $files; /** * The custom app stubs directory. * * @var string */ protected $customStubPath; /** * The registered post create hooks. * * @var (\Closure(string, string): void)[]...
path. * * @param string $name * @param string $path * @param string|null $table * @param bool $create * @return string * * @throws \Exception */ public function create($name, $path, $table = null, $c
StubPath */ public function __construct(Filesystem $files, $customStubPath) { $this->files = $files; $this->customStubPath = $customStubPath; } /** * Create a new migration at the given
{ "filepath": "src/Illuminate/Database/Migrations/MigrationCreator.php", "language": "php", "file_size": 6092, "cut_index": 716, "middle_length": 229 }
te\Database\Migrations; interface MigrationRepositoryInterface { /** * Get the completed migrations. * * @return string[] */ public function getRan(); /** * Get the list of migrations. * * @param int $steps * @return object{id: int, migration: string, batch: int}[...
/** * Get the completed migrations with their batch numbers. * * @return array<string, int> */ public function getMigrationBatches(); /** * Log that a migration was run. * * @param string $file * @pa
, batch: int}[] */ public function getMigrationsByBatch($batch); /** * Get the last migration batch. * * @return object{id: int, migration: string, batch: int}[] */ public function getLast();
{ "filepath": "src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php", "language": "php", "file_size": 2006, "cut_index": 537, "middle_length": 229 }
is in the past to the query. * * @param array|string $columns * @return $this */ public function wherePast($columns) { return $this->wherePastOrFuture($columns, '<', 'and'); } /** * Add a where clause to determine if a "date" column is in the past or now to the query...
return $this->wherePastOrFuture($columns, '<', 'or'); } /** * Add a where clause to determine if a "date" column is in the past or now to the query. * * @param array|string $columns * @return $this */ public
} /** * Add an "or where" clause to determine if a "date" column is in the past to the query. * * @param array|string $columns * @return $this */ public function orWherePast($columns) {
{ "filepath": "src/Illuminate/Database/Concerns/BuildsWhereDateClauses.php", "language": "php", "file_size": 6761, "cut_index": 716, "middle_length": 229 }
te\Database\Concerns; use Illuminate\Support\Collection; use Illuminate\Support\Str; trait CompilesJsonPaths { /** * Split the given JSON selector into the field and the optional path and wrap them separately. * * @param string $column * @return array */ protected function wrapJsonF...
e, $delimiter = '->') { $value = preg_replace("/([\\\\]+)?\\'/", "''", $value); $jsonPath = (new Collection(explode($delimiter, $value))) ->map(fn ($segment) => $this->wrapJsonPathSegment($segment)) ->join('.');
: ''; return [$field, $path]; } /** * Wrap the given JSON path. * * @param string $value * @param string $delimiter * @return string */ protected function wrapJsonPath($valu
{ "filepath": "src/Illuminate/Database/Concerns/CompilesJsonPaths.php", "language": "php", "file_size": 1587, "cut_index": 537, "middle_length": 229 }
>', '!=', 'like', 'not like', 'ilike', '&', '|', '<<', '>>', ]; /** * Compile the lock into SQL. * * @param \Illuminate\Database\Query\Builder $query * @param bool|string $value * @return string */ protected function compileLock(Builder $query, $value) ...
ted function whereLike(Builder $query, $where) { if ($where['caseSensitive'] == false) { return parent::whereLike($query, $where); } $where['operator'] = $where['not'] ? 'not glob' : 'glob'; return $this->wh
return 'select * from ('.$sql.')'; } /** * Compile a "where like" clause. * * @param \Illuminate\Database\Query\Builder $query * @param array $where * @return string */ protec
{ "filepath": "src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php", "language": "php", "file_size": 14451, "cut_index": 921, "middle_length": 229 }
ion; use Illuminate\Database\Query\Builder; class SqlServerProcessor extends Processor { /** * Process an "insert get ID" query. * * @param \Illuminate\Database\Query\Builder $query * @param string $sql * @param array $values * @param string|null $sequence * @return int ...
ric($id) ? (int) $id : $id; } /** * Process an "insert get ID" query for ODBC. * * @param \Illuminate\Database\Connection $connection * @return int * * @throws \Exception */ protected function processInsert
if ($connection->getConfig('odbc') === true) { $id = $this->processInsertGetIdForOdbc($connection); } else { $id = $connection->getPdo()->lastInsertId(); } return is_nume
{ "filepath": "src/Illuminate/Database/Query/Processors/SqlServerProcessor.php", "language": "php", "file_size": 4031, "cut_index": 614, "middle_length": 229 }
ble; /** * Chunk the results of the query. * * @param int $count * @param callable(\Illuminate\Support\Collection<int, TValue>, int): mixed $callback * @return bool */ public function chunk($count, callable $callback) { $this->enforceOrderBy(); $skip = $th...
if ($countResults == 0) { break; } if (! is_null($remaining)) { $remaining = max($remaining - $countResults, 0); } if ($callback($results, $page) === false) {
? $count : min($count, $remaining); if ($limit == 0) { break; } $results = $this->offset($offset)->limit($limit)->get(); $countResults = $results->count();
{ "filepath": "src/Illuminate/Database/Concerns/BuildsQueries.php", "language": "php", "file_size": 20491, "cut_index": 1331, "middle_length": 229 }
Processor { /** * Process the results of a "select" query. * * @param \Illuminate\Database\Query\Builder $query * @param array $results * @return array */ public function processSelect(Builder $query, $results) { return $results; } /** * Process an "i...
($sequence); return is_numeric($id) ? (int) $id : $id; } /** * Process the results of a schemas query. * * @param list<array<string, mixed>> $results * @return list<array{name: string, path: string|null, default: boo
turn int */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) { $query->getConnection()->insert($sql, $values); $id = $query->getConnection()->getPdo()->lastInsertId
{ "filepath": "src/Illuminate/Database/Query/Processors/Processor.php", "language": "php", "file_size": 4701, "cut_index": 614, "middle_length": 229 }