master
parent
45eddc9390
commit
8bfd67a10c
Binary file not shown.
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Forms;
|
||||||
|
|
||||||
|
use Kris\LaravelFormBuilder\Form;
|
||||||
|
use Kris\LaravelFormBuilder\Field;
|
||||||
|
|
||||||
|
class WechatpayAccountForm extends Form
|
||||||
|
{
|
||||||
|
public function buildForm()
|
||||||
|
{
|
||||||
|
$this->add("id", Field::HIDDEN);
|
||||||
|
$this->add("name", Field::TEXT, ["label" => "名称", "rules" => "required"]);
|
||||||
|
$this->add("mchid", Field::TEXT, ["label" => "商户ID", "rules" => "required"]);
|
||||||
|
$this->add("key", Field::TEXT, ["label" => "商户密钥", "rules" => "required"]);
|
||||||
|
$this->add('buttons', 'buttongroup', ["splitted" => true, "buttons" => [
|
||||||
|
["label" => "保存", "attr" => ["class" => "btn btn-primary mr-1", "type" => "submit"]],
|
||||||
|
["label" => "返回", "attr" => ["class" => "btn btn-light btn-back", "type" => "button"]]
|
||||||
|
]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: weizongsong
|
||||||
|
* Date: 2019-04-12
|
||||||
|
* Time: 22:34
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Forms\WechatpayAccountForm;
|
||||||
|
use App\Models\WechatpayAccount;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class WechatpayAccountController extends CommonController
|
||||||
|
{
|
||||||
|
public $bladePath = "admin.wechatpay-account";
|
||||||
|
public $urlPrefix = "admin/wechatpay-account";
|
||||||
|
public $modelName = "微信支付账号";
|
||||||
|
public $modelClass = WechatpayAccount::class;
|
||||||
|
public $formClass = WechatpayAccountForm::class;
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$data = $this->model->paginate(10);
|
||||||
|
return view($this->bladePath . ".index", compact("data"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
class WechatpayAccount extends SoftDeletesModel
|
||||||
|
{
|
||||||
|
protected $table = "wechatpay_account";
|
||||||
|
}
|
||||||
Binary file not shown.
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateWechatpayAccount extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('wechatpay_account', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name')->nullable();
|
||||||
|
$table->string('mchid')->nullable()->unique();
|
||||||
|
$table->string('key')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('wechatpay_account');
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,43 @@
|
|||||||
|
@extends("admin.layouts.layout")
|
||||||
|
|
||||||
|
@php
|
||||||
|
$pageTitle = __("actions.".last(explode("/",request()->url()))).$modelName;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@section("content")
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
@include("public._form")
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push("footer")
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$("#project_id").change(getLevels);
|
||||||
|
});
|
||||||
|
|
||||||
|
function getLevels() {
|
||||||
|
var project_id = $("#project_id").val();
|
||||||
|
var url = "{{ url($urlPrefix."/get-levels") }}";
|
||||||
|
$.get(url,{project_id:project_id},function(res) {
|
||||||
|
var html = "";
|
||||||
|
for (k in res) {
|
||||||
|
html += "<option value='"+ res[k].id +"'>"+ res[k].name +"</option>";
|
||||||
|
}
|
||||||
|
$("#paramedic_level_id").html(html);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function uploaderCallback(file, data, index) {
|
||||||
|
$('input[data-uploader-index=' + index + ']').val("/storage/" + (data.folder ? data.folder + "/" : "") + data.name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
@extends("admin.layouts.layout")
|
||||||
|
|
||||||
|
@section("content")
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="mb-3">
|
||||||
|
<a class="btn btn-primary" href="{{url($urlPrefix.'/create')}}">
|
||||||
|
@lang("icons.action_create") @lang('actions.create'){{$modelName}}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="table table-bordered" id="data-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{{$modelName}}
|
||||||
|
</th>
|
||||||
|
<th>商户ID</th>
|
||||||
|
<th>商户密钥</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($data as $row)
|
||||||
|
<tr data-id="{{$row->id}}">
|
||||||
|
<td>
|
||||||
|
{{ $row->name }}
|
||||||
|
</td>
|
||||||
|
<td>{{ $row->mchid }}</td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-sm btn-primary"
|
||||||
|
href="{{url("{$urlPrefix}/edit?id={$row['id']}")}}">@lang("icons.action_edit") @lang("actions.edit")</a>
|
||||||
|
<a class="btn btn-sm btn-danger btn-delete" data-id="{{$row['id']}}"
|
||||||
|
href="javascript:;">@lang("icons.action_delete") @lang("actions.delete")</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@include("public._pages")
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@include("public._delete")
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push("footer")
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
Binary file not shown.
Loading…
Reference in new issue