mirror of
https://github.com/brunofontes/shareit.git
synced 2025-11-15 07:50:54 -03:00
Added PTB Translation of emails and some pages
Now the main page, item page and e-mails are translated into Brazilian Portuguese
This commit is contained in:
@@ -73,7 +73,7 @@ class RegisterController extends Controller
|
||||
|
||||
\Mail::to($user)->send(new Welcome($user));
|
||||
|
||||
session()->flash(FlashMessage::PRIMARY, 'Thanks for registering. Please, do not forget to validate your e-mail address.');
|
||||
session()->flash(FlashMessage::PRIMARY, __('Thanks for registering. Please, do not forget to validate your e-mail address.'));
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class VerificationController extends Controller
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
protected $redirectTo = '/';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
||||
@@ -13,7 +13,11 @@ class ItemController extends Controller
|
||||
{
|
||||
$item = Item::find($id);
|
||||
if (!$item || $item->product->user_id != \Auth::id()) {
|
||||
session()->flash(flash::DANGER, "The item doesn't exist.");
|
||||
session()->flash(flash::DANGER,
|
||||
\Lang::getFromJson(
|
||||
"The item doesn't exist."
|
||||
)
|
||||
);
|
||||
return back();
|
||||
}
|
||||
$users = $item->users()->get();
|
||||
|
||||
@@ -71,7 +71,12 @@ class ProductController extends Controller
|
||||
$product = Product::fromAuthUser()->find($id);
|
||||
|
||||
if (!$product) {
|
||||
session()->flash(flash::DANGER, "The product doesn't exist or doesn't belongs to you.");
|
||||
session()->flash(
|
||||
flash::DANGER,
|
||||
\Lang::getFromJson(
|
||||
"The product doesn't exist or doesn't belongs to you."
|
||||
)
|
||||
);
|
||||
return redirect('/product');
|
||||
}
|
||||
return view('product.show', compact('product'));
|
||||
|
||||
@@ -13,7 +13,11 @@ class TakeController extends Controller
|
||||
{
|
||||
$item = User::loggedIn()->items()->find(request('item'));
|
||||
if ($item->used_by) {
|
||||
return back()->withErrors("This item is already taken");
|
||||
return back()->withErrors(
|
||||
\Lang::getFromJson(
|
||||
"This item is already taken"
|
||||
)
|
||||
);
|
||||
}
|
||||
$item->used_by = \Auth::id();
|
||||
$item->save();
|
||||
|
||||
@@ -42,14 +42,22 @@ class UserController extends Controller
|
||||
$userArray = User::where('email', request('email'))->get();
|
||||
|
||||
if (count($userArray) == 0) {
|
||||
return back()->withErrors("The e-mail address is not registered yet.");
|
||||
return back()->withErrors(
|
||||
\Lang::getFromJson("The e-mail address is not registered yet.")
|
||||
);
|
||||
}
|
||||
|
||||
$item = Item::findOrFail(request('item_id'));
|
||||
if ($item->product->user_id == \Auth::id()) {
|
||||
User::findOrFail($userArray[0]->id)->items()->syncWithoutDetaching([request('item_id')]);
|
||||
User::findOrFail($userArray[0]->id)
|
||||
->items()
|
||||
->syncWithoutDetaching([request('item_id')]);
|
||||
} else {
|
||||
return back()->withErrors("You cannot add a user to a product that is not yourse.");
|
||||
return back()->withErrors(
|
||||
\Lang::getFromJson(
|
||||
"You cannot add a user to a product that is not yourse."
|
||||
)
|
||||
);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
@@ -67,12 +75,20 @@ class UserController extends Controller
|
||||
$item = Item::findOrFail(request('item_id'));
|
||||
|
||||
if ($item->product->user_id == \Auth::id()) {
|
||||
$returnItem = User::findOrFail(request('user_id'))->items()->findOrFail(request('item_id'));
|
||||
$returnItem = User::findOrFail(request('user_id'))
|
||||
->items()
|
||||
->findOrFail(request('item_id'));
|
||||
$returnItem->used_by = null;
|
||||
$returnItem->save();
|
||||
User::findOrFail(request('user_id'))->items()->detach([request('item_id')]);
|
||||
User::findOrFail(request('user_id'))
|
||||
->items()
|
||||
->detach([request('item_id')]);
|
||||
} else {
|
||||
return back()->withErrors("You cannot remove a user from a product that is not yourse.");
|
||||
return back()->withErrors(
|
||||
\Lang::getFromJson(
|
||||
"You cannot remove a user from a product that is not yourse."
|
||||
)
|
||||
);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user