Sorting the dropdown list by name.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
613bae96eb
commit
589bf47eff
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\EliteShips;
|
||||
use App\Models\Ships;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
@ -14,7 +15,12 @@ class ShipsController extends Controller
|
||||
public function index(){
|
||||
$ships = \App\Models\Ships::sortable()->paginate(10);
|
||||
$eliteShips = EliteShips::all();
|
||||
return view('ships.index', ['ships'=>$ships,'eliteShips'=>$eliteShips]);
|
||||
$sortedEliteShips = Arr::sort($eliteShips, function($eliteShip)
|
||||
{
|
||||
// Sort ships by their name.
|
||||
return $eliteShip->shipName;
|
||||
});
|
||||
return view('ships.index', ['ships'=>$ships,'eliteShips'=>$sortedEliteShips]);
|
||||
}
|
||||
|
||||
public function add(Request $request){
|
||||
|
Loading…
Reference in New Issue
Block a user