mirror of
https://github.com/brunofontes/shareit.git
synced 2025-11-15 16:00:54 -03:00
Added: language to User profile (DB)
The language were set only on session. But now it is stored with user profile, on DB. It is important as now I can send alert e-mails to each user on their own languages and not the activer user language. Also, wherever the user logs out and logs in again, it will see the same site locale.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use \App\User;
|
||||
use \App\Mail\UserWaiting;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -11,15 +12,15 @@ class AlertController extends Controller
|
||||
public function store(Request $request)
|
||||
{
|
||||
$item = User::loggedIn()->items()->find(request('item'));
|
||||
$item->waiting_user_id = \Auth::id();
|
||||
$item->waiting_user_id = Auth::id();
|
||||
$item->timestamps = false;
|
||||
$item->save();
|
||||
|
||||
$loggedUser = \Auth::user()->name;
|
||||
$loggedUser = Auth::user()->name;
|
||||
$userWithItem = User::find($item->used_by);
|
||||
\Mail::to($userWithItem)->send(
|
||||
new UserWaiting($loggedUser, $userWithItem->name, $item)
|
||||
);
|
||||
\Mail::to($userWithItem)
|
||||
->locale($userWithItem->language)
|
||||
->send(new UserWaiting($loggedUser, $userWithItem->name, $item));
|
||||
|
||||
return redirect('home');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user