Skip to content

[1.x] Allow overriding the default table name.#55

Closed
hrabbit wants to merge 1 commit intoLaragear:1.xfrom
hrabbit:override_default_table
Closed

[1.x] Allow overriding the default table name.#55
hrabbit wants to merge 1 commit intoLaragear:1.xfrom
hrabbit:override_default_table

Conversation

@hrabbit
Copy link
Copy Markdown

@hrabbit hrabbit commented Aug 21, 2023

This feature users to override the default table created during a migration by adding a configuration entry for the new table name.

Added config entry to allow setting a value, without this entry, or null drops back to the existing behavior.

'table_name' => null,

Added fallback for table name in model.

public function getTable()
{
    return config('two-factor.table_name') ?? parent::getTable();
}

This feature users to override the default table created during a
migration by adding a configuration entry for the new table name.

Added config entry to allow setting a value, without this entry, or null
drops back to the existing behavior.

```
'table_name' => null,
```

Added fallback for table name in model.
```
public function getTable()
{
    return config('two-factor.table_name') ?? parent::getTable();
}
```
@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (cf00ad7) 99.75% compared to head (619566e) 99.75%.

Additional details and impacted files
@@            Coverage Diff            @@
##                1.x      #55   +/-   ##
=========================================
  Coverage     99.75%   99.75%           
- Complexity      140      141    +1     
=========================================
  Files            18       18           
  Lines           408      410    +2     
=========================================
+ Hits            407      409    +2     
  Misses            1        1           
Files Changed Coverage Δ
src/Models/TwoFactorAuthentication.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DarkGhostHunter
Copy link
Copy Markdown
Contributor

Not a fan of having migration configuration in a config file. I'll rather set the table name using a static property in the model, which the migration would pick up magically.

I'll use that approach to add this enhancement. Thanks.

@hrabbit
Copy link
Copy Markdown
Author

hrabbit commented Aug 31, 2023

Not a fan of having migration configuration in a config file. I'll rather set the table name using a static property in the model, which the migration would pick up magically.

I'll use that approach to add this enhancement. Thanks.

Sure thing. When you update, I'll be sure to update, in the meantime, my local mods are working as expected.

PS. Loving the package btw! Saved heaps of dev time on my end!

@DarkGhostHunter
Copy link
Copy Markdown
Contributor

@hrabbit thanks, great to know it helps. If you have time, you can make a PR.

@DarkGhostHunter
Copy link
Copy Markdown
Contributor

Went my own way #72

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.

2 participants