diff --git a/app/Http/Composer/ComposeServiceProvider.php b/app/Http/Composer/ComposeServiceProvider.php new file mode 100644 index 0000000..66aab4d --- /dev/null +++ b/app/Http/Composer/ComposeServiceProvider.php @@ -0,0 +1,33 @@ + + */ +final class ComposeServiceProvider extends ServiceProvider +{ + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + + } + + public function boot() + { + /** @var Factory $view */ + $view = $this->app->make('Illuminate\Contracts\View\Factory'); + $view->composer('dashboard.*', AllDashboardComposer::class); + + } +} \ No newline at end of file diff --git a/app/Http/Composer/Composer.php b/app/Http/Composer/Composer.php new file mode 100644 index 0000000..8826b32 --- /dev/null +++ b/app/Http/Composer/Composer.php @@ -0,0 +1,17 @@ + + */ +interface Composer +{ + /** + * @param View $view + */ + public function compose(View $view); +} \ No newline at end of file diff --git a/app/Http/Composer/Dashboard/AllDashboardComposer.php b/app/Http/Composer/Dashboard/AllDashboardComposer.php new file mode 100644 index 0000000..5004f5d --- /dev/null +++ b/app/Http/Composer/Dashboard/AllDashboardComposer.php @@ -0,0 +1,53 @@ + + */ +final class AllDashboardComposer implements Composer +{ + /** @var Guard */ + private $guard; + + /** @var QueryBus */ + private $queryBus; + + /** @var Repository */ + private $cache; + + /** + * AllDashboardComposer constructor. + * @param Guard $guard + * @param QueryBus $queryBus + * @param Repository $cache + */ + public function __construct(Guard $guard, QueryBus $queryBus, Repository $cache) + { + $this->guard = $guard; + $this->queryBus = $queryBus; + $this->cache = $cache; + } + + /** + * @param View $view + */ + public function compose(View $view) + { + + $user = $this->cache->remember('user-' . $this->guard->user()->id, + 1, + function () { + return $this->queryBus->query(new FindUserById($this->guard->user()->id)); + }); + $view->with('currentUser', $user); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Auth/AuthLoginController.php b/app/Http/Controllers/Auth/AuthLoginController.php index 9e0c0d6..abcf713 100644 --- a/app/Http/Controllers/Auth/AuthLoginController.php +++ b/app/Http/Controllers/Auth/AuthLoginController.php @@ -40,6 +40,9 @@ public function getLogin() public function postLogin(AuthLoginHttpRequest $request) { if ($this->guard->attempt($request->only(['email', 'password']))) { + + // @todo does the user belong to this group? + return redirect()->intended("/"); } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 6a8cadb..cc27321 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -16,7 +16,7 @@ class Kernel extends HttpKernel { \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, - // \FullRent\Core\Application\Http\Middleware\VerifyCsrfToken::class, + \FullRent\Core\Application\Http\Middleware\VerifyCsrfToken::class, ]; /** diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index b9162f6..2d3c56a 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -17,7 +17,6 @@ class RedirectIfAuthenticated { * Create a new filter instance. * * @param Guard $auth - * @return void */ public function __construct(Guard $auth) { @@ -35,7 +34,7 @@ public function handle($request, Closure $next) { if ($this->auth->check()) { - return new RedirectResponse(url('/home')); + return new RedirectResponse(url('/')); } return $next($request); diff --git a/app/Http/routes.php b/app/Http/routes.php index 3191f0a..9bd44be 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -6,9 +6,12 @@ $router->group([], function (Router $router) { - $router->get('auth/login',['uses' => 'Auth\AuthLoginController@getLogin']); - $router->post('auth/login',['uses' => 'Auth\AuthLoginController@postLogin']); + $router->group(['middleware' => 'guest'], + function (Router $router) { + $router->get('auth/login', ['uses' => 'Auth\AuthLoginController@getLogin']); + $router->post('auth/login', ['uses' => 'Auth\AuthLoginController@postLogin']); + }); $router->group(['middleware' => 'auth'], function (Router $router) { $router->get('/', ['uses' => 'DashboardController@index']); diff --git a/composer.json b/composer.json index 42971a8..8993386 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "samcrosoft/cloudinary": "~1.1.0", "symfony/options-resolver": "~2.6", "imagine/imagine": "^0.6.3", - "laravelcollective/html": "5.1" + "laravelcollective/html": "5.1", + "barryvdh/laravel-debugbar": "^2.1" }, "require-dev": { "phpunit/phpunit": "~4.0", diff --git a/composer.lock b/composer.lock index 7647ebd..4178a55 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "9388bcc50707156db35a03ac8a145d5b", - "content-hash": "1c925b0725c16d877ba41bf80ae4e7ec", + "hash": "a6a6ec4d42c3c2767f261c244f5c9f34", + "content-hash": "4edf9fb9076139f1d1bc2792e1fc3de8", "packages": [ { "name": "asm89/stack-cors", @@ -99,6 +99,60 @@ ], "time": "2015-12-20 20:32:17" }, + { + "name": "barryvdh/laravel-debugbar", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-debugbar.git", + "reference": "974fd16e328ca851a081449100d9509af59cf0ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/974fd16e328ca851a081449100d9509af59cf0ff", + "reference": "974fd16e328ca851a081449100d9509af59cf0ff", + "shasum": "" + }, + "require": { + "illuminate/support": "~5.0.17|5.1.*|5.2.*", + "maximebf/debugbar": "~1.11.0", + "php": ">=5.4.0", + "symfony/finder": "~2.6|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-4": { + "Barryvdh\\Debugbar\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "PHP Debugbar integration for Laravel", + "keywords": [ + "debug", + "debugbar", + "laravel", + "profiler", + "webprofiler" + ], + "time": "2015-12-22 06:22:38" + }, { "name": "beberlei/assert", "version": "v2.4", @@ -1254,6 +1308,67 @@ ], "time": "2015-12-19 20:16:43" }, + { + "name": "maximebf/debugbar", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "07741d84d39d10f00551c94284cdefcc69703e77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/07741d84d39d10f00551c94284cdefcc69703e77", + "reference": "07741d84d39d10f00551c94284cdefcc69703e77", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "^1.0", + "symfony/var-dumper": "^2.6|^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog", + "predis/predis": "Redis storage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "DebugBar\\": "src/DebugBar/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug", + "debugbar" + ], + "time": "2015-12-10 09:50:24" + }, { "name": "monolog/monolog", "version": "1.17.2", diff --git a/config/app.php b/config/app.php index 39deefa..c4ae60e 100644 --- a/config/app.php +++ b/config/app.php @@ -159,9 +159,16 @@ Barryvdh\Cors\ServiceProvider::class, Samcrosoft\Cloudinary\Provider\CloudinaryServiceProvider::class, Collective\Html\HtmlServiceProvider::class, + Barryvdh\Debugbar\ServiceProvider::class, + + + /** + * Services + */ + FullRent\Core\Application\Http\Composer\ComposeServiceProvider::class, /** - * src + * Domain */ 'FullRent\Core\Company\ServiceProviders\LaravelServiceProvider', 'FullRent\Core\User\ServiceProviders\LaravelServiceProvider', diff --git a/config/debugbar.php b/config/debugbar.php new file mode 100644 index 0000000..3b31837 --- /dev/null +++ b/config/debugbar.php @@ -0,0 +1,169 @@ + null, + + /* + |-------------------------------------------------------------------------- + | Storage settings + |-------------------------------------------------------------------------- + | + | DebugBar stores data for session/ajax requests. + | You can disable this, so the debugbar stores data in headers/session, + | but this can cause problems with large data collectors. + | By default, file storage (in the storage folder) is used. Redis and PDO + | can also be used. For PDO, run the package migrations first. + | + */ + 'storage' => array( + 'enabled' => true, + 'driver' => 'file', // redis, file, pdo + 'path' => storage_path() . '/debugbar', // For file driver + 'connection' => null, // Leave null for default connection (Redis/PDO) + ), + + /* + |-------------------------------------------------------------------------- + | Vendors + |-------------------------------------------------------------------------- + | + | Vendor files are included by default, but can be set to false. + | This can also be set to 'js' or 'css', to only include javascript or css vendor files. + | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files) + | and for js: jquery and and highlight.js + | So if you want syntax highlighting, set it to true. + | jQuery is set to not conflict with existing jQuery scripts. + | + */ + + 'include_vendors' => true, + + /* + |-------------------------------------------------------------------------- + | Capture Ajax Requests + |-------------------------------------------------------------------------- + | + | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors), + | you can use this option to disable sending the data through the headers. + | + */ + + 'capture_ajax' => true, + + /* + |-------------------------------------------------------------------------- + | Clockwork integration + |-------------------------------------------------------------------------- + | + | The Debugbar can emulate the Clockwork headers, so you can use the Chrome + | Extension, without the server-side code. It uses Debugbar collectors instead. + | + */ + 'clockwork' => false, + + /* + |-------------------------------------------------------------------------- + | DataCollectors + |-------------------------------------------------------------------------- + | + | Enable/disable DataCollectors + | + */ + + 'collectors' => array( + 'phpinfo' => true, // Php version + 'messages' => true, // Messages + 'time' => true, // Time Datalogger + 'memory' => true, // Memory usage + 'exceptions' => true, // Exception displayer + 'log' => true, // Logs from Monolog (merged in messages if enabled) + 'db' => true, // Show database (PDO) queries and bindings + 'views' => true, // Views with their data + 'route' => true, // Current route information + 'laravel' => true, // Laravel version and environment + 'events' => false, // All events fired + 'default_request' => false, // Regular or special Symfony request logger + 'symfony_request' => true, // Only one can be enabled.. + 'mail' => true, // Catch mail messages + 'logs' => false, // Add the latest log messages + 'files' => false, // Show the included files + 'config' => false, // Display config settings + 'auth' => true, // Display Laravel authentication status + 'gate' => true, // Display Laravel Gate checks + 'session' => true, // Display session data + ), + + /* + |-------------------------------------------------------------------------- + | Extra options + |-------------------------------------------------------------------------- + | + | Configure some DataCollectors + | + */ + + 'options' => array( + 'auth' => array( + 'show_name' => true, // Also show the users name/email in the debugbar + ), + 'db' => array( + 'with_params' => true, // Render SQL with the parameters substituted + 'timeline' => false, // Add the queries to the timeline + 'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files. + 'explain' => array( // EXPERIMENTAL: Show EXPLAIN output on queries + 'enabled' => false, + 'types' => array('SELECT'), // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+ + ), + 'hints' => true, // Show hints for common mistakes + ), + 'mail' => array( + 'full_log' => false + ), + 'views' => array( + 'data' => false, //Note: Can slow down the application, because the data can be quite large.. + ), + 'route' => array( + 'label' => true // show complete route on bar + ), + 'logs' => array( + 'file' => null + ), + ), + + /* + |-------------------------------------------------------------------------- + | Inject Debugbar in Response + |-------------------------------------------------------------------------- + | + | Usually, the debugbar is added just before
, by listening to the + | Response after the App is done. If you disable this, you have to add them + | in your template yourself. See http://phpdebugbar.com/docs/rendering.html + | + */ + + 'inject' => true, + + /* + |-------------------------------------------------------------------------- + | DebugBar route prefix + |-------------------------------------------------------------------------- + | + | Sometimes you want to set route prefix to be used by DebugBar to load + | its resources from. Usually the need comes from misconfigured web server or + | from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97 + | + */ + 'route_prefix' => '_debugbar', + +); diff --git a/resources/views/dashboard/dashboard.blade.php b/resources/views/dashboard/dashboard.blade.php index 48e7c64..95e57bc 100644 --- a/resources/views/dashboard/dashboard.blade.php +++ b/resources/views/dashboard/dashboard.blade.php @@ -1,6 +1,471 @@ @extends('dashboard.layout.master') +@section('content') ++ You have two project with not compleated task. +
+@Alan Marry I belive that. Lorem Ipsum + is simply dummy text of the printing and typesetting industry.
+ 1 minuts ago + +@Stock Man Check this stock chart. This + price is crazy!
+@Kevin Smith Lorem ipsum unknown + printer took a galley
+ 2 minuts ago + +@Jonathan Febrick The standard chunk of + Lorem Ipsum
+ 1 hour ago + +@Alan Marry I belive that. Lorem Ipsum + is simply dummy text of the printing and typesetting industry.
+ 1 minuts ago + +@Kevin Smith Lorem ipsum unknown + printer took a galley
+ 2 minuts ago + +Meeting
+ +Conference on the sales results for the previous year. Monica please + examine sales trends in marketing and products. Below please find + the current status of the + sale.
+ +5,3,9,6,5,9,7,3,5,2,5,3,9,6,5,9,4,7,3,2,9,8,7,4,5,1,2,9,5,4,7,2,7,7,3,5,2 +
+Send documents to Mike
+Lorem Ipsum is simply dummy text of the printing and typesetting + industry. Lorem Ipsum has been the industry's standard dummy text + ever since.
+Coffee Break
++ Go to shop and find some products. + Lorem Ipsum is simply dummy text of the printing and typesetting + industry. Lorem Ipsum has been the industry's. +
+Phone with Jeronimo
++ Lorem Ipsum has been the industry's standard dummy text ever since. +
+Go to the doctor dr Smith
++ Find some issue and go to doctor. +
+Chat with Monica and Sandra
++ Web sites still in their infancy. Various versions have evolved over + the years, sometimes by accident, sometimes on purpose (injected + humour and the like). +
+