Supported Versions: PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8
Finds whether a variable is null
<?php is_null(mixed $value): bool
<?php     protected function buildForeignKey(string $column_name, ?string $on, string $type, array $attributes = [], array $modifiers = [])

    {

        if (is_null($on)) {

            $table = Str::plural(Str::beforeLast($column_name, '_'));

            $column = Str::afterLast($column_name, '_');

        } elseif (Str::contains($on, '.')) {
<?php                     $relationship = sprintf('$this->%s(%s::class, \'%s\')', $type, $fqcn, $relation);

                } elseif ($type === 'morphedByMany') {

                    $relationship = sprintf('$this->%s(%s::class, \'%sable\')', $type, $fqcn, strtolower($model->name()));

                } elseif (!is_null($key)) {

                    $relationship = sprintf('$this->%s(%s::class, \'%s\', \'%s\')', $type, $fqcn, $column_name, $key);

                } elseif (!is_null($class) && $type === 'belongsToMany') {

                    $relationship = sprintf('$this->%s(%s::class, \'%s\')', $type, $fqcn, $column_name);
<?php                     $relationship = sprintf('$this->%s(%s::class, \'%sable\')', $type, $fqcn, strtolower($model->name()));

                } elseif (!is_null($key)) {

                    $relationship = sprintf('$this->%s(%s::class, \'%s\', \'%s\')', $type, $fqcn, $column_name, $key);

                } elseif (!is_null($class) && $type === 'belongsToMany') {

                    $relationship = sprintf('$this->%s(%s::class, \'%s\')', $type, $fqcn, $column_name);

                    $column_name = $class;

                } else {
<?php                 function ($output, $field) use ($context) {

                    [$qualifier, $column] = $this->splitField($field);



                    if (is_null($qualifier)) {

                        $qualifier = $context;

                    }
<?php         $rules = [];



        if (!is_null($model)) {

            if ($model->hasColumn($column)) {

                $modelColumn = $model->column($column);
<?php                         foreach ($statement->data() as $data) {

                            [$qualifier, $column] = $this->splitField($data);



                            if (is_null($qualifier)) {

                                $qualifier = $context;

                            }
<?php                             $local_model = $this->tree->modelForContext($qualifier);



                            if (!is_null($local_model) && $local_model->hasColumn($column)) {

                                $local_column = $local_model->column($column);



                                $factory = $this->generateReferenceFactory($local_column, $controller, $modelNamespace);
<?php                                 $setup['data'][] = $faker;

                                $request_data[$data] = '$' . $variable_name;

                            } elseif (!is_null($local_model)) {

                                foreach ($local_model->columns() as $local_column) {

                                    if (in_array($local_column->name(), ['id', 'softdeletes', 'softdeletestz'])) {

                                        continue;
<?php                         $local_model = $this->tree->modelForContext($model);

                        if (!is_null($local_model) && $local_model->usesSoftDeletes()) {

                            $assertions['generic'][] = sprintf('$this->assertSoftDeleted($%s);', $variable);

                        } else {

                            $assertions['generic'][] = sprintf('$this->assertModelMissing($%s);', $variable);
<?php                             $local_model = $this->tree->modelForContext($model);

                            foreach ($request_data as $key => $datum) {

                                if (!is_null($local_model) && $local_model->hasColumn($key) && $local_model->column($key)->dataType() === 'date') {

                                    $this->addImport($controller, 'Carbon\\Carbon');

                                    $assertions['generic'][] = sprintf('$this->assertEquals(Carbon::parse(%s), $%s->%s);', $datum, $variable, $key);

                                } else {
<?php             if (isset(self::$modifiers[strtolower($value)])) {

                $modifierAttributes = $parts[1] ?? null;

                if (is_null($modifierAttributes)) {

                    $modifiers[] = self::$modifiers[strtolower($value)];

                } else {

                    $modifiers[] = [self::$modifiers[strtolower($value)] => preg_replace('~^[\'"]?(.*?)[\'"]?$~', '$1', $modifierAttributes)];
<?php             }

        }



        if (is_null($data_type)) {

            $is_foreign_key = collect($modifiers)->contains(fn ($modifier) => (is_array($modifier) && key($modifier) === 'foreign') || $modifier === 'foreign');



            $data_type = $is_foreign_key ? 'id' : 'string';
<?php             $reference = Str::after($reference, ':');

        }



        return new ResourceStatement($reference, !is_null($collection), $collection === 'paginate');

    }



    private function analyzeUpdate($statement)
<?php     private function determineModel(?string $controller)

    {

        if (! is_null($controller) && ! empty($controller)) {

            $this->model = Str::studly(Str::singular($controller));

        }
<?php         }



        if (

            is_null($this->model()) &&

            ! empty($this->clauses()) &&

            ! in_array($this->operation(), ['count','exists'])

        ) {