Refactoring

Including some use for classes;
REfactoring the HomeController, to make it cleaner
and avoid repeating code.
This commit is contained in:
2018-10-10 00:46:28 -03:00
parent a85b971ec5
commit 1c1c42df7b
6 changed files with 84 additions and 47 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use \Lang;
use \App\User;
use \App\Item;
use \App\Product;
@@ -43,7 +44,7 @@ class UserController extends Controller
if (count($userArray) == 0) {
return back()->withErrors(
\Lang::getFromJson("The e-mail address is not registered yet.")
Lang::getFromJson("The e-mail address is not registered yet.")
);
}
@@ -54,7 +55,7 @@ class UserController extends Controller
->syncWithoutDetaching([request('item_id')]);
} else {
return back()->withErrors(
\Lang::getFromJson(
Lang::getFromJson(
"You cannot add a user to a product that is not yourse."
)
);
@@ -85,7 +86,7 @@ class UserController extends Controller
->detach([request('item_id')]);
} else {
return back()->withErrors(
\Lang::getFromJson(
Lang::getFromJson(
"You cannot remove a user from a product that is not yourse."
)
);