Skip to content

Commit 6c9eada

Browse files
committed
Laravel 12 skeleton
1 parent 9a68c9c commit 6c9eada

15 files changed

Lines changed: 120 additions & 214 deletions

File tree

app/Http/Controllers/Auth/LoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function showLoginForm()
6464
*/
6565
public function __construct()
6666
{
67-
$this->middleware('guest', ['except' => 'logout']);
67+
// Middleware is now applied via routes or method attributes
6868
}
6969

7070
/**

app/Http/Requests/StoreScript.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public function rules()
4343
'description' => 'required',
4444
"autor" => "max:255",
4545
'js_url' => "required|url|max:255|regex:/.*\.js$/",
46-
'repo_url' => "url|max:255",
47-
'photo_url' => "url|max:255|image_url",
46+
'repo_url' => "nullable|url|max:255",
47+
'photo_url' => "nullable|url|max:255|image_url",
4848
'photo_file' => 'nullable|mimes:jpeg,jpg,png,gif',
49-
'don_url' => "url|max:255",
50-
'website_url' => "url|max:255",
51-
'topic_url' => "url|max:255|regex:/^https?:\/\/www\.jeuxvideo\.com\/forums\/.*/",
49+
'don_url' => "nullable|url|max:255",
50+
'website_url' => "nullable|url|max:255",
51+
'topic_url' => "nullable|url|max:255|regex:/^https?:\/\/www\.jeuxvideo\.com\/forums\/.*/",
5252
];
5353
}
5454
}

app/Http/Requests/StoreSkin.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public function rules()
4343
'description' => 'required',
4444
"autor" => "max:255",
4545
'skin_url' => ['required', 'url', 'max:255', 'regex:/^https:\/\/userstyles\.(org|world)\/styles?\/.*/'],
46-
'repo_url' => "url|max:255",
47-
'photo_url' => "url|max:255|image_url",
48-
'photo_file' => 'nullable|mimes:jpeg,jpg,png,gif',
49-
'don_url' => "url|max:255",
50-
'website_url' => "url|max:255",
51-
'topic_url' => "url|max:255|regex:/^https?:\/\/www\.jeuxvideo\.com\/forums\/.*/",
46+
'repo_url' => "nullable|url|max:255",
47+
'photo_url' => "nullable|url|max:255|image_url",
48+
'photo_file' => 'nullable|nullable|mimes:jpeg,jpg,png,gif',
49+
'don_url' => "nullable|url|max:255",
50+
'website_url' => "nullable|url|max:255",
51+
'topic_url' => "nullable|url|max:255|regex:/^https?:\/\/www\.jeuxvideo\.com\/forums\/.*/",
5252
];
5353
}
5454
}

app/Http/Requests/UpdateScriptRequest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ public function rules()
5050
],
5151
"autor" => "max:255",
5252
'js_url' => "required|url|max:255|regex:/.*\.js$/",
53-
'repo_url' => "url|max:255",
54-
'photo_url' => "url|max:255|image_url",
53+
'repo_url' => "nullable|url|max:255",
54+
'photo_url' => "nullable|url|max:255|image_url",
5555
'photo_file' => 'nullable|mimes:jpeg,jpg,png,gif',
56-
'don_url' => "url|max:255",
56+
'don_url' => "nullable|url|max:255",
5757
'user_id' => "exists:users,id",
5858
'sensibility' => "in:0,1,2",
5959
'last_update' => "date_format:d/m/Y",
60-
'website_url' => "url|max:255",
61-
'topic_url' => "url|max:255|regex:/^https?:\/\/www\.jeuxvideo\.com\/forums\/.*/",
60+
'website_url' => "nullable|url|max:255",
61+
'topic_url' => "nullable|url|max:255|regex:/^https?:\/\/www\.jeuxvideo\.com\/forums\/.*/",
6262
];
6363
}
6464
}

app/Http/Requests/UpdateSkin.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public function rules()
5050
'not_in:ajout',
5151
],
5252
'skin_url' => ['required', 'url', 'max:255', 'regex:/^https:\/\/userstyles\.(org|world)\/styles?\/.*/'],
53-
'repo_url' => "url|max:255",
54-
'photo_url' => "url|max:255|image_url",
53+
'repo_url' => "nullable|url|max:255",
54+
'photo_url' => "nullable|url|max:255|image_url",
5555
'photo_file' => 'nullable|mimes:jpeg,jpg,png,gif',
5656
'user_id' => "exists:users,id",
57-
'don_url' => "url|max:255",
57+
'don_url' => "nullable|url|max:255",
5858
'last_update' => "date_format:d/m/Y",
59-
'website_url' => "url|max:255",
60-
'topic_url' => "url|max:255|regex:/^https?:\/\/www\.jeuxvideo\.com\/forums\/.*/",
59+
'website_url' => "nullable|url|max:255",
60+
'topic_url' => "nullable|url|max:255|regex:/^https?:\/\/www\.jeuxvideo\.com\/forums\/.*/",
6161
];
6262
}
6363
}

