Skip to content

Commit a21fc65

Browse files
committed
fix spacing
1 parent eae3ba2 commit a21fc65

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

docs/quick-start/backend-service-tutorial.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,16 @@ Steps
188188

189189
use MongoDB\Laravel\Eloquent\Model;
190190

191-
class CustomerMongoDB extends Model
192-
{
191+
class CustomerMongoDB extends Model
192+
{
193193
// the selected database as defined in /config/database.php
194-
protected $connection = 'mongodb';
194+
protected $connection = 'mongodb';
195195

196196
// equivalent to $table for MySQL
197-
protected $collection = 'laracoll';
197+
protected $collection = 'laracoll';
198198

199199
// defines the schema for top-level properties (optional).
200-
protected $fillable = ['guid', 'first_name', 'family_name', 'email', 'address'];
200+
protected $fillable = ['guid', 'first_name', 'family_name', 'email', 'address'];
201201
}
202202

203203
.. step:: Perform CRUD operations.
@@ -208,12 +208,12 @@ Steps
208208

209209
.. code-block:: php
210210

211-
Route::get('/create_eloquent_mongo/', function (Request $request) {
211+
Route::get('/create_eloquent_mongo/', function (Request $request) {
212212
$success = CustomerMongoDB::create([
213213
'guid'=> 'cust_1111',
214214
'first_name'=> 'John',
215215
'family_name' => 'Doe',
216-
'email' => '[email protected]',
216+
'email' => '[email protected]',
217217
'address' => '123 my street, my city, zip, state, country'
218218
]);
219219
});
@@ -223,7 +223,7 @@ Steps
223223

224224
.. code-block:: php
225225

226-
Route::get('/find_eloquent/', function (Request $request) {
226+
Route::get('/find_eloquent/', function (Request $request) {
227227
$customer = CustomerMongoDB::where('guid', 'cust_1111')->get();
228228
});
229229

@@ -234,11 +234,11 @@ Steps
234234

235235
.. code-block:: php
236236

237-
Route::get('/update_eloquent/', function (Request $request) {
237+
Route::get('/update_eloquent/', function (Request $request) {
238238
$result = CustomerMongoDB::where('guid', 'cust_1111')->update( ['first_name' => 'Jimmy'] );
239239
});
240240

241-
Route::get('/delete_eloquent/', function (Request $request) {
241+
Route::get('/delete_eloquent/', function (Request $request) {
242242
$result = CustomerMongoDB::where('guid', 'cust_1111')->delete();
243243
});
244244

@@ -262,26 +262,26 @@ Steps
262262

263263
.. code-block:: php
264264

265-
Route::get('/create_nested/', function (Request $request) {
265+
Route::get('/create_nested/', function (Request $request) {
266266
$message = "executed";
267267
$success = null;
268268

269-
$address = new stdClass;
269+
$address = new stdClass;
270270
$address->street = '123 my street name';
271271
$address->city = 'my city';
272272
$address->zip= '12345';
273273
274274

275275
try {
276-
$customer = new CustomerMongoDB();
276+
$customer = new CustomerMongoDB();
277277
$customer->guid = 'cust_2222';
278278
$customer->first_name = 'John';
279279
$customer->family_name= 'Doe';
280280
$customer->email= $emails;
281281
$customer->address= $address;
282282
$success = $customer->save(); // save() returns 1 or 0
283283
}
284-
catch (\Exception $e) {
284+
catch (\Exception $e) {
285285
$message = $e->getMessage();
286286
}
287287
return ['msg' => $message, 'data' => $success];
@@ -321,7 +321,7 @@ Steps
321321
You can begin building a query from a ``collection`` object.
322322
Eloquent exposes the full capabilities of the underlying database
323323
by using "raw queries," which Laravel sends to the database
324-
without any processing from the Eloquent Query Builder.
324+
without any processing from the Eloquent Query Builder.
325325

326326
You can perform a raw native MongoDB query from the model as shown
327327
in the following code:
@@ -341,14 +341,14 @@ Steps
341341

342342
$mongodbquery = ['guid' => 'cust_1111', ];
343343
$mongodb_native_collection = DB::connection('mongodb')->getCollection('laracoll');
344-
$document = $mongodb_native_collection->findOne( $mongodbquery );
345-
$cursor = $mongodb_native_collection->find( $mongodbquery );
344+
$document = $mongodb_native_collection->findOne( $mongodbquery );
345+
$cursor = $mongodb_native_collection->find( $mongodbquery );
346346

347347
The following code demonstrates multiple ways to perform queries:
348348

349349
.. code-block:: php
350350

351-
Route::get('/find_native/', function (Request $request) {
351+
Route::get('/find_native/', function (Request $request) {
352352
// a simple MongoDB query that looks for a customer based on the guid
353353
$mongodbquery = ['guid' => 'cust_2222'];
354354

@@ -387,7 +387,7 @@ Steps
387387

388388
.. code-block:: php
389389

390-
Route::get('/update_native/', function (Request $request) {
390+
Route::get('/update_native/', function (Request $request) {
391391
$mdb_collection = DB::connection('mongodb')->getCollection('laracoll');
392392
$match = ['guid' => 'cust_2222'];
393393
$update = ['$set' => ['first_name' => 'Henry', 'address.street' => '777 new street name'] ];
@@ -400,7 +400,7 @@ Steps
400400

401401
.. code-block:: php
402402

403-
Route::get('/delete_native/', function (Request $request) {
403+
Route::get('/delete_native/', function (Request $request) {
404404
$mdb_collection = DB::connection('mongodb')->getCollection('laracoll');
405405
$match = ['guid' => 'cust_2222'];
406406
$result = $mdb_collection->deleteOne($match );
@@ -440,7 +440,7 @@ Steps
440440

441441
.. code-block:: php
442442

443-
Route::get('/aggregate/', function (Request $request) {
443+
Route::get('/aggregate/', function (Request $request) {
444444
$mdb_collection = DB::connection('mongodb_mflix')->getCollection('movies');
445445

446446
$stage0 = ['$unwind' => ['path' => '$genres']];

0 commit comments

Comments
 (0)