Compare commits
2 Commits
05537c035f
...
135218ff54
| Author | SHA1 | Date |
|---|---|---|
|
|
135218ff54 | |
|
|
39d50c3acc |
10
README.md
10
README.md
|
|
@ -1,3 +1,13 @@
|
|||
# lcly-data-admin
|
||||
|
||||
隆昌农业大数据
|
||||
|
||||
php artisan k:g
|
||||
|
||||
php artisan admin:install
|
||||
|
||||
php artisan db:seed AdminSeeder
|
||||
php artisan db:seed PermissionSeeder
|
||||
php artisan db:seed AgriculturalBaseSeeder
|
||||
php artisan db:seed CropSeeder
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class AgriculturalBaseRequest extends FormRequest
|
|||
'address_lat' => 'nullable|regex:/^\d+(\.\d{1,10})?$/',
|
||||
'address_lng' => 'nullable|regex:/^\d+(\.\d{1,10})?$/',
|
||||
'parent_id' => 'required_if:type,1|integer|min:0',
|
||||
'sort' => 'nullable|integer|min:0',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class AgriculturalBase extends Model
|
|||
'name', 'person', 'address', 'address_lat', 'address_lng',
|
||||
'description', 'map', 'areas', 'workforce',
|
||||
'parent_id', 'cultivated',
|
||||
'sort',
|
||||
];
|
||||
|
||||
public function parent(){
|
||||
|
|
@ -38,7 +39,7 @@ class AgriculturalBase extends Model
|
|||
|
||||
public function scopeSort($q)
|
||||
{
|
||||
return $q->orderBy('created_at', 'desc');
|
||||
return $q->orderBy('sort', 'desc')->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
public function crops()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('agricultural_bases', function (Blueprint $table) {
|
||||
//
|
||||
$table->unsignedInteger('sort')->default(0)->comment('排序');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('agricultural_bases', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn(['sort']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -143,6 +143,13 @@ class CropSeeder extends Seeder
|
|||
['name'=>'不知火','category_id' => 2, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'耙耙柑','category_id' => 2, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'爱媛','category_id' => 2, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'稻虾','category_id' => 3, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'生猪','category_id' => 4, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'水稻','category_id' => 2, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'活草鱼','category_id' => 3, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'鲈鱼','category_id' => 3, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'乌鱼','category_id' => 3, 'crop_type' => 1, 'unit' => '吨'],
|
||||
['name'=>'鱼类','category_id' => 3, 'crop_type' => 1, 'unit' => '吨'],
|
||||
];
|
||||
DB::table('crops')->truncate();
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue