Skip to content

Commit 2003a48

Browse files
authored
Development (#2)
* Install Laravel Homestead * Make basic URL shortener * Display app name on welcome page * Add GitHub link to welcome page * Throttle link shortening * Add ability to set custom alias for shortened URL * Enable link seeder For some reason it was not included in f63bc00. * Add ability to set link expiration date * Add custom alias generation to Link factory * Remove duplicate middleware * Set PHP version constraint to ^7.4 * Refactor LinkFactory * Add date range to expired_at field in LinkFactory * Refactor LinkController@show * Refactor LinkController@show * Fix the previous commit Forgot to commit the using. * Fix hash uniqueness * Clean up * Add frontend * Refactor LinkController@store validation * Fix LinkController@store phpDoc * Fix typo in a comment * Update Laravel * Add missing trailing commas and semicolons * Add validation * Clean up
1 parent 8c66e85 commit 2003a48

File tree

147 files changed

+9746
-12589
lines changed

Some content is hidden

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

147 files changed

+9746
-12589
lines changed

.editorconfig

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ root = true
33
[*]
44
charset = utf-8
55
end_of_line = lf
6-
insert_final_newline = true
7-
indent_style = space
86
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
99
trim_trailing_whitespace = true
1010

1111
[*.md]
1212
trim_trailing_whitespace = false
1313

1414
[*.{yml,yaml}]
1515
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

.env.example

+18-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ APP_DEBUG=true
55
APP_URL=http://localhost
66

77
LOG_CHANNEL=stack
8+
LOG_DEPRECATIONS_CHANNEL=null
9+
LOG_LEVEL=debug
810

911
DB_CONNECTION=mysql
1012
DB_HOST=127.0.0.1
@@ -15,32 +17,43 @@ DB_PASSWORD=
1517

1618
BROADCAST_DRIVER=log
1719
CACHE_DRIVER=file
20+
FILESYSTEM_DISK=local
1821
QUEUE_CONNECTION=sync
1922
SESSION_DRIVER=file
2023
SESSION_LIFETIME=120
2124

25+
MEMCACHED_HOST=127.0.0.1
26+
2227
REDIS_HOST=127.0.0.1
2328
REDIS_PASSWORD=null
2429
REDIS_PORT=6379
2530

2631
MAIL_MAILER=smtp
27-
MAIL_HOST=smtp.mailtrap.io
28-
MAIL_PORT=2525
32+
MAIL_HOST=mailpit
33+
MAIL_PORT=1025
2934
MAIL_USERNAME=null
3035
MAIL_PASSWORD=null
3136
MAIL_ENCRYPTION=null
32-
MAIL_FROM_ADDRESS=null
37+
MAIL_FROM_ADDRESS="[email protected]"
3338
MAIL_FROM_NAME="${APP_NAME}"
3439

3540
AWS_ACCESS_KEY_ID=
3641
AWS_SECRET_ACCESS_KEY=
3742
AWS_DEFAULT_REGION=us-east-1
3843
AWS_BUCKET=
44+
AWS_USE_PATH_STYLE_ENDPOINT=false
3945

4046
PUSHER_APP_ID=
4147
PUSHER_APP_KEY=
4248
PUSHER_APP_SECRET=
49+
PUSHER_HOST=
50+
PUSHER_PORT=443
51+
PUSHER_SCHEME=https
4352
PUSHER_APP_CLUSTER=mt1
4453

45-
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
46-
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
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}"

.gitattributes

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
* text=auto
2-
*.css linguist-vendored
3-
*.scss linguist-vendored
4-
*.js linguist-vendored
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
510
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
/.phpunit.cache
2+
/bootstrap/ssr
13
/node_modules
4+
/public/build
25
/public/hot
36
/public/storage
47
/storage/*.key
58
/vendor
69
.env
710
.env.backup
11+
.env.production
812
.phpunit.result.cache
913
Homestead.json
1014
Homestead.yaml
15+
auth.json
1116
npm-debug.log
1217
yarn-error.log
18+
/.fleet
19+
/.idea
20+
/.vscode

README.md

+17-36
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<p align="center"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></p>
1+
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
22

33
<p align="center">
4-
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
5-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
6-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
7-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
4+
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
5+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
6+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
7+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
88
</p>
99

1010
## About Laravel
@@ -25,48 +25,29 @@ Laravel is accessible, powerful, and provides tools required for large, robust a
2525

2626
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
2727

28-
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
28+
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
29+
30+
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
2931

3032
## Laravel Sponsors
3133

32-
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
34+
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
3335

3436
### Premium Partners
3537

3638
- **[Vehikl](https://vehikl.com/)**
3739
- **[Tighten Co.](https://tighten.co)**
40+
- **[WebReinvent](https://webreinvent.com/)**
3841
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
3942
- **[64 Robots](https://64robots.com)**
40-
- **[Cubet Techno Labs](https://cubettech.com)**
43+
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
4144
- **[Cyber-Duck](https://cyber-duck.co.uk)**
42-
- **[Many](https://www.many.co.uk)**
43-
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
44-
- **[DevSquad](https://devsquad.com)**
45-
46-
### Community Sponsors
47-
48-
<a href="https://op.gg"><img src="http://opgg-static.akamaized.net/icon/t.rectangle.png" width="150"></a>
49-
50-
- [UserInsights](https://userinsights.com)
51-
- [Fragrantica](https://www.fragrantica.com)
52-
- [SOFTonSOFA](https://softonsofa.com/)
53-
- [User10](https://user10.com)
54-
- [Soumettre.fr](https://soumettre.fr/)
55-
- [CodeBrisk](https://codebrisk.com)
56-
- [1Forge](https://1forge.com)
57-
- [TECPRESSO](https://tecpresso.co.jp/)
58-
- [Runtime Converter](http://runtimeconverter.com/)
59-
- [WebL'Agence](https://weblagence.com/)
60-
- [Invoice Ninja](https://www.invoiceninja.com)
61-
- [iMi digital](https://www.imi-digital.de/)
62-
- [Earthlink](https://www.earthlink.ro/)
63-
- [Steadfast Collective](https://steadfastcollective.com/)
64-
- [We Are The Robots Inc.](https://watr.mx/)
65-
- [Understand.io](https://www.understand.io/)
66-
- [Abdel Elrafa](https://abdelelrafa.com)
67-
- [Hyper Host](https://hyper.host)
68-
- [Appoly](https://www.appoly.co.uk)
69-
- [云软科技](http://www.yunruan.ltd/)
45+
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
46+
- **[Jump24](https://jump24.co.uk)**
47+
- **[Redberry](https://redberry.international/laravel/)**
48+
- **[Active Logic](https://activelogic.com)**
49+
- **[byte5](https://byte5.de)**
50+
- **[OP.GG](https://op.gg)**
7051

7152
## Contributing
7253

app/Console/Kernel.php

+2-16
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,18 @@
77

88
class Kernel extends ConsoleKernel
99
{
10-
/**
11-
* The Artisan commands provided by your application.
12-
*
13-
* @var array
14-
*/
15-
protected $commands = [
16-
//
17-
];
18-
1910
/**
2011
* Define the application's command schedule.
21-
*
22-
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23-
* @return void
2412
*/
25-
protected function schedule(Schedule $schedule)
13+
protected function schedule(Schedule $schedule): void
2614
{
2715
// $schedule->command('inspire')->hourly();
2816
}
2917

