shareit/app/Http/Controllers/ReturnController.php
Bruno Fontes 882609fed0
Including occupied username and renaming DB field
Now it shows the username of who is using an item.
Item db field 'usedBy' was renamed to 'used_by' to keep consistence.
2018-09-14 12:52:07 -03:00

19 lines
348 B
PHP

<?php
namespace App\Http\Controllers;
use \App\User;
use Illuminate\Http\Request;
class ReturnController extends Controller
{
public function store(Request $request)
{
$item = User::find(\Auth::id())->items()->find(request('item'));
$item->used_by = null;
$item->save();
return redirect('home');
}
}