bianjunhui 3 gün önce
ebeveyn
işleme
b9dcddc49f

+ 1 - 1
packages/Longyi/Wholesale/README.md

@@ -94,7 +94,7 @@ php artisan view:clear
 |------|------|------|
 | `message_id` | int unsigned PK, auto increment | 主键 |
 | `name` | varchar(200) | 姓名 |
-| `Email` | varchar(50) | 邮箱 |
+| `email` | varchar(50) | 邮箱 |
 | `number` | varchar(300) | 联系方式 |
 | `message` | varchar(600) | 留言内容 |
 | `country` | varchar(50) | 国家 |

+ 2 - 2
packages/Longyi/Wholesale/src/DataGrids/MessageDataGrid.php

@@ -34,7 +34,7 @@ class MessageDataGrid extends DataGrid
             ->select(
                 'message_id',
                 'name',
-                'Email',
+                'email',
                 'number',
                 'message',
                 'country',
@@ -69,7 +69,7 @@ class MessageDataGrid extends DataGrid
         ]);
 
         $this->addColumn([
-            'index'      => 'Email',
+            'index'      => 'email',
             'label'      => trans('wholesale::app.admin.datagrid.email'),
             'type'       => 'string',
             'filterable' => true,

+ 1 - 1
packages/Longyi/Wholesale/src/Database/Migrations/2026_10_20_000000_create_message_table.php

@@ -14,7 +14,7 @@ return new class extends Migration
         Schema::create('message', function (Blueprint $table) {
             $table->increments('message_id');
             $table->string('name', 200)->nullable();
-            $table->string('Email', 50)->nullable();
+            $table->string('email', 50)->nullable();
             $table->string('number', 300)->nullable();
             $table->string('message', 600)->nullable();
             $table->string('country', 50)->nullable();

+ 1 - 1
packages/Longyi/Wholesale/src/Http/Controllers/WholesaleController.php

@@ -94,7 +94,7 @@ class WholesaleController extends Controller
 
             $message = Message::create([
                 'name'          => $validated['name'],
-                'Email'         => $validated['email'],
+                'email'         => $validated['email'],
                 'number'        => $validated['number'] ?? null,
                 'message'       => $validated['message'] ?? null,
                 'country'       => $validated['country'] ?? null,

+ 22 - 5
packages/Longyi/Wholesale/src/Models/Message.php

@@ -37,13 +37,30 @@ class Message extends Model
     /**
      * Indicates if the model should be timestamped.
      *
-     * The `message` table only has a `created_at` column (no `updated_at`),
-     * and it is maintained by the database, so we disable Eloquent's
-     * automatic timestamps.
+     * The `message` table only has a `created_at` column (no `updated_at`).
+     * We let Eloquent manage `created_at` automatically and disable the
+     * `updated_at` timestamp via CREATED_AT / UPDATED_AT constants below.
      *
      * @var bool
      */
-    public $timestamps = false;
+    public $timestamps = true;
+
+    /**
+     * The name of the "created at" column.
+     *
+     * @var string|null
+     */
+    const CREATED_AT = 'created_at';
+
+    /**
+     * The name of the "updated at" column.
+     *
+     * The `message` table has no `updated_at` column, so set it to null to
+     * prevent Eloquent from trying to write it.
+     *
+     * @var string|null
+     */
+    const UPDATED_AT = null;
 
     /**
      * The attributes that are mass assignable.
@@ -52,7 +69,7 @@ class Message extends Model
      */
     protected $fillable = [
         'name',
-        'Email',
+        'email',
         'number',
         'message',
         'country',

+ 1 - 1
packages/Longyi/Wholesale/src/Routes/shop-routes.php

@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Route;
 use Longyi\Wholesale\Http\Controllers\WholesaleController;
 
 // 前台公开 API:提交批发询盘
-Route::group(['middleware' => ['web'], 'prefix' => 'api'], function () {
+Route::group(['middleware' => ['api'], 'prefix' => 'api'], function () {
     Route::controller(WholesaleController::class)->prefix('wholesale')->group(function () {
         Route::post('', 'store')->name('shop.api.wholesale.store');
     });