Errata

Laravel: Up & Running

Errata for Laravel: Up & Running

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Other Digital Version
x
Online, can't tell page. Ch 4, Components n Slots 1st para, last sentence before Example 4-14

"example of a model, or popover,"

I believe you meant "modal" (as in the Example).

Note: You are a god.

Note from the Author or Editor:
Fixed (already updated in the source).

Nathan T Granger  Apr 11, 2020 
Other Digital Version
x
Chapter 5, ENDING/RETURNING METHODS, dd() and dump()

Double use of 'the underlying' in sentence below.

Dump the underlying the underlying SQL query and the bindings, and, if using dd(), ends the script.

Should read.

Dump the underlying SQL query and the bindings, and, if using dd(), ends the script.



Note from the Author or Editor:
Changes needed: Delete duplicate "the underlying".

Already changed in the source.

Stuart summers  Sep 17, 2020 
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 16
Under app folder description

The paragraph is:

Where the bulk of your actual application will go. .Models, controllers, commands, and your PHP domain code will all go in here.


Issue:
Notice before the second sentence there is an additional period.

Note from the Author or Editor:
Delete the extra period at the end of the sentence.

From this:

Where the bulk of your actual application will go. .Models, controllers, commands, and your PHP domain code will all go in here.

to this:

Where the bulk of your actual application will go. Models, controllers, commands, and your PHP domain code will all go in here.
I've fixed this in the code.

Vince Mitchell  May 02, 2019  Feb 21, 2020
Other Digital Version
17
Under .editorconfig file description

Typo: standars

This line:
Gives your IDE/text editor instructions about Laravel's coding standars

Should be:
Gives your IDE/text editor instructions about Laravel's coding standards

Note:
I purchased the Kindle Edition this morning (3AM PST). It appears that a lot of issues were corrected some time today. Unfortunately, Amazon hasn't provided access to the corrected version.

Note from the Author or Editor:
Fixed, changing "standars" to "standards" under the description of the .editorconfig file in chapter 2.

Michael Novello  Feb 21, 2020 
Printed, PDF
Page 35
Rate limiting

This line:

If you need to limit users to only accessing any give route(s) a certain number of times

Should be:

If you need to limit users to only accessing any given route(s) a certain number of times

Zakaria Harara  Feb 19, 2020  Feb 21, 2020
Printed
Page 48
Paragraph after example 3-28

The end of the paragraph after Example 3-28 seems incorrect.


It currently ends with:

"the index() method on the tasks resource controller will be named tasks.index()."

I presume it should be:

"the index() method on the tasks resource controller will be named tasks.index."

Which just removes the parentheses '()' at the end of the sentence.

Note from the Author or Editor:
Replace tasks.index() with tasks.index:

the +index()+ method on the +tasks+ resource controller will be named +tasks.index()+.

should be:

the +index()+ method on the +tasks+ resource controller will be named +tasks.index+.

I've already fixed in the code.

Vince Mitchell  May 06, 2019  Feb 21, 2020
Printed
Page 57
"Other Redirect Methods"

Reported from Tobias Etzold, refresh() and away() are improperly formatted in the "Other Redirect Methods" list and were incorrectly lumped into the home() paragraph.

Fixed in the code.

Matt Stauffer
Matt Stauffer
 
May 29, 2019  Feb 21, 2020
Printed, PDF
Page 57
Other Redirect Methods�, under guest()

Typo:

*authentification*� should be authentication

Note from the Author or Editor:
Fixed (already updated in the code).

Zakaria Harara  Feb 23, 2020 
PDF, ePub
Page 66
View composers for multiple views

in the example given you are using closure as the following:
function () { $view->with('posts', Post::recent()); }

you you have not defined $view as the function parameter in the both examples provided.

Note from the Author or Editor:
Two closures in Chapter 4 were missing the +$view+ parameter in their function definitions.

I've fixed in the code.

Pezhvak IMV  May 18, 2019  Feb 21, 2020
Printed, PDF, ePub
Page 78
after Example 4-24. A view composer

in the given example variable 'recentPosts' is used for passing Post::recent() into the view, but in the following paragraph there is a typo which is referring 'recentPosts' as 'posts':

As you can see, when this composer is called, it runs the compose() method, in which we bind the posts variable to the result of running the Post model’s recent() method.

Note from the Author or Editor:
+posts+ variable in the paragraph following 4-24 should be +recentPosts+.

I've fixed in the code.

Pezhvak IMV  May 18, 2019  Feb 21, 2020
Printed
Page 84
Example 4-36

This line:

$response = $this->get("events/{ $event->id }");

Should be this:

$response = $this->get("events/{ $event1->id }");

(I've fixed this in the source).

Matt Stauffer
Matt Stauffer
 
Jul 14, 2019  Feb 21, 2020
, Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 89
Last paragraph

The paragraph heading is not formatted. Displays as
[role="less_space pagebreak-before"]' === Migrations

Note from the Author or Editor:
Fix the role note to make this a correct subheading.

Oladipupo Majekodunmi  Apr 27, 2019  Feb 21, 2020
Printed, PDF, ePub
Page 102
Example 5-10. Using model factories

in the second factory (for User::class), $post is passed to the closure to be used, but it's not defined, which clearly should be from the return value of the previous factory for Post:class.

i think it should be like this:

$post = factory(Post::class)->create([ 'title' => 'My greatest post ever', ]);

// Pro-level factory; but don't get overwhelmed! factory(User::class, 20)->create()->each(function ($u) use ($post) {

$post->comments()->save(factory(Comment::class)->make([

'user_id' => $u->id,

])); });

