Skip to content

Commit 2cefda5

Browse files
committed
Add HomeController and version retrieval to welcome view
1 parent 8665320 commit 2cefda5

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

app/Helpers/Helper.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@
3232
use Illuminate\Support\Facades\Auth;
3333
use Illuminate\Support\Facades\Cache;
3434
use Illuminate\Support\Facades\DB;
35+
use Illuminate\Support\Facades\File;
3536
use Illuminate\Support\Facades\Http;
3637
use Illuminate\Support\Facades\Storage;
3738
use Illuminate\Support\Number;
3839
use Illuminate\Support\Str;
3940
use OpenSpout\Reader\XLSX\Reader;
4041

42+
use function Illuminate\Filesystem\join_paths;
43+
4144
class Helper
4245
{
4346
public static $jenis_belanja = [
@@ -1767,4 +1770,18 @@ public static function sendReminder($reminder, $method = 'auto')
17671770
$reminder->message_id = $response['data']['id'][0];
17681771
$reminder->save();
17691772
}
1773+
1774+
/**
1775+
* Get the current Simpede version.
1776+
*/
1777+
public static function version(): string
1778+
{
1779+
return once(function () {
1780+
$manifest = File::json((string) realpath(join_paths(__DIR__, '../..', 'composer.json')));
1781+
1782+
$version = $manifest['version'] ?? '2.x';
1783+
1784+
return $version;
1785+
});
1786+
}
17701787
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use App\Helpers\Helper; // Ensure this class exists and is correctly imported
6+
7+
class HomeController extends Controller
8+
{
9+
public function show()
10+
{
11+
return view('welcome', [
12+
'version' => Helper::version(),
13+
]);
14+
}
15+
}

resources/views/welcome.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@
325325
</div>
326326
<div class="footer">
327327
<p>
328-
Simpede - v 2.2.0
328+
Simpede - {{ $version }}
329329
</p>
330330
<p>
331331
Copyright &copy; 2021 -

routes/web.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
use Laravel\Nova\Http\Middleware\Authenticate;
66
use Laravel\Nova\Nova;
77

8-
Route::get('/', function () {
9-
return view('welcome');
10-
})->name('welcome');
8+
Route::get('/', 'App\Http\Controllers\HomeController@show')->name('welcome');
119

1210
Route::get('/dump-download/{filename}', 'App\Http\Controllers\DumpDownloadController@show')
1311
->name('dump-download')

0 commit comments

Comments
 (0)