mirror of
https://github.com/brunofontes/shareit.git
synced 2025-11-15 16:00:54 -03:00
Included: alert the active user someone is waiting for the item
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use \App\User;
|
||||
use \App\Mail\UserWaiting;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AlertController extends Controller
|
||||
@@ -13,6 +14,13 @@ class AlertController extends Controller
|
||||
$item->waiting_user_id = \Auth::id();
|
||||
$item->timestamps = false;
|
||||
$item->save();
|
||||
|
||||
$loggedUser = \Auth::user()->name;
|
||||
$userWithItem = User::find($item->used_by);
|
||||
\Mail::to($userWithItem)->send(
|
||||
new UserWaiting($loggedUser, $userWithItem->name, $item)
|
||||
);
|
||||
|
||||
return redirect('home');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user