diff --git a/app/Http/Controllers/Install/Updates.php b/app/Http/Controllers/Install/Updates.php index 340ecedc8..740f25555 100644 --- a/app/Http/Controllers/Install/Updates.php +++ b/app/Http/Controllers/Install/Updates.php @@ -6,10 +6,26 @@ use App\Http\Controllers\Controller; use App\Models\Module\Module as Model; use App\Utilities\Updater; use App\Utilities\Versions; +use Illuminate\Routing\Route; use Module; class Updates extends Controller { + + /** + * Instantiate a new controller instance. + * + * @param Route $route + */ + public function __construct(Route $route) + { + if (!setting('general.api_token')) { + return redirect('modules/token/create')->send(); + } + + parent::__construct($route); + } + /** * Show the form for creating a new resource. * @@ -56,6 +72,24 @@ class Updates extends Controller return Versions::changelog(); } + /** + * Check for updates. + * + * @return Response + */ + public function check() + { + // Clear cache in order to check for updates + Updater::clear(); + + return redirect()->back(); + } + + /** + * Update the core or modules. + * + * @return Response + */ public function update($alias, $version) { set_time_limit(600); // 10 minutes diff --git a/resources/lang/en-GB/general.php b/resources/lang/en-GB/general.php index a056797c9..6759e3e2c 100644 --- a/resources/lang/en-GB/general.php +++ b/resources/lang/en-GB/general.php @@ -92,6 +92,7 @@ return [ 'help' => 'Help', 'all' => 'All', 'upcoming' => 'Upcoming', + 'created' => 'Created', 'title' => [ 'new' => 'New :type', diff --git a/resources/lang/en-GB/updates.php b/resources/lang/en-GB/updates.php index f2afb339a..bfcdd24e8 100644 --- a/resources/lang/en-GB/updates.php +++ b/resources/lang/en-GB/updates.php @@ -6,6 +6,7 @@ return [ 'latest_version' => 'Latest Version', 'update' => 'Update Akaunting to :version version', 'changelog' => 'Changelog', + 'check' => 'Check', 'new_core' => 'An updated version of Akaunting is available.', 'latest_core' => 'Congratulations! You have the latest version of Akaunting. Future security updates will be applied automatically.', diff --git a/resources/views/companies/companies/index.blade.php b/resources/views/companies/companies/index.blade.php index 3a2116e13..87023aee6 100644 --- a/resources/views/companies/companies/index.blade.php +++ b/resources/views/companies/companies/index.blade.php @@ -35,7 +35,7 @@ @sortablelink('name', trans('general.name')) @sortablelink('domain', trans('companies.domain')) @sortablelink('email', trans('general.email')) - @sortablelink('created_at', trans('general.date')) + @sortablelink('created_at', trans('general.created')) {{ trans('general.actions') }} diff --git a/resources/views/install/updates/index.blade.php b/resources/views/install/updates/index.blade.php index 8c17e1a48..60502f9fb 100644 --- a/resources/views/install/updates/index.blade.php +++ b/resources/views/install/updates/index.blade.php @@ -2,6 +2,10 @@ @section('title', trans_choice('general.updates', 2)) +@section('new_button') +  {{ trans('updates.check') }} +@endsection + @section('content')
diff --git a/routes/web.php b/routes/web.php index f79ce6fe6..40239a628 100644 --- a/routes/web.php +++ b/routes/web.php @@ -98,6 +98,7 @@ Route::group(['middleware' => ['auth', 'language', 'adminmenu', 'permission:read Route::group(['prefix' => 'install'], function () { Route::get('updates/changelog', 'Install\Updates@changelog'); + Route::get('updates/check', 'Install\Updates@check'); Route::get('updates/update/{id}/{version}', 'Install\Updates@update'); Route::resource('updates', 'Install\Updates'); });