Sorting a Laravel Collection by Many to Many Pivot Table Column
问题 I'm looking at displaying a list of asset s belonging to a product in an order defined by order_column on the pivot table product_asset . In this case, the sortBy function has no effect. No errors are thrown, but it returns the collection array in the same order no matter what. Here's what I have laid out currently: Database: Schema::create('product_asset', function (Blueprint $table) { $table->integer('product_id')->unsigned()->index(); $table->foreign('product_id')->references('id')->on(