This commit is contained in:
iVampireSP.com 2022-09-14 22:19:28 +08:00
parent b8549903f8
commit 89442913f0
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
4 changed files with 63 additions and 4 deletions

View File

@ -23,9 +23,9 @@ DB_PASSWORD=secret
MONGO_DB_HOST=127.0.0.1 MONGO_DB_HOST=127.0.0.1
MONGO_DB_PORT=27017 MONGO_DB_PORT=27017
MONGO_DB_DATABASE=homestead MONGO_DB_DATABASE=
MONGO_DB_USERNAME=homestead MONGO_DB_USERNAME=
MONGO_DB_PASSWORD=secret MONGO_DB_PASSWORD=
MONGO_DBDB_AUTHENTICATION_DATABASE=admin MONGO_DBDB_AUTHENTICATION_DATABASE=admin
LARAVELS_LISTEN_IP=127.0.0.0 LARAVELS_LISTEN_IP=127.0.0.0

View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Jenssegers\Mongodb\Eloquent\Model;
class Transaction extends Model
{
// $t = (new App\Models\Transaction)->create(['name' => 1])
protected $connection = 'mongodb';
protected $collection = 'transactions';
protected $dates = [
'created_at',
'updated_at',
'time',
'created_at'
];
protected $fillable = [
'name'
];
}

View File

@ -25,6 +25,10 @@
$app->withFacades(); $app->withFacades();
$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class);
$app->withEloquent(); $app->withEloquent();
/* /*
@ -116,7 +120,6 @@
$app->register(\Anik\Form\FormRequestServiceProvider::class); $app->register(\Anik\Form\FormRequestServiceProvider::class);
$app->register(App\Providers\RouteBindingServiceProvider::class); $app->register(App\Providers\RouteBindingServiceProvider::class);
$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class);
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -0,0 +1,31 @@
<?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::create('transactions', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transactions');
}
};