Note from the Author or Editor:
Example 5-10 needed "$post = " assigned to the output of the first factory creation, resulting in this:

$post = factory(Post::class)->create([
'title' => 'My greatest post ever',
]);

I've changed it in the code.

Pezhvak IMV  May 18, 2019  Feb 21, 2020
, Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 104
Example 5-14. Specifying a factory state with a closure

Following the example for creating an instance of a state as stated below

$vip = factory(Contact::class, 'vip')->create();
$vips = factory(Contact::class, 'vip', 3)->create();

throws an error (Unable to locate factory with name...) for me when working in version 5.8.14.

Changing it to the following, however, works.

$vip = factory(Contact::class)->state('vip')->create();
$vips = factory(Contact::class, 3)->state('vip')->create();

Note from the Author or Editor:
Fix as described in the issue:

$vip = factory(Contact::class, 'vip')->create();
$vips = factory(Contact::class, 'vip', 3)->create();

should be:

$vip = factory(Contact::class)->state('vip')->create();
$vips = factory(Contact::class, 3)->state('vip')->create();

I've already fixed.

Oladipupo Majekodunmi  Apr 27, 2019  Feb 21, 2020
Printed, PDF, ePub
Page 106
Raw SQL -> Raw selects

after this example:
$users = DB::select('select * from users');

you wrote "This will return a collection of stdClass objects." which is not accurate.

raw select on DB facade returns an 'array' of stdClass, collection will be returned only for fluent query builder (DB::table('users')->select()->get() / DB::table('users')->get())

Note from the Author or Editor:
If a call is made directly on the DB Facade (most often +select()+) it returns an array; if it's a chainable method, most often ending in +get()+, it returns a collection.

Fixed in the code.

Pezhvak IMV  May 19, 2019  Feb 21, 2020
Printed, PDF, ePub
Page 117
// Take database actions

in the following line ')' is missing:

if ($badThingsHappened {
DB::rollBack();
}

Note from the Author or Editor:
$badThingsHappened needs a closing paren, resulting in:

if ($badThingsHappened) {

I've fixed it in the code.

Pezhvak IMV  May 19, 2019  Feb 21, 2020
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 118
Example 5-18

In the `public function save(Request $request)`, there is a typo in one of the 'contact' words, it says $conatct->email instead of $contact.

Note from the Author or Editor:
Replace this:
$conatct->email
with this:
$contact->email

I've fixed this already.

Zuzana Kunckova  May 06, 2019  Feb 21, 2020
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 145
Many to Many

The text reads - "So, since we’re linking users and contacts, our pivot table should be named contacts_users..."

When testing the code, this gives an error "Table 'dbname.contact_user' doesn't exist"

It appears to be looking for contact_user and not the suggested contacts_users.

Note from the Author or Editor:
Rename "contacts_users" to "contact_user" in chapter 5 just below "Defining a many-to-many relationship's inverse".

Fixed in the source code already.

Oladipupo Majekodunmi  May 11, 2019  Feb 21, 2020
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 232
Example 9-7; code snippet

The code contains a minor misplacement of a closing parenthesis in the fourth line:


]), request()->filled('remember')) {


should be, I think,


], request()->filled('remember'))) {

Note from the Author or Editor:
Move the parenthesis to just before the curly brace, as shown.

From this:
]), request()->filled('remember')) {

to this:
], request()->filled('remember'))) {

I've already applied this change.

David Carter  Apr 27, 2019  Feb 21, 2020
Printed, PDF, ePub
Page 252
Different Names for Testing Methods Prior to Laravel 5.4

you have written this two times in the same paragraph:

Laravel prior to 5.4, assertDatabaseHas() should be replaced by seeInDatabase(),....

and then again:

assertDatabaseMissing() should likewise be replaced by dontSeeInDatabase(), assertDatabaseHas() should be replaced by seeInDatabase().

Note from the Author or Editor:
assertDatabaseHas() should be replaced by seeInDatabase was in the list twice just below [[EX926]] Testing authentication routes.

Fixed in the code.

Pezhvak IMV  May 26, 2019  Feb 21, 2020
Printed
Page 319
Second code block, starting with '$slackMock

The code block misses part of the arrow in the last method call. ")-should" should have been ")->should"

Note from the Author or Editor:
There is a missing +>+ from this block, as described.

Fixed in the code.

Jakob Buis  May 25, 2019  Feb 21, 2020
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 339
Artisan command after first paragraph.

The command

php artisan make:controller Api\DogsController --api

creates ApiDogsController in the Controllers folder.

The backslash should be replaced with a forward slash to create DogsController in the Controllers/Api directory/namespace.

i.e. php artisan make:controller Api/DogsController --api

Note from the Author or Editor:
Replace the backslash with a forward slash in the original command, from this:

php artisan make:controller Api\DogsController --api

to this:

php artisan make:controller Api/DogsController --api

I've applied this change.

Richard Bailey  May 06, 2019  Feb 21, 2020
Other Digital Version
1338
Example 3-37, line 4

Code example reads:

'X-XSRF-TOKEN': ...

Possible correction:

'X-CSRF-TOKEN': ...

Note:

Page numbers are whacky in the Kindle app.

Also, not sure this is a real typo. I looked around a little, and the official documentation uses the CSRF-TOKEN version. I read somewhere that a XSRF-TOKEN cookie is encrypted and provided by Laravel (and then sent back to Laravel in the same encrypted format). I'm uncertain whether the csrf_token() helper function provides an encrypted version for the VerifyCsrfMiddleware middleware, or if it matters either way.

Note from the Author or Editor:
Changing to CSRF. (Fixed in the code)

Michael Novello  Feb 24, 2020