Level 1
Thank you
I have a table with teams and their standings and i am getting every thing correctly... my problem is i want my standing table to filter and arrange the standing->points (column) with the highest point to lowest point
use App\Standing;
use Illuminate\Http\Request;
class TablesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$standings = Standing::latest()->get();
return view('frontend.home.table', compact('standings'));
}
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('standings', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('team_id');
$table->string('played');
$table->string('win');
$table->string('draw');
$table->string('loss');
$table->string('goalscored');
$table->string('goalacquired');
$table->string('+/-');
$table->string('points');
$table->timestamps();
});
}
class Standing extends Model
{
//
protected $fillable = [
'team_id',
'played',
'win',
'draw',
'loss',
'goalscored',
'goalacquired',
'+/-',
'points',
];
public function team()
{
return $this->belongsTo('App\Team');
}
{
//
protected $fillable = [
'photo_id',
'name',
'established_in',
'manager',
'coach',
'training_ground',
'leagues',
'initials',
];
public function photo()
{
return $this->belongsTo('App\Photo');
}
public function player()
{
return $this->hasMany('App\Player');
}
public function statistic()
{
return $this->belongsTo('App\Statistic');
}
Kindly asking for any suggestions
Please or to participate in this conversation.