- Created a dedicated UserDashboardController to handle user-related logic. - Added deal listing views and components for users, including action toolbars, broker contact, and stat badges. - Refactored UI components to support new features like toggle buttons and improved input handling. - Updated routes with a new prefix for user-related pathways, ensuring a better structure across dashboards.
42 lines
984 B
PHP
42 lines
984 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\User;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Deal;
|
|
|
|
class UserDashboardController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
return view('dashboards.user.index')
|
|
->with('deals', $this->deals());
|
|
}
|
|
|
|
protected function deals()
|
|
{
|
|
return Deal::query()
|
|
->where('active', true)
|
|
->select([
|
|
'id',
|
|
'title',
|
|
'description',
|
|
'image',
|
|
'active',
|
|
'slug',
|
|
'link',
|
|
'deal_category_id',
|
|
'user_id',
|
|
])
|
|
->with([
|
|
'category:id,name',
|
|
'broker' => function ($query) {
|
|
$query->select('id', 'name', 'email', 'role_type', 'role_id')
|
|
->with('type');
|
|
},
|
|
])
|
|
->latest()
|
|
->paginate();
|
|
}
|
|
}
|