Skip to content
This repository has been archived by the owner on Jan 11, 2020. It is now read-only.

Commit

Permalink
Try to avoid using site url which ends with index.php #101
Browse files Browse the repository at this point in the history
  • Loading branch information
prinsss committed Nov 7, 2017
1 parent 788a30a commit 0f065ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@ public function options()
$form->text('site_url')
->hint()
->format(function ($url) {
if (ends_with($url, '/'))
if (ends_with($url, '/')) {
$url = substr($url, 0, -1);
}

if (ends_with($url, '/index.php')) {
$url = substr($url, 0, -10);
}

return $url;
});

Expand Down
11 changes: 9 additions & 2 deletions app/Http/Controllers/SetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ public function finish(Request $request)
Log::info("[SetupWizard] Tables migrated.");

Option::set('site_name', $request->input('site_name'));
Option::set('site_url', url('/'));

$siteUrl = url('/');

if (ends_with($siteUrl, '/index.php')) {
$siteUrl = substr($siteUrl, 0, -10);
}

Option::set('site_url', $siteUrl);

// register super admin
$user = User::register(
Expand Down Expand Up @@ -137,7 +144,7 @@ public function doUpdate()
Artisan::call('view:clear');
} catch (\Exception $e) {
Log::error('Error occured when processing view:clear', $e);

File::cleanDirectory(storage_path('framework/views'));
}

Expand Down

0 comments on commit 0f065ef

Please sign in to comment.