Skip to content

Commit 5de34d1

Browse files
committed
Project 5
0 parents  commit 5de34d1

File tree

408 files changed

+38661
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

408 files changed

+38661
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

.env.example

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
LOG_DEPRECATIONS_CHANNEL=null
9+
LOG_LEVEL=debug
10+
11+
DB_CONNECTION=mysql
12+
DB_HOST=127.0.0.1
13+
DB_PORT=3306
14+
DB_DATABASE=laravel
15+
DB_USERNAME=root
16+
DB_PASSWORD=
17+
18+
BROADCAST_DRIVER=log
19+
CACHE_DRIVER=file
20+
FILESYSTEM_DISK=local
21+
QUEUE_CONNECTION=sync
22+
SESSION_DRIVER=file
23+
SESSION_LIFETIME=120
24+
25+
MEMCACHED_HOST=127.0.0.1
26+
27+
REDIS_HOST=127.0.0.1
28+
REDIS_PASSWORD=null
29+
REDIS_PORT=6379
30+
31+
MAIL_MAILER=smtp
32+
MAIL_HOST=mailpit
33+
MAIL_PORT=1025
34+
MAIL_USERNAME=null
35+
MAIL_PASSWORD=null
36+
MAIL_ENCRYPTION=null
37+
MAIL_FROM_ADDRESS="hello@example.com"
38+
MAIL_FROM_NAME="${APP_NAME}"
39+
40+
AWS_ACCESS_KEY_ID=
41+
AWS_SECRET_ACCESS_KEY=
42+
AWS_DEFAULT_REGION=us-east-1
43+
AWS_BUCKET=
44+
AWS_USE_PATH_STYLE_ENDPOINT=false
45+
46+
PUSHER_APP_ID=
47+
PUSHER_APP_KEY=
48+
PUSHER_APP_SECRET=
49+
PUSHER_HOST=
50+
PUSHER_PORT=443
51+
PUSHER_SCHEME=https
52+
PUSHER_APP_CLUSTER=mt1
53+
54+
VITE_APP_NAME="${APP_NAME}"
55+
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
56+
VITE_PUSHER_HOST="${PUSHER_HOST}"
57+
VITE_PUSHER_PORT="${PUSHER_PORT}"
58+
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
59+
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/.phpunit.cache
2+
/node_modules
3+
/public/build
4+
/public/hot
5+
/public/storage
6+
/storage/*.key
7+
/vendor
8+
.env
9+
.env.backup
10+
.env.production
11+
.phpunit.result.cache
12+
Homestead.json
13+
Homestead.yaml
14+
auth.json
15+
npm-debug.log
16+
yarn-error.log
17+
/.fleet
18+
/.idea
19+
/.vscode

app/Console/Kernel.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* Define the application's command schedule.
12+
*/
13+
protected function schedule(Schedule $schedule): void
14+
{
15+
// $schedule->command('inspire')->hourly();
16+
}
17+
18+
/**
19+
* Register the commands for the application.
20+
*/
21+
protected function commands(): void
22+
{
23+
$this->load(__DIR__.'/Commands');
24+
25+
require base_path('routes/console.php');
26+
}
27+
}

