Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Fix inconsistency in table names in validator #37606

Merged
merged 2 commits into from
Jun 5, 2021

Conversation

mvalim
Copy link
Contributor

@mvalim mvalim commented Jun 5, 2021

This PR fix a issue where the ValidatesAttributes::parseTable return the wrong table when the $table attribute in the model is prefixed with a schema. This PR only affects calls where the model itself is provided as argument and it has a prefixed table name like $table = 'prefix.table', so it should be backwards compatible,

I also added two assertions to try to ensure this change does not affect other scenarios.

The original issue #37580

The problem:

Schema::create('public.users', function (Blueprint $table) { }); // works

$table = 'public.users'; // works

DB::table('public.users')->first() //works

class User extends Model {
   $table = 'public.users';
}
Rule::unique(User::class) // don't work -> Database connection [public] not configured.

@GrahamCampbell GrahamCampbell changed the title fix inconsistency in table names in validator [8.x] Fix inconsistency in table names in validator Jun 5, 2021
@GrahamCampbell
Copy link
Member

If this is a bug fix, it should go to 6.x.

@mvalim
Copy link
Contributor Author

mvalim commented Jun 5, 2021

Sorry for that, I'm not used to making pull requests and I don't fully understand the open source flow, I only made this pull request because I really need this to be fixed. And again sorry about my ignorance with this next question, but how should I proceed now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants