Skip to content
This repository has been archived by the owner. It is now read-only.

Commit a4f6106

Browse files
committed
常用的功能模块处理
1 parent d1e7eeb commit a4f6106

File tree

7 files changed

+223
-2
lines changed

7 files changed

+223
-2
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
namespace App\Admin\Controllers;
4+
5+
use App\Models\CounponCode;
6+
use Nicelizhi\Admin\Controllers\AdminController;
7+
use Nicelizhi\Admin\Form;
8+
use Nicelizhi\Admin\Grid;
9+
use Nicelizhi\Admin\Show;
10+
11+
class CounponCodeController extends AdminController
12+
{
13+
/**
14+
* Title for current resource.
15+
*
16+
* @var string
17+
*/
18+
protected $title = 'CounponCode';
19+
20+
/**
21+
* Make a grid builder.
22+
*
23+
* @return Grid
24+
*/
25+
protected function grid()
26+
{
27+
$grid = new Grid(new CounponCode());
28+
29+
30+
31+
return $grid;
32+
}
33+
34+
/**
35+
* Make a show builder.
36+
*
37+
* @param mixed $id
38+
* @return Show
39+
*/
40+
protected function detail($id)
41+
{
42+
$show = new Show(CounponCode::findOrFail($id));
43+
44+
45+
46+
return $show;
47+
}
48+
49+
/**
50+
* Make a form builder.
51+
*
52+
* @return Form
53+
*/
54+
protected function form()
55+
{
56+
$form = new Form(new CounponCode());
57+
58+
59+
60+
return $form;
61+
}
62+
}

app/Admin/Controllers/PackageController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function form()
7979
$form->text('description', __('Description'));
8080
$form->date('start_at', __('Start at'))->default(date('Y-m-d'));
8181
$form->date('end_at', __('End at'))->default(date('Y-m-d'));
82-
$form->decimal('price', __('Price'));
82+
$form->currency('price', __('Price'))->symbol('$');
8383
$form->text('status', __('Status'));
8484
$form->text('owner', __('Owner'));
8585
$form->text('rules', __('Rules'));
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
namespace App\Admin\Controllers;
4+
5+
use App\Models\UsersDomain;
6+
use Nicelizhi\Admin\Controllers\AdminController;
7+
use Nicelizhi\Admin\Form;
8+
use Nicelizhi\Admin\Grid;
9+
use Nicelizhi\Admin\Show;
10+
11+
class UserDomainController extends AdminController
12+
{
13+
/**
14+
* Title for current resource.
15+
*
16+
* @var string
17+
*/
18+
protected $title = 'UsersDomain';
19+
20+
/**
21+
* Make a grid builder.
22+
*
23+
* @return Grid
24+
*/
25+
protected function grid()
26+
{
27+
$grid = new Grid(new UsersDomain());
28+
29+
$grid->column('id', __('Id'));
30+
$grid->column('domain', __('Domain'));
31+
$grid->column('user_id', __('User id'));
32+
$grid->column('created_at', __('Created at'));
33+
$grid->column('updated_at', __('Updated at'));
34+
35+
return $grid;
36+
}
37+
38+
/**
39+
* Make a show builder.
40+
*
41+
* @param mixed $id
42+
* @return Show
43+
*/
44+
protected function detail($id)
45+
{
46+
$show = new Show(UsersDomain::findOrFail($id));
47+
48+
$show->field('id', __('Id'));
49+
$show->field('domain', __('Domain'));
50+
$show->field('user_id', __('User id'));
51+
$show->field('created_at', __('Created at'));
52+
$show->field('updated_at', __('Updated at'));
53+
54+
return $show;
55+
}
56+
57+
/**
58+
* Make a form builder.
59+
*
60+
* @return Form
61+
*/
62+
protected function form()
63+
{
64+
$form = new Form(new UsersDomain());
65+
66+
$form->text('domain', __('Domain'));
67+
$form->number('user_id', __('User id'));
68+
69+
return $form;
70+
}
71+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
namespace App\Admin\Controllers;
4+
5+
use App\Models\UsersDomainRecord;
6+
use Nicelizhi\Admin\Controllers\AdminController;
7+
use Nicelizhi\Admin\Form;
8+
use Nicelizhi\Admin\Grid;
9+
use Nicelizhi\Admin\Show;
10+
11+
class UserDomainRecordController extends AdminController
12+
{
13+
/**
14+
* Title for current resource.
15+
*
16+
* @var string
17+
*/
18+
protected $title = 'UsersDomainRecord';
19+
20+
/**
21+
* Make a grid builder.
22+
*
23+
* @return Grid
24+
*/
25+
protected function grid()
26+
{
27+
$grid = new Grid(new UsersDomainRecord());
28+
29+
30+
31+
return $grid;
32+
}
33+
34+
/**
35+
* Make a show builder.
36+
*
37+
* @param mixed $id
38+
* @return Show
39+
*/
40+
protected function detail($id)
41+
{
42+
$show = new Show(UsersDomainRecord::findOrFail($id));
43+
44+
45+
46+
return $show;
47+
}
48+
49+
/**
50+
* Make a form builder.
51+
*
52+
* @return Form
53+
*/
54+
protected function form()
55+
{
56+
$form = new Form(new UsersDomainRecord());
57+
58+
59+
60+
return $form;
61+
}
62+
}

app/Admin/routes.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616
$router->resource('packages', PackageController::class);
1717

1818
$router->resource('counpons', CounponController::class);
19-
19+
$router->resource('counpon-codes', CounponCodeController::class);
2020
$router->resource('user-counpons', UserCounponController::class);
2121

2222
$router->resource('user-orders', UserOrderController::class);
2323

2424
$router->resource('user-packages', UserPackageController::class);
2525

26+
$router->resource('users-domains', UserDomainController::class);
27+
28+
$router->resource('users-domain-records', UserDomainRecordController::class);
29+
2630
});

app/Models/UsersDomain.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class UsersDomain extends Model
9+
{
10+
use HasFactory;
11+
}

app/Models/UsersDomainRecord.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class UsersDomainRecord extends Model
9+
{
10+
use HasFactory;
11+
}

0 commit comments

Comments
 (0)