File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 8
8
9
9
/**
10
10
* TODO observer
11
+ *
11
12
* @see RedirectObserver for clearing the cache.
12
13
*/
13
14
class Redirect extends Model
@@ -21,19 +22,20 @@ class Redirect extends Model
21
22
/**
22
23
* Returns a list of old and new urls with the status code if set compatible with spatie/laravel-missing-page-redirector,
23
24
* that merges the redirects set in the database over the redirects set in the config.
24
- * @return array
25
25
*/
26
- public static function getDirectionMap (): array {
26
+ public static function getDirectionMap (): array
27
+ {
27
28
// Get from the database and remember forever
28
29
// we clear this on new model or updated model
29
30
$ dbRedirects = Cache::rememberForever (static ::CACHE_REDIRECTS_KEY , function () {
30
31
return Redirect::all ()->flatMap (function (Redirect $ redirect ) {
31
- if ($ redirect ->status_code ){
32
+ if ($ redirect ->status_code ) {
32
33
return [
33
- $ redirect ->old_url => [$ redirect ->new_url , $ redirect ->status_code ]
34
+ $ redirect ->old_url => [$ redirect ->new_url , $ redirect ->status_code ],
34
35
];
36
+ } else {
37
+ return [$ redirect ->old_url => $ redirect ->new_url ];
35
38
}
36
- else return [$ redirect ->old_url => $ redirect ->new_url ];
37
39
})->toArray ();
38
40
});
39
41
You can’t perform that action at this time.
0 commit comments