clarkeash / doorman

Limit access to your Laravel applications by using invite codes
https://packagist.org/packages/clarkeash/doorman
MIT License
1.02k stars 45 forks source link

Use the given table name on migrations #6

Closed m1guelpf closed 7 years ago

codecov-io commented 7 years ago

Codecov Report

Merging #6 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##             master     #6   +/-   ##
=======================================
  Coverage       100%   100%           
- Complexity       27     38   +11     
=======================================
  Files             5      7    +2     
  Lines            75    101   +26     
=======================================
+ Hits             75    101   +26
Impacted Files Coverage Δ Complexity Δ
src/Models/Invite.php 100% <100%> (ø) 1 <1> (?)
src/Providers/DoormanServiceProvider.php 100% <0%> (ø) 2% <0%> (ø) :arrow_down:
src/Manager.php 100% <0%> (ø) 13% <0%> (+1%) :arrow_up:
src/Validation/DoormanValidator.php 100% <0%> (ø) 9% <0%> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b06eb34...3997a44. Read the comment docs.

clarkeash commented 7 years ago

Hi, Thanks for your contribution.

The Invite model also needs to use this value, if you update the model I will look into merging this PR

m1guelpf commented 7 years ago

@clarkeash Done!

clarkeash commented 7 years ago

Tests have failed. You cant use function calls to set default values for properties.

You will have to set the table name in in the models constructor 😄

clarkeash commented 7 years ago

@m1guelpf what happened?

m1guelpf commented 7 years ago

@clarkeash I searched a bit and didn't find another way to set the table name of a model

clarkeash commented 7 years ago

You can just do it in the constructor:

public function __construct()
{
    $this->table = config('doorman.invite_table_name');
}
m1guelpf commented 7 years ago

@clarkeash That wouldn't work as the $table value is overwritten later. I've reviewed the core and I think the setTable function may work.

clarkeash commented 7 years ago

overwritten by what?

clarkeash commented 7 years ago

and setTable is fine, but you still need to do this in the constructor, you cant just call a method like that in PHP