Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Письменов Дмитрий Иванович
/
yourroomads
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 15b76120
authored
Sep 08, 2020
by
Jonathan Reinink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade to Laravel 8
1 parent
680826b0
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
190 additions
and
327 deletions
app/Exceptions/Handler.php
app/Http/Controllers/Auth/ForgotPasswordController.php
app/Http/Controllers/Auth/LoginController.php
app/Http/Controllers/Auth/RegisterController.php
app/Http/Controllers/Auth/ResetPasswordController.php
app/Http/Controllers/Auth/VerificationController.php
app/Http/Controllers/ContactsController.php
app/Http/Controllers/DashboardController.php
app/Http/Controllers/OrganizationsController.php
app/Http/Controllers/ReportsController.php
app/Http/Controllers/UsersController.php
app/Http/Kernel.php
app/Http/Middleware/CheckForMaintenanceMode.php → app/Http/Middleware/PreventRequestsDuringMaintenance.php
app/Http/Middleware/RedirectIfAuthenticated.php
app/Account.php → app/Models/Account.php
app/Contact.php → app/Models/Contact.php
app/Model.php → app/Models/Model.php
app/Organization.php → app/Models/Organization.php
app/User.php → app/Models/User.php
app/Providers/EventServiceProvider.php
app/Providers/RouteServiceProvider.php
composer.json
composer.lock
config/auth.php
config/queue.php
database/factories/ContactFactory.php
database/factories/OrganizationFactory.php
database/factories/UserFactory.php
database/seeds/DatabaseSeeder.php
phpunit.xml
routes/channels.php
routes/console.php
routes/web.php
tests/Feature/ContactsTest.php
tests/Feature/OrganizationsTest.php
app/Exceptions/Handler.php
View file @
15b7612
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
namespace
App\Exceptions
;
namespace
App\Exceptions
;
use
Illuminate\Foundation\Exceptions\Handler
as
ExceptionHandler
;
use
Illuminate\Foundation\Exceptions\Handler
as
ExceptionHandler
;
use
Throwable
;
class
Handler
extends
ExceptionHandler
class
Handler
extends
ExceptionHandler
{
{
...
@@ -27,29 +26,12 @@ class Handler extends ExceptionHandler
...
@@ -27,29 +26,12 @@ class Handler extends ExceptionHandler
];
];
/**
/**
* Re
port or log an excep
tion.
* Re
gister the exception handling callbacks for the applica
tion.
*
*
* @param \Throwable $exception
* @return void
* @return void
*
* @throws \Exception
*/
*/
public
function
re
port
(
Throwable
$exception
)
public
function
re
gister
(
)
{
{
parent
::
report
(
$exception
);
//
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public
function
render
(
$request
,
Throwable
$exception
)
{
return
parent
::
render
(
$request
,
$exception
);
}
}
}
}
app/Http/Controllers/Auth/ForgotPasswordController.php
deleted
100644 → 0
View file @
680826b
<?php
namespace
App\Http\Controllers\Auth
;
use
App\Http\Controllers\Controller
;
use
Illuminate\Foundation\Auth\SendsPasswordResetEmails
;
class
ForgotPasswordController
extends
Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use
SendsPasswordResetEmails
;
/**
* Create a new controller instance.
*
* @return void
*/
public
function
__construct
()
{
$this
->
middleware
(
'guest'
);
}
}
app/Http/Controllers/Auth/LoginController.php
View file @
15b7612
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
namespace
App\Http\Controllers\Auth
;
namespace
App\Http\Controllers\Auth
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
use
App\Providers\RouteServiceProvider
;
use
Illuminate\Foundation\Auth\AuthenticatesUsers
;
use
Illuminate\Foundation\Auth\AuthenticatesUsers
;
use
Illuminate\Support\Facades\Redirect
;
use
Inertia\Inertia
;
use
Inertia\Inertia
;
class
LoginController
extends
Controller
class
LoginController
extends
Controller
...
@@ -27,8 +27,13 @@ class LoginController extends Controller
...
@@ -27,8 +27,13 @@ class LoginController extends Controller
*
*
* @var string
* @var string
*/
*/
protected
$redirectTo
=
'/'
;
protected
$redirectTo
=
RouteServiceProvider
::
HOME
;
/**
* Show the application's login form.
*
* @return \Inertia\Response
*/
public
function
showLoginForm
()
public
function
showLoginForm
()
{
{
return
Inertia
::
render
(
'Auth/Login'
);
return
Inertia
::
render
(
'Auth/Login'
);
...
...
app/Http/Controllers/Auth/RegisterController.php
deleted
100644 → 0
View file @
680826b
<?php
namespace
App\Http\Controllers\Auth
;
use
App\Http\Controllers\Controller
;
use
App\User
;
use
Illuminate\Foundation\Auth\RegistersUsers
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Validator
;
class
RegisterController
extends
Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use
RegistersUsers
;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected
$redirectTo
=
'/home'
;
/**
* Create a new controller instance.
*
* @return void
*/
public
function
__construct
()
{
$this
->
middleware
(
'guest'
);
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected
function
validator
(
array
$data
)
{
return
Validator
::
make
(
$data
,
[
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
'email'
=>
[
'required'
,
'string'
,
'email'
,
'max:255'
,
'unique:users'
],
'password'
=>
[
'required'
,
'string'
,
'min:8'
,
'confirmed'
],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected
function
create
(
array
$data
)
{
return
User
::
create
([
'name'
=>
$data
[
'name'
],
'email'
=>
$data
[
'email'
],
'password'
=>
Hash
::
make
(
$data
[
'password'
]),
]);
}
}
app/Http/Controllers/Auth/ResetPasswordController.php
deleted
100644 → 0
View file @
680826b
<?php
namespace
App\Http\Controllers\Auth
;
use
App\Http\Controllers\Controller
;
use
Illuminate\Foundation\Auth\ResetsPasswords
;
class
ResetPasswordController
extends
Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use
ResetsPasswords
;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected
$redirectTo
=
'/home'
;
/**
* Create a new controller instance.
*
* @return void
*/
public
function
__construct
()
{
$this
->
middleware
(
'guest'
);
}
}
app/Http/Controllers/Auth/VerificationController.php
deleted
100644 → 0
View file @
680826b
<?php
namespace
App\Http\Controllers\Auth
;
use
App\Http\Controllers\Controller
;
use
Illuminate\Foundation\Auth\VerifiesEmails
;
class
VerificationController
extends
Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use
VerifiesEmails
;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected
$redirectTo
=
'/home'
;
/**
* Create a new controller instance.
*
* @return void
*/
public
function
__construct
()
{
$this
->
middleware
(
'auth'
);
$this
->
middleware
(
'signed'
)
->
only
(
'verify'
);
$this
->
middleware
(
'throttle:6,1'
)
->
only
(
'verify'
,
'resend'
);
}
}
app/Http/Controllers/ContactsController.php
View file @
15b7612
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\Contact
;
use
App\
Models\
Contact
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Redirect
;
use
Illuminate\Support\Facades\Redirect
;
use
Illuminate\Support\Facades\Request
;
use
Illuminate\Support\Facades\Request
;
...
...
app/Http/Controllers/DashboardController.php
View file @
15b7612
...
@@ -6,7 +6,7 @@ use Inertia\Inertia;
...
@@ -6,7 +6,7 @@ use Inertia\Inertia;
class
DashboardController
extends
Controller
class
DashboardController
extends
Controller
{
{
public
function
__invoke
()
public
function
index
()
{
{
return
Inertia
::
render
(
'Dashboard/Index'
);
return
Inertia
::
render
(
'Dashboard/Index'
);
}
}
...
...
app/Http/Controllers/OrganizationsController.php
View file @
15b7612
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\Organization
;
use
App\
Models\
Organization
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Redirect
;
use
Illuminate\Support\Facades\Redirect
;
use
Illuminate\Support\Facades\Request
;
use
Illuminate\Support\Facades\Request
;
...
...
app/Http/Controllers/ReportsController.php
View file @
15b7612
...
@@ -6,7 +6,7 @@ use Inertia\Inertia;
...
@@ -6,7 +6,7 @@ use Inertia\Inertia;
class
ReportsController
extends
Controller
class
ReportsController
extends
Controller
{
{
public
function
__invoke
()
public
function
index
()
{
{
return
Inertia
::
render
(
'Reports/Index'
);
return
Inertia
::
render
(
'Reports/Index'
);
}
}
...
...
app/Http/Controllers/UsersController.php
View file @
15b7612
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\User
;
use
App\
Models\
User
;
use
Illuminate\Support\Facades\App
;
use
Illuminate\Support\Facades\App
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Redirect
;
use
Illuminate\Support\Facades\Redirect
;
...
...
app/Http/Kernel.php
View file @
15b7612
...
@@ -17,7 +17,7 @@ class Kernel extends HttpKernel
...
@@ -17,7 +17,7 @@ class Kernel extends HttpKernel
// \App\Http\Middleware\TrustHosts::class,
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies
::
class
,
\App\Http\Middleware\TrustProxies
::
class
,
\Fruitcake\Cors\HandleCors
::
class
,
\Fruitcake\Cors\HandleCors
::
class
,
\App\Http\Middleware\
CheckForMaintenanceMod
e
::
class
,
\App\Http\Middleware\
PreventRequestsDuringMaintenanc
e
::
class
,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize
::
class
,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize
::
class
,
\App\Http\Middleware\TrimStrings
::
class
,
\App\Http\Middleware\TrimStrings
::
class
,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull
::
class
,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull
::
class
,
...
@@ -40,7 +40,7 @@ class Kernel extends HttpKernel
...
@@ -40,7 +40,7 @@ class Kernel extends HttpKernel
],
],
'api'
=>
[
'api'
=>
[
'throttle:
60,1
'
,
'throttle:
api
'
,
\Illuminate\Routing\Middleware\SubstituteBindings
::
class
,
\Illuminate\Routing\Middleware\SubstituteBindings
::
class
,
],
],
];
];
...
@@ -55,7 +55,6 @@ class Kernel extends HttpKernel
...
@@ -55,7 +55,6 @@ class Kernel extends HttpKernel
protected
$routeMiddleware
=
[
protected
$routeMiddleware
=
[
'auth'
=>
\App\Http\Middleware\Authenticate
::
class
,
'auth'
=>
\App\Http\Middleware\Authenticate
::
class
,
'auth.basic'
=>
\Illuminate\Auth\Middleware\AuthenticateWithBasicAuth
::
class
,
'auth.basic'
=>
\Illuminate\Auth\Middleware\AuthenticateWithBasicAuth
::
class
,
'bindings'
=>
\Illuminate\Routing\Middleware\SubstituteBindings
::
class
,
'cache.headers'
=>
\Illuminate\Http\Middleware\SetCacheHeaders
::
class
,
'cache.headers'
=>
\Illuminate\Http\Middleware\SetCacheHeaders
::
class
,
'can'
=>
\Illuminate\Auth\Middleware\Authorize
::
class
,
'can'
=>
\Illuminate\Auth\Middleware\Authorize
::
class
,
'guest'
=>
\App\Http\Middleware\RedirectIfAuthenticated
::
class
,
'guest'
=>
\App\Http\Middleware\RedirectIfAuthenticated
::
class
,
...
...
app/Http/Middleware/
CheckForMaintenanceMod
e.php
→
app/Http/Middleware/
PreventRequestsDuringMaintenanc
e.php
View file @
15b7612
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
namespace
App\Http\Middleware
;
namespace
App\Http\Middleware
;
use
Illuminate\Foundation\Http\Middleware\
CheckForMaintenanceMod
e
as
Middleware
;
use
Illuminate\Foundation\Http\Middleware\
PreventRequestsDuringMaintenanc
e
as
Middleware
;
class
CheckForMaintenanceMod
e
extends
Middleware
class
PreventRequestsDuringMaintenanc
e
extends
Middleware
{
{
/**
/**
* The URIs that should be reachable while maintenance mode is enabled.
* The URIs that should be reachable while maintenance mode is enabled.
...
...
app/Http/Middleware/RedirectIfAuthenticated.php
View file @
15b7612
...
@@ -13,14 +13,18 @@ class RedirectIfAuthenticated
...
@@ -13,14 +13,18 @@ class RedirectIfAuthenticated
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Closure $next
* @param string
|null $guard
* @param string
[]|null ...$guards
* @return mixed
* @return mixed
*/
*/
public
function
handle
(
$request
,
Closure
$next
,
$guard
=
null
)
public
function
handle
(
$request
,
Closure
$next
,
...
$guards
)
{
{
$guards
=
empty
(
$guards
)
?
[
null
]
:
$guards
;
foreach
(
$guards
as
$guard
)
{
if
(
Auth
::
guard
(
$guard
)
->
check
())
{
if
(
Auth
::
guard
(
$guard
)
->
check
())
{
return
redirect
(
RouteServiceProvider
::
HOME
);
return
redirect
(
RouteServiceProvider
::
HOME
);
}
}
}
return
$next
(
$request
);
return
$next
(
$request
);
}
}
...
...
app/Account.php
→
app/
Models/
Account.php
View file @
15b7612
<?php
<?php
namespace
App
;
namespace
App
\Models
;
class
Account
extends
Model
class
Account
extends
Model
{
{
...
...
app/Contact.php
→
app/
Models/
Contact.php
View file @
15b7612
<?php
<?php
namespace
App
;
namespace
App
\Models
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
...
...
app/Model.php
→
app/Model
s/Model
.php
View file @
15b7612
<?php
<?php
namespace
App
;
namespace
App
\Models
;
use
Illuminate\Database\Eloquent\Model
as
Eloquent
;
use
Illuminate\Database\Eloquent\Model
as
Eloquent
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
...
...
app/Organization.php
→
app/
Models/
Organization.php
View file @
15b7612
<?php
<?php
namespace
App
;
namespace
App
\Models
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
...
...
app/User.php
→
app/
Models/
User.php
View file @
15b7612
<?php
<?php
namespace
App
;
namespace
App
\Models
;
use
Illuminate\Auth\Authenticatable
;
use
Illuminate\Auth\Authenticatable
;
use
Illuminate\Contracts\Auth\Access\Authorizable
as
AuthorizableContract
;
use
Illuminate\Contracts\Auth\Access\Authorizable
as
AuthorizableContract
;
...
...
app/Providers/EventServiceProvider.php
View file @
15b7612
...
@@ -27,8 +27,6 @@ class EventServiceProvider extends ServiceProvider
...
@@ -27,8 +27,6 @@ class EventServiceProvider extends ServiceProvider
*/
*/
public
function
boot
()
public
function
boot
()
{
{
parent
::
boot
();
//
//
}
}
}
}
app/Providers/RouteServiceProvider.php
View file @
15b7612
...
@@ -2,26 +2,22 @@
...
@@ -2,26 +2,22 @@
namespace
App\Providers
;
namespace
App\Providers
;
use
Illuminate\Cache\RateLimiting\Limit
;
use
Illuminate\Foundation\Support\Providers\RouteServiceProvider
as
ServiceProvider
;
use
Illuminate\Foundation\Support\Providers\RouteServiceProvider
as
ServiceProvider
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\RateLimiter
;
use
Illuminate\Support\Facades\Route
;
use
Illuminate\Support\Facades\Route
;
class
RouteServiceProvider
extends
ServiceProvider
class
RouteServiceProvider
extends
ServiceProvider
{
{
/**
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected
$namespace
=
'App\Http\Controllers'
;
/**
* The path to the "home" route for your application.
* The path to the "home" route for your application.
*
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
* @var string
*/
*/
public
const
HOME
=
'/
home
'
;
public
const
HOME
=
'/'
;
/**
/**
* Define your route model bindings, pattern filters, etc.
* Define your route model bindings, pattern filters, etc.
...
@@ -30,51 +26,27 @@ class RouteServiceProvider extends ServiceProvider
...
@@ -30,51 +26,27 @@ class RouteServiceProvider extends ServiceProvider
*/
*/
public
function
boot
()
public
function
boot
()
{
{
//
$this
->
configureRateLimiting
();
parent
::
boot
();
}
/**
* Define the routes for the application.
*
* @return void
*/
public
function
map
()
{
$this
->
mapApiRoutes
();
$this
->
mapWebRoutes
();
//
$this
->
routes
(
function
()
{
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected
function
mapWebRoutes
()
{
Route
::
middleware
(
'web'
)
Route
::
middleware
(
'web'
)
->
namespace
(
$this
->
namespace
)
->
group
(
base_path
(
'routes/web.php'
));
->
group
(
base_path
(
'routes/web.php'
));
Route
::
prefix
(
'api'
)
->
middleware
(
'api'
)
->
group
(
base_path
(
'routes/api.php'
));
});
}
}
/**
/**
* Define the "api" routes for the application.
* Configure the rate limiters for the application.
*
* These routes are typically stateless.
*
*
* @return void
* @return void
*/
*/
protected
function
mapApiRoutes
()
protected
function
configureRateLimiting
()
{
{
Route
::
prefix
(
'api'
)
RateLimiter
::
for
(
'api'
,
function
(
Request
$request
)
{
->
middleware
(
'api'
)
return
Limit
::
perMinute
(
60
);
->
namespace
(
$this
->
namespace
)
});
->
group
(
base_path
(
'routes/api.php'
));
}
}
}
}
composer.json
View file @
15b7612
...
@@ -8,22 +8,23 @@
...
@@ -8,22 +8,23 @@
],
],
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"require"
:
{
"require"
:
{
"php"
:
"^7.
2.5
"
,
"php"
:
"^7.
3.0
"
,
"ext-exif"
:
"*"
,
"ext-exif"
:
"*"
,
"ext-gd"
:
"*"
,
"ext-gd"
:
"*"
,
"facade/ignition"
:
"^2.
0
"
,
"facade/ignition"
:
"^2.
3.6
"
,
"fideloper/proxy"
:
"^4.2"
,
"fideloper/proxy"
:
"^4.2"
,
"fruitcake/laravel-cors"
:
"^2.0"
,
"fruitcake/laravel-cors"
:
"^2.0"
,
"fzaninotto/faker"
:
"^1.9.1"
,
"fzaninotto/faker"
:
"^1.9.1"
,
"guzzlehttp/guzzle"
:
"^
6.3
"
,
"guzzlehttp/guzzle"
:
"^
7.0.1
"
,
"inertiajs/inertia-laravel"
:
"^0.2"
,
"inertiajs/inertia-laravel"
:
"^0.2"
,
"laravel/framework"
:
"^7.22.2"
,
"laravel/framework"
:
"^8.0"
,
"laravel/legacy-factories"
:
"^1.0"
,
"laravel/tinker"
:
"^2.0"
,
"laravel/tinker"
:
"^2.0"
,
"laravel/ui"
:
"^2.0"
,
"laravel/ui"
:
"^2.0"
,
"league/glide"
:
"2.0.x-dev"
,
"league/glide"
:
"2.0.x-dev"
,
"mockery/mockery"
:
"^1.3.1"
,
"mockery/mockery"
:
"^1.3.1"
,
"nunomaduro/collision"
:
"^
4.1
"
,
"nunomaduro/collision"
:
"^
5.0
"
,
"phpunit/phpunit"
:
"^
8.5
"
,
"phpunit/phpunit"
:
"^
9.3
"
,
"reinink/remember-query-strings"
:
"^0.1.0"
,
"reinink/remember-query-strings"
:
"^0.1.0"
,
"tightenco/ziggy"
:
"^0.8.0"
"tightenco/ziggy"
:
"^0.8.0"
},
},
...
...
composer.lock
View file @
15b7612
This diff could not be displayed because it is too large.
config/auth.php
View file @
15b7612
...
@@ -68,7 +68,7 @@ return [
...
@@ -68,7 +68,7 @@ return [
'providers'
=>
[
'providers'
=>
[
'users'
=>
[
'users'
=>
[
'driver'
=>
'eloquent'
,
'driver'
=>
'eloquent'
,
'model'
=>
App\User
::
class
,
'model'
=>
App\
Models\
User
::
class
,
],
],
// 'users' => [
// 'users' => [
...
...
config/queue.php
View file @
15b7612
...
@@ -81,7 +81,7 @@ return [
...
@@ -81,7 +81,7 @@ return [
*/
*/
'failed'
=>
[
'failed'
=>
[
'driver'
=>
env
(
'QUEUE_FAILED_DRIVER'
,
'database'
),
'driver'
=>
env
(
'QUEUE_FAILED_DRIVER'
,
'database
-uuids
'
),
'database'
=>
env
(
'DB_CONNECTION'
,
'mysql'
),
'database'
=>
env
(
'DB_CONNECTION'
,
'mysql'
),
'table'
=>
'failed_jobs'
,
'table'
=>
'failed_jobs'
,
],
],
...
...
database/factories/ContactFactory.php
View file @
15b7612
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
use
Faker\Generator
as
Faker
;
use
Faker\Generator
as
Faker
;
$factory
->
define
(
App\Contact
::
class
,
function
(
Faker
$faker
)
{
$factory
->
define
(
App\
Models\
Contact
::
class
,
function
(
Faker
$faker
)
{
return
[
return
[
'first_name'
=>
$faker
->
firstName
,
'first_name'
=>
$faker
->
firstName
,
'last_name'
=>
$faker
->
lastName
,
'last_name'
=>
$faker
->
lastName
,
...
...
database/factories/OrganizationFactory.php
View file @
15b7612
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
use
Faker\Generator
as
Faker
;
use
Faker\Generator
as
Faker
;
$factory
->
define
(
App\Organization
::
class
,
function
(
Faker
$faker
)
{
$factory
->
define
(
App\
Models\
Organization
::
class
,
function
(
Faker
$faker
)
{
return
[
return
[
'name'
=>
$faker
->
company
,
'name'
=>
$faker
->
company
,
'email'
=>
$faker
->
companyEmail
,
'email'
=>
$faker
->
companyEmail
,
...
...
database/factories/UserFactory.php
View file @
15b7612
...
@@ -14,7 +14,7 @@ use Illuminate\Support\Str;
...
@@ -14,7 +14,7 @@ use Illuminate\Support\Str;
|
|
*/
*/
$factory
->
define
(
App\User
::
class
,
function
(
Faker
$faker
)
{
$factory
->
define
(
App\
Models\
User
::
class
,
function
(
Faker
$faker
)
{
return
[
return
[
'first_name'
=>
$faker
->
firstName
,
'first_name'
=>
$faker
->
firstName
,
'last_name'
=>
$faker
->
lastName
,
'last_name'
=>
$faker
->
lastName
,
...
...
database/seeds/DatabaseSeeder.php
View file @
15b7612
<?php
<?php
use
App\Account
;
use
App\
Models\
Account
;
use
App\Contact
;
use
App\
Models\
Contact
;
use
App\Organization
;
use
App\
Models\
Organization
;
use
App\User
;
use
App\
Models\
User
;
use
Illuminate\Database\Seeder
;
use
Illuminate\Database\Seeder
;
class
DatabaseSeeder
extends
Seeder
class
DatabaseSeeder
extends
Seeder
...
...
phpunit.xml
View file @
15b7612
...
@@ -12,15 +12,16 @@
...
@@ -12,15 +12,16 @@
<directory
suffix=
"Test.php"
>
./tests/Feature
</directory>
<directory
suffix=
"Test.php"
>
./tests/Feature
</directory>
</testsuite>
</testsuite>
</testsuites>
</testsuites>
<
filter
>
<
coverage
processUncoveredFiles=
"true"
>
<
whitelist
processUncoveredFilesFromWhitelist=
"true"
>
<
include
>
<directory
suffix=
".php"
>
./app
</directory>
<directory
suffix=
".php"
>
./app
</directory>
</
whitelist
>
</
include
>
</
filter
>
</
coverage
>
<php>
<php>
<server
name=
"APP_ENV"
value=
"testing"
/>
<server
name=
"APP_ENV"
value=
"testing"
/>
<server
name=
"BCRYPT_ROUNDS"
value=
"4"
/>
<server
name=
"BCRYPT_ROUNDS"
value=
"4"
/>
<server
name=
"CACHE_DRIVER"
value=
"array"
/>
<server
name=
"CACHE_DRIVER"
value=
"array"
/>
<server
name=
"DB_CONNECTION"
value=
"sqlite"
/>
<server
name=
"DB_DATABASE"
value=
":memory:"
/>
<server
name=
"DB_DATABASE"
value=
":memory:"
/>
<server
name=
"MAIL_MAILER"
value=
"array"
/>
<server
name=
"MAIL_MAILER"
value=
"array"
/>
<server
name=
"QUEUE_CONNECTION"
value=
"sync"
/>
<server
name=
"QUEUE_CONNECTION"
value=
"sync"
/>
...
...
routes/channels.php
View file @
15b7612
...
@@ -13,6 +13,6 @@ use Illuminate\Support\Facades\Broadcast;
...
@@ -13,6 +13,6 @@ use Illuminate\Support\Facades\Broadcast;
|
|
*/
*/
Broadcast
::
channel
(
'App.User.{id}'
,
function
(
$user
,
$id
)
{
Broadcast
::
channel
(
'App.
Models.
User.{id}'
,
function
(
$user
,
$id
)
{
return
(
int
)
$user
->
id
===
(
int
)
$id
;
return
(
int
)
$user
->
id
===
(
int
)
$id
;
});
});
routes/console.php
View file @
15b7612
...
@@ -16,4 +16,4 @@ use Illuminate\Support\Facades\Artisan;
...
@@ -16,4 +16,4 @@ use Illuminate\Support\Facades\Artisan;
Artisan
::
command
(
'inspire'
,
function
()
{
Artisan
::
command
(
'inspire'
,
function
()
{
$this
->
comment
(
Inspiring
::
quote
());
$this
->
comment
(
Inspiring
::
quote
());
})
->
describ
e
(
'Display an inspiring quote'
);
})
->
purpos
e
(
'Display an inspiring quote'
);
routes/web.php
View file @
15b7612
<?php
<?php
use
App\Http\Controllers\Auth\LoginController
;
use
App\Http\Controllers\ContactsController
;
use
App\Http\Controllers\DashboardController
;
use
App\Http\Controllers\OrganizationsController
;
use
App\Http\Controllers\ReportsController
;
use
App\Http\Controllers\UsersController
;
use
Illuminate\Support\Facades\Route
;
use
Illuminate\Support\Facades\Route
;
/*
/*
...
@@ -14,47 +20,126 @@ use Illuminate\Support\Facades\Route;
...
@@ -14,47 +20,126 @@ use Illuminate\Support\Facades\Route;
*/
*/
// Auth
// Auth
Route
::
get
(
'login'
)
->
name
(
'login'
)
->
uses
(
'Auth\LoginController@showLoginForm'
)
->
middleware
(
'guest'
);
Route
::
post
(
'login'
)
->
name
(
'login.attempt'
)
->
uses
(
'Auth\LoginController@login'
)
->
middleware
(
'guest'
);
Route
::
get
(
'login'
,
[
LoginController
::
class
,
'showLoginForm'
])
Route
::
post
(
'logout'
)
->
name
(
'logout'
)
->
uses
(
'Auth\LoginController@logout'
);
->
name
(
'login'
)
->
middleware
(
'guest'
);
Route
::
post
(
'login'
,
[
LoginController
::
class
,
'login'
])
->
name
(
'login.attempt'
)
->
middleware
(
'guest'
);
Route
::
post
(
'logout'
,
[
LoginController
::
class
,
'logout'
])
->
name
(
'logout'
);
// Dashboard
// Dashboard
Route
::
get
(
'/'
)
->
name
(
'dashboard'
)
->
uses
(
'DashboardController'
)
->
middleware
(
'auth'
);
Route
::
get
(
'/'
,
[
DashboardController
::
class
,
'index'
])
->
name
(
'dashboard'
)
->
middleware
(
'auth'
);
// Users
// Users
Route
::
get
(
'users'
)
->
name
(
'users'
)
->
uses
(
'UsersController@index'
)
->
middleware
(
'remember'
,
'auth'
);
Route
::
get
(
'users/create'
)
->
name
(
'users.create'
)
->
uses
(
'UsersController@create'
)
->
middleware
(
'auth'
);
Route
::
post
(
'users'
)
->
name
(
'users.store'
)
->
uses
(
'UsersController@store'
)
->
middleware
(
'auth'
);
Route
::
get
(
'users/{user}/edit'
)
->
name
(
'users.edit'
)
->
uses
(
'UsersController@edit'
)
->
middleware
(
'auth'
);
Route
::
put
(
'users/{user}'
)
->
name
(
'users.update'
)
->
uses
(
'UsersController@update'
)
->
middleware
(
'auth'
);
Route
::
delete
(
'users/{user}'
)
->
name
(
'users.destroy'
)
->
uses
(
'UsersController@destroy'
)
->
middleware
(
'auth'
);
Route
::
put
(
'users/{user}/restore'
)
->
name
(
'users.restore'
)
->
uses
(
'UsersController@restore'
)
->
middleware
(
'auth'
);
// Images
Route
::
get
(
'users'
,
[
UsersController
::
class
,
'index'
])
Route
::
get
(
'/img/{path}'
,
'ImagesController@show'
)
->
where
(
'path'
,
'.*'
);
->
name
(
'users'
)
->
middleware
(
'remember'
,
'auth'
);
Route
::
get
(
'users/create'
,
[
UsersController
::
class
,
'create'
])
->
name
(
'users.create'
)
->
middleware
(
'auth'
);
Route
::
post
(
'users'
,
[
UsersController
::
class
,
'store'
])
->
name
(
'users.store'
)
->
middleware
(
'auth'
);
Route
::
get
(
'users/{user}/edit'
,
[
UsersController
::
class
,
'edit'
])
->
name
(
'users.edit'
)
->
middleware
(
'auth'
);
Route
::
put
(
'users/{user}'
,
[
UsersController
::
class
,
'update'
])
->
name
(
'users.update'
)
->
middleware
(
'auth'
);
Route
::
delete
(
'users/{user}'
,
[
UsersController
::
class
,
'destroy'
])
->
name
(
'users.destroy'
)
->
middleware
(
'auth'
);
Route
::
put
(
'users/{user}/restore'
,
[
UsersController
::
class
,
'restore'
])
->
name
(
'users.restore'
)
->
middleware
(
'auth'
);
// Organizations
// Organizations
Route
::
get
(
'organizations'
)
->
name
(
'organizations'
)
->
uses
(
'OrganizationsController@index'
)
->
middleware
(
'remember'
,
'auth'
);
Route
::
get
(
'organizations/create'
)
->
name
(
'organizations.create'
)
->
uses
(
'OrganizationsController@create'
)
->
middleware
(
'auth'
);
Route
::
get
(
'organizations'
,
[
OrganizationsController
::
class
,
'index'
])
Route
::
post
(
'organizations'
)
->
name
(
'organizations.store'
)
->
uses
(
'OrganizationsController@store'
)
->
middleware
(
'auth'
);
->
name
(
'organizations'
)
Route
::
get
(
'organizations/{organization}/edit'
)
->
name
(
'organizations.edit'
)
->
uses
(
'OrganizationsController@edit'
)
->
middleware
(
'auth'
);
->
middleware
(
'remember'
,
'auth'
);
Route
::
put
(
'organizations/{organization}'
)
->
name
(
'organizations.update'
)
->
uses
(
'OrganizationsController@update'
)
->
middleware
(
'auth'
);
Route
::
delete
(
'organizations/{organization}'
)
->
name
(
'organizations.destroy'
)
->
uses
(
'OrganizationsController@destroy'
)
->
middleware
(
'auth'
);
Route
::
get
(
'organizations/create'
,
[
OrganizationsController
::
class
,
'create'
])
Route
::
put
(
'organizations/{organization}/restore'
)
->
name
(
'organizations.restore'
)
->
uses
(
'OrganizationsController@restore'
)
->
middleware
(
'auth'
);
->
name
(
'organizations.create'
)
->
middleware
(
'auth'
);
Route
::
post
(
'organizations'
,
[
OrganizationsController
::
class
,
'store'
])
->
name
(
'organizations.store'
)
->
middleware
(
'auth'
);
Route
::
get
(
'organizations/{organization}/edit'
,
[
OrganizationsController
::
class
,
'edit'
])
->
name
(
'organizations.edit'
)
->
middleware
(
'auth'
);
Route
::
put
(
'organizations/{organization}'
,
[
OrganizationsController
::
class
,
'update'
])
->
name
(
'organizations.update'
)
->
middleware
(
'auth'
);
Route
::
delete
(
'organizations/{organization}'
,
[
OrganizationsController
::
class
,
'destroy'
])
->
name
(
'organizations.destroy'
)
->
middleware
(
'auth'
);
Route
::
put
(
'organizations/{organization}/restore'
,
[
OrganizationsController
::
class
,
'restore'
])
->
name
(
'organizations.restore'
)
->
middleware
(
'auth'
);
// Contacts
// Contacts
Route
::
get
(
'contacts'
)
->
name
(
'contacts'
)
->
uses
(
'ContactsController@index'
)
->
middleware
(
'remember'
,
'auth'
);
Route
::
get
(
'contacts/create'
)
->
name
(
'contacts.create'
)
->
uses
(
'ContactsController@create'
)
->
middleware
(
'auth'
);
Route
::
get
(
'contacts'
,
[
ContactsController
::
class
,
'index'
])
Route
::
post
(
'contacts'
)
->
name
(
'contacts.store'
)
->
uses
(
'ContactsController@store'
)
->
middleware
(
'auth'
);
->
name
(
'contacts'
)
Route
::
get
(
'contacts/{contact}/edit'
)
->
name
(
'contacts.edit'
)
->
uses
(
'ContactsController@edit'
)
->
middleware
(
'auth'
);
->
middleware
(
'remember'
,
'auth'
);
Route
::
put
(
'contacts/{contact}'
)
->
name
(
'contacts.update'
)
->
uses
(
'ContactsController@update'
)
->
middleware
(
'auth'
);
Route
::
delete
(
'contacts/{contact}'
)
->
name
(
'contacts.destroy'
)
->
uses
(
'ContactsController@destroy'
)
->
middleware
(
'auth'
);
Route
::
get
(
'contacts/create'
,
[
ContactsController
::
class
,
'create'
])
Route
::
put
(
'contacts/{contact}/restore'
)
->
name
(
'contacts.restore'
)
->
uses
(
'ContactsController@restore'
)
->
middleware
(
'auth'
);
->
name
(
'contacts.create'
)
->
middleware
(
'auth'
);
Route
::
post
(
'contacts'
,
[
ContactsController
::
class
,
'store'
])
->
name
(
'contacts.store'
)
->
middleware
(
'auth'
);
Route
::
get
(
'contacts/{contact}/edit'
,
[
ContactsController
::
class
,
'edit'
])
->
name
(
'contacts.edit'
)
->
middleware
(
'auth'
);
Route
::
put
(
'contacts/{contact}'
,
[
ContactsController
::
class
,
'update'
])
->
name
(
'contacts.update'
)
->
middleware
(
'auth'
);
Route
::
delete
(
'contacts/{contact}'
,
[
ContactsController
::
class
,
'destroy'
])
->
name
(
'contacts.destroy'
)
->
middleware
(
'auth'
);
Route
::
put
(
'contacts/{contact}/restore'
,
[
ContactsController
::
class
,
'restore'
])
->
name
(
'contacts.restore'
)
->
middleware
(
'auth'
);
// Reports
// Reports
Route
::
get
(
'reports'
)
->
name
(
'reports'
)
->
uses
(
'ReportsController'
)
->
middleware
(
'auth'
);
Route
::
get
(
'reports'
,
[
ReportsController
::
class
,
'index'
])
->
name
(
'reports'
)
->
middleware
(
'auth'
);
// Images
Route
::
get
(
'/img/{path}'
,
'ImagesController@show'
)
->
where
(
'path'
,
'.*'
);
// 500 error
// 500 error
Route
::
get
(
'500'
,
function
()
{
Route
::
get
(
'500'
,
function
()
{
// Force debug mode for this endpoint in the demo environment
// Force debug mode for this endpoint in the demo environment
if
(
App
::
environment
(
'demo'
))
{
if
(
App
::
environment
(
'demo'
))
{
...
...
tests/Feature/ContactsTest.php
View file @
15b7612
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
namespace
Tests\Feature
;
namespace
Tests\Feature
;
use
App\Account
;
use
App\
Models\
Account
;
use
App\Contact
;
use
App\
Models\
Contact
;
use
App\User
;
use
App\
Models\
User
;
use
Illuminate\Foundation\Testing\RefreshDatabase
;
use
Illuminate\Foundation\Testing\RefreshDatabase
;
use
Tests\TestCase
;
use
Tests\TestCase
;
...
...
tests/Feature/OrganizationsTest.php
View file @
15b7612
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
namespace
Tests\Feature
;
namespace
Tests\Feature
;
use
App\Account
;
use
App\
Models\
Account
;
use
App\
Organization
;
use
App\
Models\User
;
use
App\
User
;
use
App\
Models\Organization
;
use
Illuminate\Foundation\Testing\RefreshDatabase
;
use
Illuminate\Foundation\Testing\RefreshDatabase
;
use
Tests\TestCase
;
use
Tests\TestCase
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment