mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-24 12:17:10 +00:00
Bruno Fontes
882609fed0
Now it shows the username of who is using an item. Item db field 'usedBy' was renamed to 'used_by' to keep consistence.
19 lines
367 B
PHP
19 lines
367 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use \App\Item;
|
|
use \App\User;
|
|
use Illuminate\Http\Request;
|
|
|
|
class TakeController extends Controller
|
|
{
|
|
public function store(Request $request)
|
|
{
|
|
$item = User::find(\Auth::id())->items()->find(request('item'));
|
|
$item->used_by = \Auth::id();
|
|
$item->save();
|
|
return redirect('home');
|
|
}
|
|
}
|