diff --git a/app/Events/ReturnItem.php b/app/Events/ReturnItem.php index 6a76d6d..714a26e 100644 --- a/app/Events/ReturnItem.php +++ b/app/Events/ReturnItem.php @@ -3,13 +3,10 @@ namespace App\Events; use \App\Item; -use Illuminate\Broadcasting\Channel; -use Illuminate\Queue\SerializesModels; -use Illuminate\Broadcasting\PrivateChannel; -use Illuminate\Broadcasting\PresenceChannel; -use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Contracts\Broadcasting\ShouldBroadcast; +use Illuminate\Broadcasting\PrivateChannel; +use Illuminate\Foundation\Events\Dispatchable; +use Illuminate\Queue\SerializesModels; class ReturnItem { @@ -20,7 +17,7 @@ class ReturnItem * Create a new event instance. * * @param Item $item The returned item. - * + * * @return void */ public function __construct(Item $item) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 4a78967..0f7a139 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -3,8 +3,8 @@ namespace App\Exceptions; use Exception; -Use Throwable; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Throwable; class Handler extends ExceptionHandler { diff --git a/app/Http/Controllers/AlertController.php b/app/Http/Controllers/AlertController.php index 4b6c862..90f328c 100644 --- a/app/Http/Controllers/AlertController.php +++ b/app/Http/Controllers/AlertController.php @@ -2,12 +2,12 @@ namespace App\Http\Controllers; -use Auth; -use Mail; +use \App\Mail\UserWaiting; use \App\User; use App\FlashMessage; -use \App\Mail\UserWaiting; +use Auth; use Illuminate\Http\Request; +use Mail; class AlertController extends Controller { @@ -17,7 +17,7 @@ class AlertController extends Controller * the item is free * * @param Request $request Form data - * + * * @return redirect to home */ public function store(Request $request) @@ -25,7 +25,7 @@ class AlertController extends Controller $item = User::loggedIn()->items()->find(request('item')); if (!$item->used_by) { session()->flash( - FlashMessage::PRIMARY, + FlashMessage::PRIMARY, __('Oh! This item has just being returned. Take it before anyone else!') ); return redirect('home'); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 338a343..c07a037 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,13 +2,13 @@ namespace App\Http\Controllers\Auth; -use App\User; -use App\Mail\Welcome; +use App\FlashMessage; use App\Http\Controllers\Controller; +use App\Mail\Welcome; +use App\User; +use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; -use Illuminate\Foundation\Auth\RegistersUsers; -use App\FlashMessage; use Mail; class RegisterController extends Controller diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 03e02a2..a0a2a8a 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers; -use Illuminate\Foundation\Bus\DispatchesJobs; -use Illuminate\Routing\Controller as BaseController; -use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; +use Illuminate\Foundation\Bus\DispatchesJobs; +use Illuminate\Foundation\Validation\ValidatesRequests; +use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 6438773..76fa387 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -42,14 +42,14 @@ class HomeController extends Controller ->groupBy('product.name'); return view( - 'home', + 'home', ['products' => $products, 'users' => $this->activeUsers, 'usedItems' => $numberOfUsedItems] ); } /** * Get the username from an specified user id. - * + * * @param object $itemUsers Array with IDs and usernames * @param int $id The user id to search for * diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 83fe1fe..609e248 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -4,8 +4,8 @@ namespace App\Http\Controllers; use \App\Item; use \App\User; -use Illuminate\Http\Request; use App\FlashMessage as flash; +use Illuminate\Http\Request; class ItemController extends Controller { @@ -13,7 +13,8 @@ class ItemController extends Controller { $item = Item::find($id); if (!$item || $item->product->user_id != \Auth::id()) { - session()->flash(flash::DANGER, + session()->flash( + flash::DANGER, \Lang::getFromJson( "The item doesn't exist." ) diff --git a/app/Http/Controllers/LanguageController.php b/app/Http/Controllers/LanguageController.php index 41d8809..8b78188 100644 --- a/app/Http/Controllers/LanguageController.php +++ b/app/Http/Controllers/LanguageController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers; use App; -use Lang; use App\User; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 9282989..b231f6c 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -3,10 +3,10 @@ namespace App\Http\Controllers; use \App\Item; -use \App\User; use \App\Product; -use Illuminate\Http\Request; +use \App\User; use App\FlashMessage as flash; +use Illuminate\Http\Request; class ProductController extends Controller { @@ -72,7 +72,7 @@ class ProductController extends Controller if (!$product) { session()->flash( - flash::DANGER, + flash::DANGER, \Lang::getFromJson( "The product doesn't exist or doesn't belongs to you." ) diff --git a/app/Http/Controllers/TakeController.php b/app/Http/Controllers/TakeController.php index 247177a..2dd44a9 100644 --- a/app/Http/Controllers/TakeController.php +++ b/app/Http/Controllers/TakeController.php @@ -2,13 +2,11 @@ namespace App\Http\Controllers; -use Auth; -use Lang; +use App\Events\ReturnItem; use App\Item; use App\User; -use App\Events\ReturnItem; use Illuminate\Http\Request; -use PhpParser\Node\Stmt\TryCatch; +use Lang; /** * Responsible to Take and Return an Item. @@ -19,7 +17,7 @@ class TakeController extends Controller * The user take an item * * @param Request $request The form data - * + * * @return home view */ public function store(Request $request) @@ -42,7 +40,7 @@ class TakeController extends Controller * Trigger an event: ReturnItem * * @param Request $request Form data - * + * * @return View home */ public function delete(Request $request) @@ -51,7 +49,6 @@ class TakeController extends Controller try { $item->returnItem(); - } catch (\Exception $e) { return back()->withErrors( Lang::getFromJson("You cannot return an item that is not with you") diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 9e8be30..d0f1787 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -2,10 +2,9 @@ namespace App\Http\Controllers; -use \Lang; -use \App\User; use \App\Item; -use \App\Product; +use \App\User; +use \Lang; use Illuminate\Http\Request; class UserController extends Controller diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 7daf51f..c661475 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -2,8 +2,8 @@ namespace App\Http\Middleware; -use Illuminate\Http\Request; use Fideloper\Proxy\TrustProxies as Middleware; +use Illuminate\Http\Request; class TrustProxies extends Middleware { diff --git a/app/Item.php b/app/Item.php index 19f8ada..a9d1e44 100644 --- a/app/Item.php +++ b/app/Item.php @@ -3,9 +3,8 @@ namespace App; use Auth; -use Lang; -use Illuminate\Database\Eloquent\Model; use Exception; +use Illuminate\Database\Eloquent\Model; class Item extends Model { @@ -34,7 +33,7 @@ class Item extends Model /** * Return the items from logged in user - * + * * @return \App\Item */ public static function fromAuthUser() @@ -44,7 +43,7 @@ class Item extends Model /** * Take a specified item - * + * * @return void */ public function takeItem() @@ -60,7 +59,7 @@ class Item extends Model /** * Return a specified item - * + * * @return void */ public function returnItem() @@ -75,7 +74,7 @@ class Item extends Model /** * Store a waiting user to the item - * + * * @return void */ public function storeAlert() @@ -87,7 +86,7 @@ class Item extends Model /** * Remove a waiting user to the item - * + * * @return void */ public function removeAlert() diff --git a/app/Listeners/AlertReturnedItem.php b/app/Listeners/AlertReturnedItem.php index 7dc7855..2b53869 100644 --- a/app/Listeners/AlertReturnedItem.php +++ b/app/Listeners/AlertReturnedItem.php @@ -2,12 +2,10 @@ namespace App\Listeners; -use Mail; -use App\User; use App\Events\ReturnItem; use App\Mail\ItemAvailable; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Contracts\Queue\ShouldQueue; +use App\User; +use Mail; class AlertReturnedItem { @@ -26,7 +24,7 @@ class AlertReturnedItem * is waiting for the item * * @param ReturnItem $event The return event that contains an item - * + * * @return void */ public function handle(ReturnItem $event) diff --git a/app/Listeners/SetLanguage.php b/app/Listeners/SetLanguage.php index 0509f4b..8f9b6ca 100644 --- a/app/Listeners/SetLanguage.php +++ b/app/Listeners/SetLanguage.php @@ -3,10 +3,8 @@ namespace App\Listeners; use App\User; -use IlluminateAuthEventsLogin; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Auth\Events\Login; +use IlluminateAuthEventsLogin; class SetLanguage { diff --git a/app/Mail/ItemAvailable.php b/app/Mail/ItemAvailable.php index a93e074..160a752 100644 --- a/app/Mail/ItemAvailable.php +++ b/app/Mail/ItemAvailable.php @@ -6,7 +6,6 @@ use \App\Item; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; -use Illuminate\Contracts\Queue\ShouldQueue; class ItemAvailable extends Mailable { @@ -34,7 +33,7 @@ class ItemAvailable extends Mailable { return $this->subject( \Lang::getFromJson( - ':itemname is available!', + ':itemname is available!', ['itemname' => $this->item->name] ) )->markdown('emails.itemAvailable'); diff --git a/app/Mail/UserWaiting.php b/app/Mail/UserWaiting.php index a748fee..2c4af7d 100644 --- a/app/Mail/UserWaiting.php +++ b/app/Mail/UserWaiting.php @@ -2,18 +2,17 @@ namespace App\Mail; -use Lang; use \App\Item; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; -use Illuminate\Contracts\Queue\ShouldQueue; +use Lang; class UserWaiting extends Mailable { public $item; public $waitingUser; - public $userWithItem; + public $userWithItem; use Queueable, SerializesModels; /** @@ -37,9 +36,9 @@ class UserWaiting extends Mailable { return $this->subject( Lang::getFromJson( - ':waitinguser wants to use :itemname', + ':waitinguser wants to use :itemname', [ - 'waitinguser' => $this->waitingUser, + 'waitinguser' => $this->waitingUser, 'itemname' => $this->item->name ] ) diff --git a/app/Mail/Welcome.php b/app/Mail/Welcome.php index 0281a29..5ca3ce7 100644 --- a/app/Mail/Welcome.php +++ b/app/Mail/Welcome.php @@ -2,12 +2,11 @@ namespace App\Mail; -use \Lang; use \App\User; +use \Lang; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; -use Illuminate\Contracts\Queue\ShouldQueue; class Welcome extends Mailable { diff --git a/app/Product.php b/app/Product.php index 7e42fed..66bb754 100644 --- a/app/Product.php +++ b/app/Product.php @@ -20,7 +20,7 @@ class Product extends Model /** * Return the products from logged in user - * + * * @return \App\Product */ public static function fromAuthUser() diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 958e07b..02a9d45 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Schema; +use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { @@ -14,7 +14,7 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - Schema::defaultStringLength(191); //Solved by increasing StringLength + Schema::defaultStringLength(191); //Solved by increasing StringLength // } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 9784b1a..9e68caa 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -2,7 +2,6 @@ namespace App\Providers; -use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 352cce4..395c518 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Broadcast; +use Illuminate\Support\ServiceProvider; class BroadcastServiceProvider extends ServiceProvider { diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 07d6954..cd824bf 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -3,12 +3,12 @@ namespace App\Providers; use App\Events\ReturnItem; -use App\Listeners\SetLanguage; use App\Listeners\AlertReturnedItem; -use Illuminate\Support\Facades\Event; +use App\Listeners\SetLanguage; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Event; class EventServiceProvider extends ServiceProvider { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 5ea48d3..548e4be 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { diff --git a/app/User.php b/app/User.php index a05942c..1190db7 100644 --- a/app/User.php +++ b/app/User.php @@ -3,10 +3,9 @@ namespace App; use Auth; -use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; -use Illuminate\Support\Facades\Request; +use Illuminate\Notifications\Notifiable; class User extends Authenticatable implements MustVerifyEmail { @@ -42,7 +41,7 @@ class User extends Authenticatable implements MustVerifyEmail /** * Return the logged in user - * + * * @return \App\User */ public static function loggedIn() @@ -53,7 +52,7 @@ class User extends Authenticatable implements MustVerifyEmail /** * Set the default website language * for the acual user - * + * * @param string $language The language code * * @return void diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 351d428..e42b5aa 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -30,4 +30,4 @@ $factory->define(App\Product::class, function (Faker $faker) { return factory(App\User::class)->create()->id; }, ]; -}); \ No newline at end of file +}); diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 16a6108..b48a61b 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -1,8 +1,8 @@
When adding a Product, you can specify a webpage (this is optional).
', -]; \ No newline at end of file +]; diff --git a/resources/lang/en/home.php b/resources/lang/en/home.php index 90abcf1..47dd2b3 100644 --- a/resources/lang/en/home.php +++ b/resources/lang/en/home.php @@ -9,4 +9,4 @@ return [ 'cancel_alert' => 'Cancel Alert', 'alert_me' => 'Alert me', 'take' => 'Take It' -]; \ No newline at end of file +]; diff --git a/resources/lang/en/item.php b/resources/lang/en/item.php index 2b4c958..118150a 100644 --- a/resources/lang/en/item.php +++ b/resources/lang/en/item.php @@ -37,4 +37,4 @@ return [ */ 'back' => 'BACK', -]; \ No newline at end of file +]; diff --git a/resources/lang/en/product.php b/resources/lang/en/product.php index 19201be..a9ca63d 100644 --- a/resources/lang/en/product.php +++ b/resources/lang/en/product.php @@ -2,7 +2,7 @@ /** * Strings from the product pages * They are separeted by the file that calls them. - * Sometimes, a string is used on another file, + * Sometimes, a string is used on another file, * so it will stay at the common segment. */ @@ -22,7 +22,7 @@ return [ '100yearsSolitude' => 'One Hundred Years of Solitude', /** - * addProductForm.blade.php + * addProductForm.blade.php */ 'name' => 'Name:', 'book' => 'Book', @@ -60,4 +60,4 @@ return [ 'noItemsYet' => 'There are no items yet. Include one with the form above.', 'addItem' => 'Add item', 'back' => 'BACK', -]; \ No newline at end of file +]; diff --git a/resources/lang/en/welcome.php b/resources/lang/en/welcome.php index f17e8f4..d9bb312 100644 --- a/resources/lang/en/welcome.php +++ b/resources/lang/en/welcome.php @@ -7,4 +7,4 @@ return [ 'Help' => 'Help', 'copyright' => '© 2018 Bruno Fontes All Rights Reserved', 'byAuthor' => 'By Bruno Fontes', -]; \ No newline at end of file +]; diff --git a/resources/lang/pt-br/help.php b/resources/lang/pt-br/help.php index 2548874..64cd255 100644 --- a/resources/lang/pt-br/help.php +++ b/resources/lang/pt-br/help.php @@ -71,4 +71,4 @@ return [ Para fazer isso, você só precisa clicar no item que deseja compartilhar e incluir outras pessoas.Ao adicionar um produto, você pode especificar um site (opcional).
', -]; \ No newline at end of file +]; diff --git a/resources/lang/pt-br/home.php b/resources/lang/pt-br/home.php index 4ea2216..b8582ac 100644 --- a/resources/lang/pt-br/home.php +++ b/resources/lang/pt-br/home.php @@ -9,4 +9,4 @@ return [ 'cancel_alert' => 'Cancelar alerta', 'alert_me' => 'Alertar', 'take' => 'Usar' -]; \ No newline at end of file +]; diff --git a/resources/lang/pt-br/item.php b/resources/lang/pt-br/item.php index 5e1f571..1f1881b 100644 --- a/resources/lang/pt-br/item.php +++ b/resources/lang/pt-br/item.php @@ -36,4 +36,4 @@ return [ * String from item.blade.php */ 'back' => 'VOLTAR', -]; \ No newline at end of file +]; diff --git a/resources/lang/pt-br/product.php b/resources/lang/pt-br/product.php index c8f9065..b77d356 100644 --- a/resources/lang/pt-br/product.php +++ b/resources/lang/pt-br/product.php @@ -2,7 +2,7 @@ /** * Strings from the product pages * They are separeted by the file that calls them. - * Sometimes, a string is used on another file, + * Sometimes, a string is used on another file, * so it will stay at the common segment. */ @@ -20,7 +20,7 @@ return [ '100yearsSolitude' => 'Cem anos de solidão', /** - * addProductForm.blade.php + * addProductForm.blade.php */ 'name' => 'Nome:', 'book' => 'Livro', @@ -58,4 +58,4 @@ return [ 'noItemsYet' => 'Ainda não há itens cadastrados. Inclua um no formulário acima.', 'addItem' => 'Incluir item', 'back' => 'VOLTAR', -]; \ No newline at end of file +]; diff --git a/resources/lang/pt-br/welcome.php b/resources/lang/pt-br/welcome.php index b636b3c..a144ac3 100644 --- a/resources/lang/pt-br/welcome.php +++ b/resources/lang/pt-br/welcome.php @@ -7,4 +7,4 @@ return [ 'Help' => 'Ajuda', 'copyright' => '© 2018 Bruno Fontes Todos os direitos reservados', 'byAuthor' => 'Por Bruno Fontes', -]; \ No newline at end of file +]; diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index d43de8e..dec443e 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -3,8 +3,8 @@ namespace Tests\Feature; use \App\Product; -use Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; +use Tests\TestCase; class ExampleTest extends TestCase { diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index e9fe19c..06ece2c 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -3,7 +3,6 @@ namespace Tests\Unit; use Tests\TestCase; -use Illuminate\Foundation\Testing\RefreshDatabase; class ExampleTest extends TestCase {