app/Exceptions/Handler.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* The list of the inputs that are never flashed to the session on validation exceptions.
12+
*
13+
* @var array<int, string>
14+
*/
15+
protected $dontFlash = [
16+
'current_password',
17+
'password',
18+
'password_confirmation',
19+
];
20+
21+
/**
22+
* Register the exception handling callbacks for the application.
23+
*/
24+
public function register(): void
25+
{
26+
$this->reportable(function (Throwable $e) {
27+
//
28+
});
29+
}
30+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Http\Requests\Auth\LoginRequest;
7+
use App\Providers\RouteServiceProvider;
8+
use Illuminate\Http\RedirectResponse;
9+
use Illuminate\Http\Request;
10+
use Illuminate\Support\Facades\Auth;
11+
use Illuminate\View\View;
12+
13+
class AuthenticatedSessionController extends Controller
14+
{
15+
/**
16+
* Display the login view.
17+
*/
18+
public function create(): View
19+
{
20+
return view('auth.login');
21+
}
22+
23+
/**
24+
* Handle an incoming authentication request.
25+
*/
26+
public function store(LoginRequest $request): RedirectResponse
27+
{
28+
$request->authenticate();
29+
30+
$request->session()->regenerate();
31+
32+
return redirect()->intended(RouteServiceProvider::HOME);
33+
}
34+
35+
/**
36+
* Destroy an authenticated session.
37+
*/
38+
public function destroy(Request $request): RedirectResponse
39+
{
40+
Auth::guard('web')->logout();
41+
42+
$request->session()->invalidate();
43+
44+
$request->session()->regenerateToken();
45+
46+
return redirect('/');
47+
}
48+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Http\RedirectResponse;
8+
use Illuminate\Http\Request;
9+
use Illuminate\Support\Facades\Auth;
10+
use Illuminate\Validation\ValidationException;
11+
use Illuminate\View\View;
12+
13+
class ConfirmablePasswordController extends Controller
14+
{
15+
/**
16+
* Show the confirm password view.
17+
*/
18+
public function show(): View
19+
{
20+
return view('auth.confirm-password');
21+
}
22+
23+
/**
24+
* Confirm the user's password.
25+
*/
26+
public function store(Request $request): RedirectResponse
27+
{
28+
if (! Auth::guard('web')->validate([
29+
'email' => $request->user()->email,
30+
'password' => $request->password,
31+
])) {
32+
throw ValidationException::withMessages([
33+
'password' => __('auth.password'),
34+
]);
35+
}
36+
37+
$request->session()->put('auth.password_confirmed_at', time());
38+
39+
return redirect()->intended(RouteServiceProvider::HOME);
40+
}
41+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Http\RedirectResponse;
8+
use Illuminate\Http\Request;
9+
10+
class EmailVerificationNotificationController extends Controller
11+
{
12+
/**
13+
* Send a new email verification notification.
14+
*/
15+
public function store(Request $request): RedirectResponse
16+
{
17+
if ($request->user()->hasVerifiedEmail()) {
18+
return redirect()->intended(RouteServiceProvider::HOME);
19+
}
20+
21+
$request->user()->sendEmailVerificationNotification();
22+
23+
return back()->with('status', 'verification-link-sent');
24+
}
25+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Http\RedirectResponse;
8+
use Illuminate\Http\Request;
9+
use Illuminate\View\View;
10+
11+
class EmailVerificationPromptController extends Controller
12+
{
13+
/**
14+
* Display the email verification prompt.
15+
*/
16+
public function __invoke(Request $request): RedirectResponse|View
17+
{
18+
return $request->user()->hasVerifiedEmail()
19+
? redirect()->intended(RouteServiceProvider::HOME)
20+
: view('auth.verify-email');
21+
}
22+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Auth\Events\PasswordReset;
7+
use Illuminate\Http\RedirectResponse;
8+
use Illuminate\Http\Request;
9+
use Illuminate\Support\Facades\Hash;
10+
use Illuminate\Support\Facades\Password;
11+
use Illuminate\Support\Str;
12+
use Illuminate\Validation\Rules;
13+
use Illuminate\View\View;
14+
15+
class NewPasswordController extends Controller
16+
{
17+
/**
18+
* Display the password reset view.
19+
*/
20+
public function create(Request $request): View
21+
{
22+
return view('auth.reset-password', ['request' => $request]);
23+
}
24+
25+
/**
26+
* Handle an incoming new password request.
27+
*
28+
* @throws \Illuminate\Validation\ValidationException
29+
*/
30+
public function store(Request $request): RedirectResponse
31+
{
32+
$request->validate([
33+
'token' => ['required'],
34+
'email' => ['required', 'email'],
35+
'password' => ['required', 'confirmed', Rules\Password::defaults()],
36+
]);
37+
38+
// Here we will attempt to reset the user's password. If it is successful we
39+
// will update the password on an actual user model and persist it to the
40+
// database. Otherwise we will parse the error and return the response.
41+
$status = Password::reset(
42+
$request->only('email', 'password', 'password_confirmation', 'token'),
43+
function ($user) use ($request) {
44+
$user->forceFill([
45+
'password' => Hash::make($request->password),
46+
'remember_token' => Str::random(60),
47+
])->save();
48+
49+
event(new PasswordReset($user));
50+
}
51+
);
52+
53+
// If the password was successfully reset, we will redirect the user back to
54+
// the application's home authenticated view. If there is an error we can
55+
// redirect them back to where they came from with their error message.
56+
return $status == Password::PASSWORD_RESET
57+
? redirect()->route('login')->with('status', __($status))
58+
: back()->withInput($request->only('email'))
59+
->withErrors(['email' => __($status)]);
60+
}
61+
}

0 commit comments

Comments
 (0)