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

Improvements and compatibility with Laravel 5.5 #34

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Improvements and compatibility with Laravel 5.5 #34

wants to merge 12 commits into from

Conversation

robsontenorio
Copy link

@robsontenorio robsontenorio commented Oct 28, 2017

Some of this changes are based on another forks who was not submitted by authors.

LARAVEL 5.5

  • Replace lists() for pluck()
  • Package discovery
  • Handling PATH_INFO problem

IMPROVEMENTS

  • Adding firstOrFail() for Restfull API`s

For non existing ID, firstOrFail() throws ModelNotFoundException

       /v1/companies/999999?includes=status&.....

Model Company.php

    public static function get($id, array $params = [])
    {
        $params['id'] = $id;
        $request = RequestCreator::createWithParameters($params);        
        $company = new QueryBuilder(new Company, $request);

        return $company->build()->firstOrFail();
    }

@walliby
Copy link

walliby commented Nov 6, 2017

@robsontenorio Nicely done. Looks like there are several of us who are finding this library valuable. @selahattinunlu Are you still maintaining this project? Another improvement I have found, is to turn the result type into a query param so you can pass paginate, list, or get to an endpoint. Not sure about creating a merge request here if its not maintained but here it is if @robsontenorio is interested: walliby@349dfb5

@robsontenorio
Copy link
Author

@walliby that methods already exists:

  • get()
  • paginate()
  • lists() ( uses pluck() )

@walliby
Copy link

walliby commented Nov 6, 2017 via email

@robsontenorio
Copy link
Author

I understand. But in my case I m working with restfull endpoints , so my urls hits two diferents methods on Models:

  • /users/99 => get()
  • /users?includes=city => paginate()

@walliby
Copy link

walliby commented Nov 6, 2017 via email

@robsontenorio
Copy link
Author

@walliby nice, just waiting for @selahattinunlu when he got enough time to merge it :)

@zlanich
Copy link

zlanich commented Feb 18, 2018

Hey @selahattinunlu, are you able to merge this soon? I'm needing to add additional query params into the Request using the RequestCreator and I'm getting the PATH_INFO error.

@wgmv
Copy link

wgmv commented Apr 8, 2018

Package is not maintained anymore. Anyone willing to take over? Also wating for these changes...

@robsontenorio
Copy link
Author

@wgmv as you said "Package is not maintained anymore". An alternative can be https://github.com/spatie/laravel-query-builder . It seems work well.

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

5 participants