app/Lib/Lib.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ public function sendDiscord($content, $url)
119119
public function isImage($path)
120120
{
121121
try {
122+
if(empty($path)) {
123+
return false;
124+
}
122125
if (!is_array(getimagesize($path))) {
123126
return false;
124127
}

artisan

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,18 @@
11
#!/usr/bin/env php
22
<?php
33

4-
/*
5-
|--------------------------------------------------------------------------
6-
| Register The Auto Loader
7-
|--------------------------------------------------------------------------
8-
|
9-
| Composer provides a convenient, automatically generated class loader
10-
| for our application. We just need to utilize it! We'll require it
11-
| into the script here so that we do not have to worry about the
12-
| loading of any our classes "manually". Feels great to relax.
13-
|
14-
*/
4+
use Illuminate\Foundation\Application;
5+
use Symfony\Component\Console\Input\ArgvInput;
156

16-
require __DIR__.'/bootstrap/autoload.php';
7+
define('LARAVEL_START', microtime(true));
178

18-
$app = require_once __DIR__.'/bootstrap/app.php';
19-
20-
/*
21-
|--------------------------------------------------------------------------
22-
| Run The Artisan Application
23-
|--------------------------------------------------------------------------
24-
|
25-
| When we run the console application, the current CLI command will be
26-
| executed in this console and the response sent back to a terminal
27-
| or another output device for the developers. Here goes nothing!
28-
|
29-
*/
30-
31-
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
9+
// Register the Composer autoloader...
10+
require __DIR__.'/vendor/autoload.php';
3211

33-
$status = $kernel->handle(
34-
$input = new Symfony\Component\Console\Input\ArgvInput,
35-
new Symfony\Component\Console\Output\ConsoleOutput
36-
);
37-
38-
/*
39-
|--------------------------------------------------------------------------
40-
| Shutdown The Application
41-
|--------------------------------------------------------------------------
42-
|
43-
| Once Artisan has finished running. We will fire off the shutdown events
44-
| so that any final work may be done by the application before we shut
45-
| down the process. This is the last thing to happen to the request.
46-
|
47-
*/
12+
// Bootstrap Laravel and handle the command...
13+
/** @var Application $app */
14+
$app = require_once __DIR__.'/bootstrap/app.php';
4815

49-
$kernel->terminate($input, $status);
16+
$status = $app->handleCommand(new ArgvInput);
5017

5118
exit($status);

bootstrap/app.php

Lines changed: 16 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,18 @@
11
<?php
22

3-
/*
4-
|--------------------------------------------------------------------------
5-
| Create The Application
6-
|--------------------------------------------------------------------------
7-
|
8-
| The first thing we will do is create a new Laravel application instance
9-
| which serves as the "glue" for all the components of Laravel, and is
10-
| the IoC container for the system binding all of the various parts.
11-
|
12-
*/
13-
14-
$app = new Illuminate\Foundation\Application(
15-
realpath(__DIR__.'/../')
16-
);
17-
18-
/*
19-
|--------------------------------------------------------------------------
20-
| Bind Important Interfaces
21-
|--------------------------------------------------------------------------
22-
|
23-
| Next, we need to bind some important interfaces into the container so
24-
| we will be able to resolve them when needed. The kernels serve the
25-
| incoming requests to this application from both the web and CLI.
26-
|
27-
*/
28-
29-
$app->singleton(
30-
Illuminate\Contracts\Http\Kernel::class,
31-
App\Http\Kernel::class
32-
);
33-
34-
$app->singleton(
35-
Illuminate\Contracts\Console\Kernel::class,
36-
App\Console\Kernel::class
37-
);
38-
39-
$app->singleton(
40-
Illuminate\Contracts\Debug\ExceptionHandler::class,
41-
App\Exceptions\Handler::class
42-
);
43-
44-
/*
45-
|--------------------------------------------------------------------------
46-
| Return The Application
47-
|--------------------------------------------------------------------------
48-
|
49-
| This script returns the application instance. The instance is given to
50-
| the calling script so we can separate the building of the instances
51-
| from the actual running of the application and sending responses.
52-
|
53-
*/
54-
55-
return $app;
3+
use Illuminate\Foundation\Application;
4+
use Illuminate\Foundation\Configuration\Exceptions;
5+
use Illuminate\Foundation\Configuration\Middleware;
6+
7+
return Application::configure(basePath: dirname(__DIR__))
8+
->withRouting(
9+
web: __DIR__.'/../routes/web.php',
10+
commands: __DIR__.'/../routes/console.php',
11+
health: '/up',
12+
)
13+
->withMiddleware(function (Middleware $middleware) {
14+
//
15+
})
16+
->withExceptions(function (Exceptions $exceptions) {
17+
//
18+
})->create();

bootstrap/providers.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
App\Providers\AppServiceProvider::class,
5+
];

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
colors="true"
6+
stopOnFailure="true"
67
>
78
<testsuites>
89
<testsuite name="Feature">

0 commit comments

Comments
 (0)