Merhaba,
Database'den cektigim verileri ekrana yansittiktan sonra onlardan bazilari sorting islemine tabi tutmak istiyorum.
Harf ya da rakamin buyuk, kucuklugune gore.
Birkac yontem denedim. Fakat iyi bir sonuc alamadim.
Bu konuda herhangi bir bilgisi olan varsa yardimci olabilir mi?
Model;
Controller Kodlari;
public function sumos()
{
$data['este'] = estates::all();
return view('pages.sumo', $data);
return view('pages.sumo',['este' => estates::sortable()->get()]);
}
model kodlari;
class estates extends Model
{
use Sortable;
protected $fillable = [ 'Entry', 'Price' ];
protected $table="estates";
public $Sortable = ['Entry', 'Price'];
}
html kodlarim;<table align="center">
<tr>
<td colspan="11" id="header"><h1>物件概要<h1></td>
</tr>
<tr>
<th width="340px">会社名</th>
<th width="80px">物件名</th>
<th width="135px">所在地</th>
<th width="135px">総戸数</th>
<th width="80px">間取り</th>
<th width="100px">専有面積</th>
<th width="80px">バルコニー面積</th>
<th width="100px">竣工年月日</th>
<th width="100px">@sortablelink('Entry', '入居年月日')</th>
<th width="100px">@sortablelink('Price', '価格')</th>
<th width="100px">販売会社名</th>
</tr>
<table>
@foreach($este as $row)
<table align="center">
<tr>
<td width="340px">Company Name</td>
<td width="80px">{{ $row->Building_Names }}</td>
<td width="135px">{{ $row->Addresses }}</td>
<td width="135px">{{ $row->HouseHolds }}</td>
<td width="80px">{{ $row->Rooms }}</td>
<td width="100px">{{ $row->Balconys }}</td>
<td width="80px">{{ $row->Extents }}</td>
<td width="100px">{{ $row->Constrution }}</td>
<td width="100px">{{ $row->Entry }}</td>
<td width="100px">{{ $row->Price }}</td>
<td width="100px">{{ $row->Company }}</td>
</tr>
</table>
@endforeach