Closed dannyweeks closed 8 years ago
:+1: Nice
✊ Happy to help! The cs kicked my arse, first time I have picked a fight with StyleCI 😁
Thanks :smile:
This takes care of that.
composer global require fabpot/php-cs-fixer
php-cs-fixes --level=psr2 *.php
Currently the foreign key has to be the singular of the table name.
I have made changes to allow an array to be passed in as the through model with a reference to the model and the intended foreign key.
In the tests I have added another table called offshore_states. The district still uses the foreign key
state_id
. The assumed foreign key would beoffshore_state_id
which would return an sql error. To overwrite this the model reference is put inside an array with the second element being a string the foreign key.As you can see the 'through' is inside another array otherwise it would think the given foreign key is another model.
Id love to know your thoughts on this. If you would like I could add this addition to the readme file too.
Danny