mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-01 18:10:06 +00:00
Helper for help text.
This commit is contained in:
@@ -144,12 +144,46 @@ class HomeController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function routes()
|
public function routes()
|
||||||
{
|
{
|
||||||
$ignore = [];
|
// these routes are not relevant for the help pages:
|
||||||
|
$ignore = [
|
||||||
|
'logout', 'register', 'bills.rescan', 'attachments.download', 'attachments.preview',
|
||||||
|
'budgets.income', 'csv.download-config', 'currency.default', 'export.status', 'export.download',
|
||||||
|
'json.', 'help.', 'piggy-banks.addMoney', 'piggy-banks.removeMoney', 'rules.rule.up', 'rules.rule.down',
|
||||||
|
'rules.rule-group.up', 'rules.rule-group.down', 'debugbar',
|
||||||
|
];
|
||||||
$routes = Route::getRoutes();
|
$routes = Route::getRoutes();
|
||||||
|
/** @var \Illuminate\Routing\Route $route */
|
||||||
foreach ($routes as $route) {
|
foreach ($routes as $route) {
|
||||||
var_dump($route);
|
|
||||||
exit;
|
$name = $route->getName();
|
||||||
|
$methods = $route->getMethods();
|
||||||
|
|
||||||
|
if (!is_null($name) && in_array('GET', $methods) && !$this->startsWithAny($ignore, $name)) {
|
||||||
|
foreach (array_keys(Config::get('firefly.languages')) as $lang) {
|
||||||
|
echo 'touch ' . $lang . '/' . $name . '.md<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '<hr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $array
|
||||||
|
* @param string $needle
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function startsWithAny(array $array, string $needle): bool
|
||||||
|
{
|
||||||
|
foreach ($array as $entry) {
|
||||||
|
if ((substr($needle, 0, strlen($entry)) === $entry)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -39,8 +39,8 @@ Route::group(
|
|||||||
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);
|
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);
|
||||||
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
|
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
|
||||||
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
|
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
|
||||||
Route::get('/flush', ['uses' => 'HomeController@flush', 'as' => 'flush']);
|
Route::get('/flush', ['uses' => 'HomeController@flush']);
|
||||||
Route::get('/routes', ['uses' => 'HomeController@routes', 'as' => 'routes']);
|
Route::get('/routes', ['uses' => 'HomeController@routes']);
|
||||||
/**
|
/**
|
||||||
* Account Controller
|
* Account Controller
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user