Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
WatheqAlshowaiter authored and github-actions[bot] committed Jul 25, 2024
1 parent 6faa426 commit f216a84
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/RequiredFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public static function getRequiredFields(
);
}

$primaryIndex = collect(Schema::getIndexes((new self())->getTable()))
$primaryIndex = collect(Schema::getIndexes((new self)->getTable()))
->filter(function ($index) {
return $index['primary'];
})
->pluck('columns')
->flatten()
->toArray();

return collect(Schema::getColumns((new self())->getTable()))
return collect(Schema::getColumns((new self)->getTable()))
->map(function ($column) { // specific to mariadb
if ($column['default'] == 'NULL') {
$column['default'] = null;
Expand Down Expand Up @@ -109,7 +109,7 @@ private static function getRequiredFieldsForSqlite(
$queryResult = DB::select(/** @lang SQLite */ "PRAGMA table_info($table)");

return collect($queryResult)
->map(function ($column){
->map(function ($column) {
return (array) $column;
})
->reject(function ($column) use ($withNullables, $withDefaults, $withPrimaryKey) {
Expand All @@ -121,7 +121,6 @@ private static function getRequiredFieldsForSqlite(
->toArray();
}


private static function getRequiredFieldsForMysqlAndMariaDb(
$withNullables = false,
$withDefaults = false,
Expand All @@ -148,7 +147,7 @@ private static function getRequiredFieldsForMysqlAndMariaDb(
);

return collect($queryResult)
->map(function ($column){
->map(function ($column) {
return (array) $column;
})
->map(function ($column) { // specific to mariadb
Expand All @@ -167,7 +166,6 @@ private static function getRequiredFieldsForMysqlAndMariaDb(
->toArray();
}


private static function getRequiredFieldsForPostgres(
$withNullables = false,
$withDefaults = false,
Expand Down Expand Up @@ -228,7 +226,7 @@ private static function getRequiredFieldsForPostgres(
);

return collect($queryResult)
->map(function ($column){
->map(function ($column) {
return (array) $column;
})
->reject(function ($column) use ($primaryIndex, $withDefaults, $withNullables) {
Expand Down Expand Up @@ -288,7 +286,7 @@ private static function getRequiredFieldsForSqlServer(
);

return collect($queryResult)
->map(function ($column){
->map(function ($column) {
return (array) $column;
})
->reject(function ($column) use ($withDefaults, $withNullables, $primaryIndex, $withPrimaryKey) {
Expand All @@ -306,7 +304,7 @@ private static function getRequiredFieldsForSqlServer(
*/
private static function getTableFromThisModel()
{
$table = (new self())->getTable();
$table = (new self)->getTable();

return str_replace('.', '__', $table);
}
Expand Down

0 comments on commit f216a84

Please sign in to comment.