Hasil Admin 1
This commit is contained in:
parent
dedbf5bd92
commit
93c5ba7720
|
@ -3,12 +3,21 @@
|
||||||
namespace App\Http\Controllers\AdminBackend;
|
namespace App\Http\Controllers\AdminBackend;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Hasil;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class AdminResultController extends Controller
|
class AdminResultController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('admin_backend.admin_result');
|
$results = Hasil::with('user')->get();
|
||||||
|
|
||||||
|
$results = $results->map(function ($result) {
|
||||||
|
$result->formatted_created_at = Carbon::parse($result->created_at)->format('M d, Y');
|
||||||
|
return $result;
|
||||||
|
});
|
||||||
|
|
||||||
|
return view('admin_backend.admin_result', compact('results'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,9 @@ class Hasil extends Model
|
||||||
'rm_total',
|
'rm_total',
|
||||||
'rm_class'
|
'rm_class'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'id_user');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,21 @@
|
||||||
<th>NAMA</th>
|
<th>NAMA</th>
|
||||||
<th>ANGKATAN</th>
|
<th>ANGKATAN</th>
|
||||||
<th>TANGGAL</th>
|
<th>TANGGAL</th>
|
||||||
<th>HASIL</th>
|
<th>RM</th>
|
||||||
|
<th>KM</th>
|
||||||
<th>ACTION</th>
|
<th>ACTION</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@foreach ($results as $result)
|
||||||
<tr>
|
<tr>
|
||||||
<td style="font-weight: bold">Fajar Gunawan</td>
|
<td style="font-weight: bold">{{ $result->user->nama_lengkap }}</td>
|
||||||
<td>2021</td>
|
<td>{{ $result->user->angkatan }}</td>
|
||||||
<td>Apr 23, 2023</td>
|
<td>{{ $result->formatted_created_at }}</td>
|
||||||
<td>lorem ipsum</td>
|
<td>{{ $result->rm_total }}</td>
|
||||||
|
<td>{{ $result->km_total }}</td>
|
||||||
<td><button class="btn btn-primary btn-sm">Download</button></td>
|
<td><button class="btn btn-primary btn-sm">Download</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue