10 Commits
v0.3 ... v0.5

Author SHA1 Message Date
3d6b0dbeca Fixed bug causing error 500 on production
Some PHP version or configuration were causing this error.

On app.blade.php of local branch, I could use "$usedItems ? :"
even if $usedItems were null, but I had to check an "isset" to the production.

On HomecController, I had to change the "object" parameter of getUsername
to "\Illuminate\Database\Eloquent\Collection" to make it work.

I took the chance to just show the number of itens in use
if it were greater than 0.
2018-10-16 20:28:59 -03:00
52223676dc Trying to fix an 500 error on production 2018-10-16 20:18:10 -03:00
7a8d5ccaff Refreshing and Including number of used items on Title
It was necessary to keep refreshing the page to
check if an item was returned when we did not
want to be alerted. So, now, the page refresh
itself every 2 minutes (while I do not know how
to use Laravel broadcasting) and the title shows
the number of items in use (including when used
by you).
2018-10-16 15:15:05 -03:00
8c4fe0a489 Refactoring
Including some use for classes;
REfactoring the HomeController, to make it cleaner
and avoid repeating code.
2018-10-10 00:46:28 -03:00
69f0722c79 Let me know if anyone subscribed during alpha
As the project is still alpha, I just want to know if someone
subscribed at it using a dummy e-mail address.
2018-10-03 19:42:35 -03:00
5667fd0a86 Composer update
Plugins updated with composer.
2018-10-03 00:32:23 -03:00
954820f46b 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.
2018-10-02 23:53:35 -03:00
8157a183c7 Refactoring: just including "use App" to make code a bit cleaner
I was using "\App::setLocale" on code, but it was annoind me.
So I included the "use App" and now I am colling
directly the "App::setLocale".
2018-10-02 23:49:16 -03:00
528d3b4caf Refactoring: TakeController returned item Mail moved to a listener
The TakeController was manually sending the email message
as well as dealing with item return, so I moved the email message
to it's own listener, I created an event for it and moved the
return part to the item model.
2018-09-30 21:37:44 -03:00
4ec2b24885 BugFixing: home page were blank on no items
When we had no items showing on home page, it were just blank.
Turns out that the @empty call that shows the default message
were appearing just when it had no items on a product, instead
of no items at all.

Fixed it moving the paragraph to the right place.
2018-09-29 12:09:18 -03:00
19 changed files with 575 additions and 193 deletions

40
app/Events/ReturnItem.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
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;
class ReturnItem
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $item;
/**
* Create a new event instance.
*
* @param Item $item The returned item.
*
* @return void
*/
public function __construct(Item $item)
{
$this->item = $item;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('channel-name');
}
}

View File

@@ -2,24 +2,35 @@
namespace App\Http\Controllers;
use Auth;
use Mail;
use \App\User;
use \App\Mail\UserWaiting;
use Illuminate\Http\Request;
class AlertController extends Controller
{
/**
* Store the waiting_user_id on db
* so the user can be alerted when
* the item is free
*
* @param Request $request Form data
*
* @return redirect to home
*/
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');
}

View File

@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
use App\FlashMessage;
use Mail;
class RegisterController extends Controller
{
@@ -71,7 +72,13 @@ class RegisterController extends Controller
'password' => Hash::make($data['password']),
]);
\Mail::to($user)->send(new Welcome($user));
Mail::to($user)->send(new Welcome($user));
$text = "Share it! New user: {$user->name} ($user->email)";
Mail::raw($text, function ($message) use ($text) {
$message->to('brunofontes.shareit@mailnull.com');
$message->subject($text);
});
session()->flash(FlashMessage::PRIMARY, __('Thanks for registering. Please, do not forget to validate your e-mail address.'));

View File

@@ -6,6 +6,8 @@ use \App\User;
class HomeController extends Controller
{
protected $activeUsers = [];
/**
* Create a new controller instance.
*
@@ -16,6 +18,50 @@ class HomeController extends Controller
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$items = User::loggedIn()->items()->with('users')->get();
$numberOfUsedItems = 0;
foreach ($items as $item) {
if (isset($item->used_by)) {
$numberOfUsedItems++;
}
$this->getUsername($item->users, $item->used_by);
$this->getUsername($item->users, $item->waiting_user_id);
}
$products = $items
->sortBy('product.name', SORT_NATURAL | SORT_FLAG_CASE)
->groupBy('product.name');
return view(
'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
*
* @return void
*/
protected function getUsername(\Illuminate\Database\Eloquent\Collection $itemUsers, ?int $id)
{
if ($id && !isset($this->activeUsers[$id])) {
$this->activeUsers[$id] = $this->findName($itemUsers, $id);
}
}
/**
* Get a name from a specific id in a array
*
@@ -32,41 +78,4 @@ class HomeController extends Controller
}
}
}
/**
* Check if the user_id alreay exists on $users array.
*
* @param array $users The array with users
* @param int $user_id The user_id to try to find on array
*
* @return boolean
*/
public function isNewUser($users, $user_id)
{
return ($user_id && !isset($users[$user_id]));
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$users = [];
$items = User::loggedIn()->items()->with('users')->get();
foreach ($items as $item) {
if ($this->isNewUser($users, $item->used_by)) {
$users[$item->used_by] = $this->findName($item->users, $item->used_by);
}
if ($this->isNewUser($users, $item->waiting_user_id)) {
$users[$item->waiting_user_id] = $this->findName($item->users, $item->waiting_user_id);
}
}
$products = $items->sortBy('product.name', SORT_NATURAL | SORT_FLAG_CASE)->groupBy('product.name');
return view('home', compact('products', 'users'));
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace App\Http\Controllers;
use App;
use Lang;
use App\User;
use Illuminate\Http\Request;
class LanguageController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param int $locale
* @return \Illuminate\Http\Response
*/
public function update($locale)
{
App::setLocale($locale);
User::setLanguage($locale);
session(['lang' => $locale]);
session()->save();
return back();
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

View File

@@ -2,44 +2,51 @@
namespace App\Http\Controllers;
use \App\Item;
use \App\User;
use App\Mail\ItemAvailable;
use Auth;
use Lang;
use App\Item;
use App\User;
use App\Events\ReturnItem;
use Illuminate\Http\Request;
/**
* Responsible to Take and Return an Item.
*/
class TakeController extends Controller
{
/**
* The user take an item
*
* @param Request $request The form data
*
* @return home view
*/
public function store(Request $request)
{
$item = User::loggedIn()->items()->find(request('item'));
if ($item->used_by) {
return back()->withErrors(
\Lang::getFromJson(
"This item is already taken"
)
Lang::getFromJson("This item is already taken")
);
}
$item->used_by = \Auth::id();
$item->used_by = Auth::id();
$item->save();
return redirect('home');
}
/**
* User return an item
* Trigger an event: ReturnItem
*
* @param Request $request Form data
*
* @return View home
*/
public function delete(Request $request)
{
$item = User::loggedIn()->items()->find(request('item'));
$waiting_id = $item->waiting_user_id;
$item->used_by = null;
$item->waiting_user_id = null;
$item->save();
//Send e-mail to waiting user
if ($waiting_id) {
$user = User::find($waiting_id);
\Mail::to($user)->send(
new ItemAvailable($user->name, $item)
);
}
event(new ReturnItem($item));
$item->returnItem();
return redirect('home');
}
}

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."
)
);

View File

@@ -2,6 +2,7 @@
namespace App\Http\Middleware;
use App;
use Closure;
class Locale
@@ -15,7 +16,7 @@ class Locale
*/
public function handle($request, Closure $next)
{
\App::setLocale(session('lang'));
App::setLocale(session('lang'));
return $next($request);
}
}

View File

@@ -38,4 +38,16 @@ class Item extends Model
{
return (new static)->where('user_id', \Auth::id());
}
/**
* Return a specified item
*
* @return void
*/
public function returnItem()
{
$this->used_by = null;
$this->waiting_user_id = null;
$this->save();
}
}

View File

@@ -0,0 +1,41 @@
<?php
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;
class AlertReturnedItem
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Send an email to the user that
* is waiting for the item
*
* @param ReturnItem $event The return event that contains an item
*
* @return void
*/
public function handle(ReturnItem $event)
{
if ($event->item->waiting_user_id) {
$user = User::find($event->item->waiting_user_id);
Mail::to($user)
->locale($user->language)
->send(new ItemAvailable($user->name, $event->item));
}
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Listeners;
use App\User;
use IlluminateAuthEventsLogin;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Auth\Events\Login;
class SetLanguage
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param IlluminateAuthEventsLogin $event
* @return void
*/
public function handle(Login $event)
{
session(['lang' => User::loggedIn()->language]);
session()->save();
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Mail;
use Lang;
use \App\Item;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
@@ -35,7 +36,7 @@ class UserWaiting extends Mailable
public function build()
{
return $this->subject(
\Lang::getFromJson(
Lang::getFromJson(
':waitinguser wants to use :itemname',
[
'waitinguser' => $this->waitingUser,

View File

@@ -2,6 +2,9 @@
namespace App\Providers;
use App\Events\ReturnItem;
use App\Listeners\SetLanguage;
use App\Listeners\AlertReturnedItem;
use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
@@ -18,6 +21,14 @@ class EventServiceProvider extends ServiceProvider
Registered::class => [
SendEmailVerificationNotification::class,
],
ReturnItem::class => [
AlertReturnedItem::class,
],
'Illuminate\Auth\Events\Login' => [
SetLanguage::class,
],
];
/**

View File

@@ -2,6 +2,7 @@
namespace App;
use Auth;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
@@ -46,6 +47,23 @@ class User extends Authenticatable implements MustVerifyEmail
*/
public static function loggedIn()
{
return (new static)->findOrFail(\Auth::id());
return (new static)->findOrFail(Auth::id());
}
/**
* Set the default website language
* for the acual user
*
* @param string $language The language code
*
* @return void
*/
public static function setLanguage(string $language)
{
if (Auth::check()) {
$user = self::loggedIn();
$user->language = $language;
$user->save();
}
}
}

297
composer.lock generated
View File

@@ -211,16 +211,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.5",
"version": "2.1.6",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "54859fabea8b3beecbb1a282888d5c990036b9e3"
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/54859fabea8b3beecbb1a282888d5c990036b9e3",
"reference": "54859fabea8b3beecbb1a282888d5c990036b9e3",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
"shasum": ""
},
"require": {
@@ -264,7 +264,7 @@
"validation",
"validator"
],
"time": "2018-08-16T20:49:45+00:00"
"time": "2018-09-25T20:47:26+00:00"
},
{
"name": "erusev/parsedown",
@@ -368,32 +368,32 @@
},
{
"name": "jakub-onderka/php-console-color",
"version": "0.1",
"version": "v0.2",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Console-Color.git",
"reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1"
"reference": "d5deaecff52a0d61ccb613bb3804088da0307191"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1",
"reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191",
"reference": "d5deaecff52a0d61ccb613bb3804088da0307191",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
"php": ">=5.4.0"
},
"require-dev": {
"jakub-onderka/php-code-style": "1.0",
"jakub-onderka/php-parallel-lint": "0.*",
"jakub-onderka/php-parallel-lint": "1.0",
"jakub-onderka/php-var-dump-check": "0.*",
"phpunit/phpunit": "3.7.*",
"phpunit/phpunit": "~4.3",
"squizlabs/php_codesniffer": "1.*"
},
"type": "library",
"autoload": {
"psr-0": {
"JakubOnderka\\PhpConsoleColor": "src/"
"psr-4": {
"JakubOnderka\\PhpConsoleColor\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -403,11 +403,10 @@
"authors": [
{
"name": "Jakub Onderka",
"email": "jakub.onderka@gmail.com",
"homepage": "http://www.acci.cz"
"email": "jakub.onderka@gmail.com"
}
],
"time": "2014-04-08T15:00:19+00:00"
"time": "2018-09-29T17:23:10+00:00"
},
{
"name": "jakub-onderka/php-console-highlighter",
@@ -455,16 +454,16 @@
},
{
"name": "laravel/framework",
"version": "v5.7.2",
"version": "v5.7.7",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "86e1f98a6d2aab018e0257a7cb2ef2110d64a873"
"reference": "0438455128c0850b5872c7f3c11b7ccdbbfcba3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/86e1f98a6d2aab018e0257a7cb2ef2110d64a873",
"reference": "86e1f98a6d2aab018e0257a7cb2ef2110d64a873",
"url": "https://api.github.com/repos/laravel/framework/zipball/0438455128c0850b5872c7f3c11b7ccdbbfcba3e",
"reference": "0438455128c0850b5872c7f3c11b7ccdbbfcba3e",
"shasum": ""
},
"require": {
@@ -476,6 +475,7 @@
"league/flysystem": "^1.0.8",
"monolog/monolog": "^1.12",
"nesbot/carbon": "^1.26.3",
"opis/closure": "^3.1",
"php": "^7.1.3",
"psr/container": "^1.0",
"psr/simple-cache": "^1.0",
@@ -592,7 +592,7 @@
"framework",
"laravel"
],
"time": "2018-09-06T14:01:05+00:00"
"time": "2018-10-02T14:12:00+00:00"
},
{
"name": "laravel/tinker",
@@ -659,26 +659,26 @@
},
{
"name": "league/flysystem",
"version": "1.0.46",
"version": "1.0.47",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2"
"reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2",
"reference": "f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a11e4a75f256bdacf99d20780ce42d3b8272975c",
"reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"php": ">=5.5.9"
},
"conflict": {
"league/flysystem-sftp": "<1.0.6"
},
"require-dev": {
"ext-fileinfo": "*",
"phpspec/phpspec": "^3.4",
"phpunit/phpunit": "^5.7.10"
},
@@ -739,7 +739,7 @@
"sftp",
"storage"
],
"time": "2018-08-22T07:45:22+00:00"
"time": "2018-09-14T15:30:29+00:00"
},
{
"name": "monolog/monolog",
@@ -821,16 +821,16 @@
},
{
"name": "nesbot/carbon",
"version": "1.33.0",
"version": "1.34.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "55667c1007a99e82030874b1bb14d24d07108413"
"reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413",
"reference": "55667c1007a99e82030874b1bb14d24d07108413",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33",
"reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33",
"shasum": ""
},
"require": {
@@ -872,20 +872,20 @@
"datetime",
"time"
],
"time": "2018-08-07T08:39:47+00:00"
"time": "2018-09-20T19:36:25+00:00"
},
{
"name": "nikic/php-parser",
"version": "v4.0.3",
"version": "v4.0.4",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d"
"reference": "fa6ee28600d21d49b2b4e1006b48426cec8e579c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d",
"reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fa6ee28600d21d49b2b4e1006b48426cec8e579c",
"reference": "fa6ee28600d21d49b2b4e1006b48426cec8e579c",
"shasum": ""
},
"require": {
@@ -923,7 +923,68 @@
"parser",
"php"
],
"time": "2018-07-15T17:25:16+00:00"
"time": "2018-09-18T07:03:24+00:00"
},
{
"name": "opis/closure",
"version": "3.1.1",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "d3209e46ad6c69a969b705df0738fd0dbe26ef9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/d3209e46ad6c69a969b705df0738fd0dbe26ef9e",
"reference": "d3209e46ad6c69a969b705df0738fd0dbe26ef9e",
"shasum": ""
},
"require": {
"php": "^5.4 || ^7.0"
},
"require-dev": {
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Opis\\Closure\\": "src/"
},
"files": [
"functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marius Sarca",
"email": "marius.sarca@gmail.com"
},
{
"name": "Sorin Sarca",
"email": "sarca_sorin@hotmail.com"
}
],
"description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
"homepage": "https://opis.io/closure",
"keywords": [
"anonymous functions",
"closure",
"function",
"serializable",
"serialization",
"serialize"
],
"time": "2018-10-02T13:36:53+00:00"
},
{
"name": "paragonie/random_compat",
@@ -1272,16 +1333,16 @@
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.1.2",
"version": "v6.1.3",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8"
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7d760881d266d63c5e7a1155cbcf2ac656a31ca8",
"reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4",
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4",
"shasum": ""
},
"require": {
@@ -1327,20 +1388,20 @@
"mail",
"mailer"
],
"time": "2018-07-13T07:04:35+00:00"
"time": "2018-09-11T07:12:52+00:00"
},
{
"name": "symfony/console",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "ca80b8ced97cf07390078b29773dc384c39eee1f"
"reference": "d3dbe91fd5b8b11ecb73508c844bc6a490de15b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f",
"reference": "ca80b8ced97cf07390078b29773dc384c39eee1f",
"url": "https://api.github.com/repos/symfony/console/zipball/d3dbe91fd5b8b11ecb73508c844bc6a490de15b4",
"reference": "d3dbe91fd5b8b11ecb73508c844bc6a490de15b4",
"shasum": ""
},
"require": {
@@ -1395,20 +1456,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2018-07-26T11:24:31+00:00"
"time": "2018-09-30T03:38:13+00:00"
},
{
"name": "symfony/css-selector",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "2a4df7618f869b456f9096781e78c57b509d76c7"
"reference": "9ac515bde3c725ca46efa918d37e37c7cece6353"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/2a4df7618f869b456f9096781e78c57b509d76c7",
"reference": "2a4df7618f869b456f9096781e78c57b509d76c7",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/9ac515bde3c725ca46efa918d37e37c7cece6353",
"reference": "9ac515bde3c725ca46efa918d37e37c7cece6353",
"shasum": ""
},
"require": {
@@ -1448,20 +1509,20 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2018-07-26T09:10:45+00:00"
"time": "2018-09-08T13:24:10+00:00"
},
{
"name": "symfony/debug",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "47ead688f1f2877f3f14219670f52e4722ee7052"
"reference": "b4a0b67dee59e2cae4449a8f8eabc508d622fd33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/47ead688f1f2877f3f14219670f52e4722ee7052",
"reference": "47ead688f1f2877f3f14219670f52e4722ee7052",
"url": "https://api.github.com/repos/symfony/debug/zipball/b4a0b67dee59e2cae4449a8f8eabc508d622fd33",
"reference": "b4a0b67dee59e2cae4449a8f8eabc508d622fd33",
"shasum": ""
},
"require": {
@@ -1504,11 +1565,11 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2018-08-03T11:13:38+00:00"
"time": "2018-09-22T19:04:12+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@@ -1571,16 +1632,16 @@
},
{
"name": "symfony/finder",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068"
"reference": "f0b042d445c155501793e7b8007457f9f5bb1c8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068",
"reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068",
"url": "https://api.github.com/repos/symfony/finder/zipball/f0b042d445c155501793e7b8007457f9f5bb1c8c",
"reference": "f0b042d445c155501793e7b8007457f9f5bb1c8c",
"shasum": ""
},
"require": {
@@ -1616,20 +1677,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2018-07-26T11:24:31+00:00"
"time": "2018-09-21T12:49:42+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "3a5c91e133b220bb882b3cd773ba91bf39989345"
"reference": "2ce66353d0a6ea96bc54bc9ecf8bcea4eaf5896c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a5c91e133b220bb882b3cd773ba91bf39989345",
"reference": "3a5c91e133b220bb882b3cd773ba91bf39989345",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/2ce66353d0a6ea96bc54bc9ecf8bcea4eaf5896c",
"reference": "2ce66353d0a6ea96bc54bc9ecf8bcea4eaf5896c",
"shasum": ""
},
"require": {
@@ -1670,20 +1731,20 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2018-08-27T17:47:02+00:00"
"time": "2018-09-30T03:47:35+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "33de0a1ff2e1720096189e3ced682d7a4e8f5e35"
"reference": "74b1d37bf9a1cddc38093530c0a931a310994ea5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/33de0a1ff2e1720096189e3ced682d7a4e8f5e35",
"reference": "33de0a1ff2e1720096189e3ced682d7a4e8f5e35",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/74b1d37bf9a1cddc38093530c0a931a310994ea5",
"reference": "74b1d37bf9a1cddc38093530c0a931a310994ea5",
"shasum": ""
},
"require": {
@@ -1757,7 +1818,7 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"time": "2018-08-28T06:17:42+00:00"
"time": "2018-09-30T05:05:39+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -1933,16 +1994,16 @@
},
{
"name": "symfony/process",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843"
"reference": "c64647828bc7733ba9427f1eeb1b542588635427"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/86cdb930a6a855b0ab35fb60c1504cb36184f843",
"reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843",
"url": "https://api.github.com/repos/symfony/process/zipball/c64647828bc7733ba9427f1eeb1b542588635427",
"reference": "c64647828bc7733ba9427f1eeb1b542588635427",
"shasum": ""
},
"require": {
@@ -1978,20 +2039,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2018-08-03T11:13:38+00:00"
"time": "2018-09-08T13:24:10+00:00"
},
{
"name": "symfony/routing",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "a5784c2ec4168018c87b38f0e4f39d2278499f51"
"reference": "d998113cf6db1e8262fdd8d5db9774c9a7be33b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/a5784c2ec4168018c87b38f0e4f39d2278499f51",
"reference": "a5784c2ec4168018c87b38f0e4f39d2278499f51",
"url": "https://api.github.com/repos/symfony/routing/zipball/d998113cf6db1e8262fdd8d5db9774c9a7be33b0",
"reference": "d998113cf6db1e8262fdd8d5db9774c9a7be33b0",
"shasum": ""
},
"require": {
@@ -2055,20 +2116,20 @@
"uri",
"url"
],
"time": "2018-08-03T07:58:40+00:00"
"time": "2018-09-08T13:24:10+00:00"
},
{
"name": "symfony/translation",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f"
"reference": "6e49130ddf150b7bfe9e34edb2f3f698aa1aa43b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/fa2182669f7983b7aa5f1a770d053f79f0ef144f",
"reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f",
"url": "https://api.github.com/repos/symfony/translation/zipball/6e49130ddf150b7bfe9e34edb2f3f698aa1aa43b",
"reference": "6e49130ddf150b7bfe9e34edb2f3f698aa1aa43b",
"shasum": ""
},
"require": {
@@ -2124,20 +2185,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2018-08-07T12:45:11+00:00"
"time": "2018-09-21T12:49:42+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v4.1.4",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "a05426e27294bba7b0226ffc17dd01a3c6ef9777"
"reference": "1509020968321c1d46408c11c142a2388b1c9b0c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/a05426e27294bba7b0226ffc17dd01a3c6ef9777",
"reference": "a05426e27294bba7b0226ffc17dd01a3c6ef9777",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/1509020968321c1d46408c11c142a2388b1c9b0c",
"reference": "1509020968321c1d46408c11c142a2388b1c9b0c",
"shasum": ""
},
"require": {
@@ -2199,7 +2260,7 @@
"debug",
"dump"
],
"time": "2018-08-02T09:24:26+00:00"
"time": "2018-09-18T12:45:12+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@@ -2417,16 +2478,16 @@
},
{
"name": "filp/whoops",
"version": "2.2.0",
"version": "2.2.1",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "181c4502d8f34db7aed7bfe88d4f87875b8e947a"
"reference": "e79cd403fb77fc8963a99ecc30e80ddd885b3311"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/181c4502d8f34db7aed7bfe88d4f87875b8e947a",
"reference": "181c4502d8f34db7aed7bfe88d4f87875b8e947a",
"url": "https://api.github.com/repos/filp/whoops/zipball/e79cd403fb77fc8963a99ecc30e80ddd885b3311",
"reference": "e79cd403fb77fc8963a99ecc30e80ddd885b3311",
"shasum": ""
},
"require": {
@@ -2445,7 +2506,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
"dev-master": "2.2-dev"
}
},
"autoload": {
@@ -2474,7 +2535,7 @@
"throwable",
"whoops"
],
"time": "2018-03-03T17:56:25+00:00"
"time": "2018-06-30T13:14:06+00:00"
},
{
"name": "fzaninotto/faker",
@@ -2576,16 +2637,16 @@
},
{
"name": "mockery/mockery",
"version": "1.1.0",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/mockery/mockery.git",
"reference": "99e29d3596b16dabe4982548527d5ddf90232e99"
"reference": "100633629bf76d57430b86b7098cd6beb996a35a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mockery/mockery/zipball/99e29d3596b16dabe4982548527d5ddf90232e99",
"reference": "99e29d3596b16dabe4982548527d5ddf90232e99",
"url": "https://api.github.com/repos/mockery/mockery/zipball/100633629bf76d57430b86b7098cd6beb996a35a",
"reference": "100633629bf76d57430b86b7098cd6beb996a35a",
"shasum": ""
},
"require": {
@@ -2594,8 +2655,7 @@
"php": ">=5.6.0"
},
"require-dev": {
"phpdocumentor/phpdocumentor": "^2.9",
"phpunit/phpunit": "~5.7.10|~6.5"
"phpunit/phpunit": "~5.7.10|~6.5|~7.0"
},
"type": "library",
"extra": {
@@ -2638,7 +2698,7 @@
"test double",
"testing"
],
"time": "2018-05-08T08:54:48+00:00"
"time": "2018-10-02T21:52:37+00:00"
},
{
"name": "myclabs/deep-copy",
@@ -3133,21 +3193,24 @@
},
{
"name": "phpunit/php-file-iterator",
"version": "2.0.1",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c"
"reference": "050bedf145a257b1ff02746c31894800e5122946"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c",
"reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946",
"reference": "050bedf145a257b1ff02746c31894800e5122946",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
@@ -3176,7 +3239,7 @@
"filesystem",
"iterator"
],
"time": "2018-06-11T11:44:00+00:00"
"time": "2018-09-13T20:33:42+00:00"
},
{
"name": "phpunit/php-text-template",
@@ -3319,16 +3382,16 @@
},
{
"name": "phpunit/phpunit",
"version": "7.3.4",
"version": "7.3.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "0356331bf62896dc56e3a15030b23b73f38b2935"
"reference": "7b331efabbb628c518c408fdfcaf571156775de2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0356331bf62896dc56e3a15030b23b73f38b2935",
"reference": "0356331bf62896dc56e3a15030b23b73f38b2935",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b331efabbb628c518c408fdfcaf571156775de2",
"reference": "7b331efabbb628c518c408fdfcaf571156775de2",
"shasum": ""
},
"require": {
@@ -3399,7 +3462,7 @@
"testing",
"xunit"
],
"time": "2018-09-05T09:58:53+00:00"
"time": "2018-09-08T15:14:29+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddLocationToUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('language')->after('email_verified_at')->default('en');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('language');
});
}
}

View File

@@ -1,6 +1,13 @@
@extends('layouts.app')
@section('content')
<script type="text/javascript">
setInterval(function() {
window.location.reload(true);
}, 2*60000); //NOTE: period is passed in milliseconds
</script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
@@ -33,11 +40,11 @@
</div>
</div>
@empty
<p>@lang('home.no_messages')<a href="/product">@lang('home.share_item')</a></p>
@endforelse
</div>
</div>
@empty
<p>@lang('home.no_messages') <a href="/product">@lang('home.share_item')</a></p>
@endforelse
</div>
</div>

View File

@@ -8,7 +8,7 @@
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<title>{{ config('app.name', 'Laravel') }} {{ isset($usedItems) && $usedItems > 0 ? "(${usedItems})" : '' }}</title>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>

View File

@@ -15,11 +15,7 @@ Route::get('/', function () {
return view('welcome');
});
Route::get('/lang/{locale}', function ($locale) {
session(['lang' => $locale]);
session()->save();
return back();
});
Route::get('/lang/{locale}', 'LanguageController@update')->name('language');
Route::get('/product', 'ProductController@index')->middleware('verified');
Route::get('/product/{product}', 'ProductController@show')->middleware('verified');