mirror of
https://github.com/brunofontes/shareit.git
synced 2025-11-15 16:00:54 -03:00
Refactoring homeController code
This commit is contained in:
@@ -23,13 +23,7 @@ class HomeController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$items = \DB::table('items')
|
||||
->join('item_user', 'item_user.item_id', '=', 'items.id')
|
||||
->join('products', 'products.id', '=', 'items.id')
|
||||
->where('item_user.user_id', \Auth::id())
|
||||
->select('items.*', 'products.name as pname')
|
||||
->orderBy('items.name')
|
||||
->get();
|
||||
$items = \App\User::find(\Auth::id())->items()->get();
|
||||
return view('home', compact('items'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user