Closed epixian closed 5 years ago
Hey @epixian! What a nice and detailed bug report. I think this is a composer issue; please do try:
composer dump-autoload
./vendor/kyslik
(rm -rf
) and run composer update
The problem is the usage; you need to use scope on the model not on the collection :) so in your case it should be:
Jobsite::sortable('name')->get();
@Kyslik quick reply! It looks like I tossed you a red herring, but you were able to figure it out. Thank you so much, it works now!
Likely related to closed issue #46 --> Eloquent doesn't seem to recognize Sortable as a trait. I'm not new to PHP, but I am somewhat of a novice at Laravel and Composer so I'm guessing my issue is configuration related. My repo is here.
Using Laravel 5.7.19. Composer found the library with no issues, pulled in version 5.7.0 of this library and performed
composer update
. composer.json correctly shows requiring 5.7.* of this library. Since using version >=5.5, I assumed that the ColumnSortableServiceProvider would be registered and visible in config/app.php, but no changes in that file after publishing configuration, so I inserted the config following the manual installation instructions and republished. I get the same error intinker
if calling sortable() on a manual query.model:
controller:
On the other hand,
@sortablelink('name', 'Name')
works as expected in my view, so the Blade extension seems to be working (using unmodified model/controller code).