3018
/**
3119
* Register the commands for the application.
32-
*
33-
* @return void
3420
*/
35-
protected function commands()
21+
protected function commands(): void
3622
{
3723
$this->load(__DIR__.'/Commands');
3824

app/Exceptions/Handler.php

+8-33
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,23 @@
88
class Handler extends ExceptionHandler
99
{
1010
/**
11-
* A list of the exception types that are not reported.
11+
* The list of the inputs that are never flashed to the session on validation exceptions.
1212
*
13-
* @var array
14-
*/
15-
protected $dontReport = [
16-
//
17-
];
18-
19-
/**
20-
* A list of the inputs that are never flashed for validation exceptions.
21-
*
22-
* @var array
13+
* @var array<int, string>
2314
*/
2415
protected $dontFlash = [
16+
'current_password',
2517
'password',
2618
'password_confirmation',
2719
];
2820

2921
/**
30-
* Report or log an exception.
31-
*
32-
* @param \Throwable $exception
33-
* @return void
34-
*
35-
* @throws \Exception
36-
*/
37-
public function report(Throwable $exception)
38-
{
39-
parent::report($exception);
40-
}
41-
42-
/**
43-
* Render an exception into an HTTP response.
44-
*
45-
* @param \Illuminate\Http\Request $request
46-
* @param \Throwable $exception
47-
* @return \Symfony\Component\HttpFoundation\Response
48-
*
49-
* @throws \Throwable
22+
* Register the exception handling callbacks for the application.
5023
*/
51-
public function render($request, Throwable $exception)
24+
public function register(): void
5225
{
53-
return parent::render($request, $exception);
26+
$this->reportable(function (Throwable $e) {
27+
//
28+
});
5429
}
5530
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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\Support\Facades\Route;
12+
use Inertia\Inertia;
13+
use Inertia\Response;
14+
15+
class AuthenticatedSessionController extends Controller
16+
{
17+
/**
18+
* Display the login view.
19+
*/
20+
public function create(): Response
21+
{
22+
return Inertia::render('Auth/Login', [
23+
'canResetPassword' => Route::has('password.request'),
24+
'status' => session('status'),
25+
]);
26+
}
27+
28+
/**
29+
* Handle an incoming authentication request.
30+
*/
31+
public function store(LoginRequest $request): RedirectResponse
32+
{
33+
$request->authenticate();
34+
35+
$request->session()->regenerate();
36+
37+
return redirect()->intended(RouteServiceProvider::HOME);
38+
}
39+
40+
/**
41+
* Destroy an authenticated session.
42+
*/
43+
public function destroy(Request $request): RedirectResponse
44+
{
45+
Auth::guard('web')->logout();
46+
47+
$request->session()->invalidate();
48+
49+
$request->session()->regenerateToken();
50+
51+
return redirect('/');
52+
}
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 Inertia\Inertia;
12+
use Inertia\Response;
13+
14+
class ConfirmablePasswordController extends Controller
15+
{
16+
/**
17+
* Show the confirm password view.
18+
*/
19+
public function show(): Response
20+
{
21+
return Inertia::render('Auth/ConfirmPassword');
22+
}
23+
24+
/**
25+
* Confirm the user's password.
26+
*/
27+
public function store(Request $request): RedirectResponse
28+
{
29+
if (! Auth::guard('web')->validate([
30+
'email' => $request->user()->email,
31+
'password' => $request->password,
32+
])) {
33+
throw ValidationException::withMessages([
34+
'password' => __('auth.password'),
35+
]);
36+
}
37+
38+
$request->session()->put('auth.password_confirmed_at', time());
39+
40+
return redirect()->intended(RouteServiceProvider::HOME);
41+
}
42+
}

0 commit comments

Comments
 (0)