From 89442913f088c3f9c89180f6fc989b6e87173ebb Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Wed, 14 Sep 2022 22:19:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 6 ++-- app/Models/Transaction.php | 25 +++++++++++++++ bootstrap/app.php | 5 ++- ...09_14_215159_create_transactions_table.php | 31 +++++++++++++++++++ 4 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 app/Models/Transaction.php create mode 100644 database/migrations/2022_09_14_215159_create_transactions_table.php diff --git a/.env.example b/.env.example index 980b6a2..b449365 100644 --- a/.env.example +++ b/.env.example @@ -23,9 +23,9 @@ DB_PASSWORD=secret MONGO_DB_HOST=127.0.0.1 MONGO_DB_PORT=27017 -MONGO_DB_DATABASE=homestead -MONGO_DB_USERNAME=homestead -MONGO_DB_PASSWORD=secret +MONGO_DB_DATABASE= +MONGO_DB_USERNAME= +MONGO_DB_PASSWORD= MONGO_DBDB_AUTHENTICATION_DATABASE=admin LARAVELS_LISTEN_IP=127.0.0.0 diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php new file mode 100644 index 0000000..76aa8c6 --- /dev/null +++ b/app/Models/Transaction.php @@ -0,0 +1,25 @@ +create(['name' => 1]) + + protected $connection = 'mongodb'; + protected $collection = 'transactions'; + + protected $dates = [ + 'created_at', + 'updated_at', + 'time', + 'created_at' + ]; + + protected $fillable = [ + 'name' + ]; +} diff --git a/bootstrap/app.php b/bootstrap/app.php index a11bbe2..636fb66 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -25,6 +25,10 @@ $app->withFacades(); + +$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class); + + $app->withEloquent(); /* @@ -116,7 +120,6 @@ $app->register(\Anik\Form\FormRequestServiceProvider::class); $app->register(App\Providers\RouteBindingServiceProvider::class); -$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class); /* |-------------------------------------------------------------------------- diff --git a/database/migrations/2022_09_14_215159_create_transactions_table.php b/database/migrations/2022_09_14_215159_create_transactions_table.php new file mode 100644 index 0000000..d764945 --- /dev/null +++ b/database/migrations/2022_09_14_215159_create_transactions_table.php @@ -0,0 +1,31 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('transactions'); + } +};