2017-12-15 06:38:29 +08:00
|
|
|
@extends('installer::app')
|
|
|
|
@section('title', 'Database Setup')
|
|
|
|
@section('content')
|
2020-02-02 02:05:56 +08:00
|
|
|
<div style="align-content: center;">
|
2018-03-13 06:58:12 +08:00
|
|
|
{{ Form::open(['route' => 'installer.envsetup', 'method' => 'POST']) }}
|
2017-12-15 06:38:29 +08:00
|
|
|
<table class="table" width="25%">
|
2018-01-30 03:16:39 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
<tr>
|
|
|
|
<td colspan="2"><h4>Site Config</h4></td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Site Name</td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::input('text', 'site_name', 'phpvms', ['class' => 'form-control']) }}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Site URL</td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::input('text', 'site_url', Request::root(), ['class' => 'form-control']) }}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td colspan="2"><h4>Database Config</h4></td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><p>Select Database Type</p></td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::select('db_conn', $db_types, null, ['class' => 'form-control', 'id' => 'db_conn']) }}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tbody id="mysql_settings" class="settings_panel">
|
|
|
|
<tr>
|
|
|
|
<td>Database Host</td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::input('text', 'db_host', '127.0.0.1', ['class' => 'form-control']) }}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Database Port</td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::input('text', 'db_port', '3306', ['class' => 'form-control']) }}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Database Name</td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::input('text', 'db_name', 'phpvms', ['class' => 'form-control']) }}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Database User</td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::input('text', 'db_user', null, ['class' => 'form-control']) }}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Database Password</td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::input('text', 'db_pass', null, ['class' => 'form-control']) }}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" style="text-align: right;">
|
|
|
|
{{ Form::submit('Test Database Credentials', ['class' => 'btn btn-info', 'id' => 'dbtest_button']) }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
|
|
|
|
<tbody id="sqlite_settings" class="settings_panel">
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Database Prefix</td>
|
|
|
|
<td style="text-align:center;">
|
|
|
|
<div class="form-group">
|
|
|
|
{{ Form::input('text', 'db_prefix', '', ['class' => 'form-control']) }}
|
|
|
|
<p>Set this if you're sharing the database with another application.</p>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2018-01-30 03:16:39 +08:00
|
|
|
|
2017-12-15 06:38:29 +08:00
|
|
|
</table>
|
|
|
|
<div id="dbtest"></div>
|
|
|
|
<p style="text-align: right">
|
2020-02-02 02:05:56 +08:00
|
|
|
{{ Form::submit('Setup Database >>', ['class' => 'btn btn-success']) }}
|
2017-12-15 06:38:29 +08:00
|
|
|
</p>
|
2018-03-13 06:58:12 +08:00
|
|
|
{{ Form::close() }}
|
2020-02-02 02:05:56 +08:00
|
|
|
</div>
|
2017-12-15 06:38:29 +08:00
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section('scripts')
|
2020-02-02 02:05:56 +08:00
|
|
|
<script>
|
|
|
|
function changeForm(selected) {
|
|
|
|
$("tbody.settings_panel").hide();
|
|
|
|
$("tbody#" + selected + "_settings").show();
|
|
|
|
}
|
2017-12-15 06:38:29 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
$(document).ready(() => {
|
2018-03-20 22:29:45 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
const selValue = $("#db_conn option:selected").text();
|
|
|
|
changeForm(selValue);
|
2017-12-15 06:38:29 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
$("#db_conn").change((e) => {
|
2018-03-20 22:29:45 +08:00
|
|
|
const selValue = $("#db_conn option:selected").text();
|
2017-12-15 06:38:29 +08:00
|
|
|
changeForm(selValue);
|
2020-02-02 02:05:56 +08:00
|
|
|
});
|
2017-12-15 06:38:29 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
$("#dbtest_button").click((e) => {
|
2017-12-15 06:38:29 +08:00
|
|
|
e.preventDefault();
|
2018-03-20 22:29:45 +08:00
|
|
|
const opts = {
|
2020-02-02 02:05:56 +08:00
|
|
|
_token: "{{ csrf_token() }}",
|
|
|
|
db_conn: $("#db_conn option:selected").text(),
|
|
|
|
db_host: $("input[name=db_host]").val(),
|
|
|
|
db_port: $("input[name=db_port]").val(),
|
|
|
|
db_name: $("input[name=db_name]").val(),
|
|
|
|
db_user: $("input[name=db_user]").val(),
|
|
|
|
db_pass: $("input[name=db_pass]").val(),
|
2017-12-15 06:38:29 +08:00
|
|
|
};
|
|
|
|
|
2018-03-20 22:29:45 +08:00
|
|
|
$.post("{{ route('installer.dbtest') }}", opts, (data) => {
|
2020-02-02 02:05:56 +08:00
|
|
|
$("#dbtest").html(data);
|
2017-12-15 06:38:29 +08:00
|
|
|
})
|
2020-02-02 02:05:56 +08:00
|
|
|
})
|
|
|
|
});
|
|
|
|
</script>
|
2017-12-15 06:38:29 +08:00
|
|
|
@endsection
|