appkr / l5code

라라벨로 배우는 실전 PHP 웹 프로그래밍 (출판용 소스코드)
MIT License
63 stars 38 forks source link

오탈자 신고해 주세요. #3

Open appkr opened 7 years ago

appkr commented 7 years ago

책을 읽다가 오탈자를 발견하시면 신고해 주세요. 이 글에 댓글로 써 주세요.

을 써 주시면 됩니다.

혹시라도 이 책을 다시 찍게 된다면, 후배 독자들이 더 완성도 있는 책을 읽을 수 있을 겁니다. 이 저장소는 깃허브가 서비스를 접을 때까지, 삭제하지 않을 것이므로 여러분들의 기여가 영구적으로 보관됩니다.

고맙습니다.

page 29 by @appkr
-ul>li*3>a + Tab을 입력하고 Tab 키를 누르면
+ul>li*3>a를 입력하고 Tab 키를 누르면
page 52 by @mAKEkr
// 코드 7-1
public function down() {
-    Schema::drop('posts'); 
+    Schema::dropIfExists('posts'); 
}
page 53 by @mAKEkr
-Schema::drop(string $table) 테이블을 지운다.
+Schema::dropIfExists(string $table) 테이블을 지운다. 
page 64 by @namo429
// 표 8-1
-ArticlesController@delete
+ArticlesController@destroy
page 64 by @appkr
// 표 8-1 라라벨 5.2까지는 RESTful 리소스 라우트에서 복수형의 라우트 파라미터를 쓰다가 5.3부터 단수로 바뀌었습니다.
-{articles}
+{article}
page 72 by @show0910
// 그림 9-1 웹 브라우저의 마지막 쿠키 기록 부분
-expires=zzz
+expires=aaa
page 89 by @mAKEkr
// 콘솔 10-7
+2번 사용자가 없으면 1번 사용자를 이용한다. App\User::find(1)->articles()->...
>>> App\User::find(2)->articles()->create([ 
... 'title' => 'Second article',
... 'content' => 'Second content',
... ]);
page 101 by @show0910
-코드 12-3을 참고해서 포럼 글 목록을 포시할 뷰를 만들자.
+코드 12-3을 참고해서 포럼 글 목록을 표시할 뷰를 만들자.
page 122 by @mAKEkr 
// 코드 블록 제목
-코드 14-4 app/Http/Listeners/ArticlesEventListener.php
+코드 14-4 app/Listeners/ArticlesEventListener.php
page 123 by @mAKEkr 
// 코드 블록 제목
-코드 14-6 app/Http/Events/ArticleCreated.php
+코드 14-6 app/Events/ArticleCreated.php
page 129 by @dspaudio
-wehreEmail()은 동적 메서드다
+whereEmail()은 동적 메서드다
page 137 by @corean
-string g iven
+string given
page 223 by @namo429
// 코드 블록 타이틀
-코드 23-14 app/Events/ArticleCreated.php
+코드 23-14 app/Events/UserCreated.php

```diff
page 223 by @namo429
// 코드 23-14
-class UserCreated extends Event
+class UserCreated
page 228 by @corean 
-코드 23-21를 참고하여
+코드 23-12와 다음 코드 블록을 참고하여
page 232 by @namo429
// 코드 23-27 비밀번호 변경 로직 누락분 추가
public function postReset(Request $request)
{
    $this->validate($request, [
        'email' => 'required|email|exists:users',
        'password' => 'required|confirmed',
        'token' => 'required'
    ]);

    $token = $request->get('token');

    if (! \DB::table('password_resets')->whereToken($token)->first()) {
        return $this->respondError('URL이 정확하지 않습니다.');
    }

+    \App\User::whereEmail($request->input('email'))->first()->update([
+        'password' => bcrypt($request->input('password'))
+    ]);

    \DB::table('password_resets')->whereToken($token)->delete();

    return $this->respondSuccess(
        '비밀번호를 바꾸었습니다. 새로운 비밀번호로 로그인하세요.'
    );
}
page 233  by @namo429
// 코드 23-29
-class PasswordRemindCreated extends Event
+class PasswordRemindCreated
page 250 by @namo429
// 코드 25-1
-parent::boot($router);
+parent::boot();
page 262 by @dalicom
// 코드 25-18 아래 설명
-$gate->define('update', function ($user, $model) {...})
+Gate::define('update', function ($user, $model) {...})
page 266 by @dalicom
// 코드 25-25 아래 설명
-$gate->before(function ($user, $ability) { ... }
+Gate::before(function ($user, $ability) { ... })
page 285 by @namo429
// 코드 27-13
-{{ $file->filename }} ({{ $file->bytes }})
+{{ $attachment->filename }} ({{ $attachment->bytes }})
page 287 by @namo429
// 코드 블록 제목
-코드 27-17 routes/web.php
+코드 27-17 resources/views/articles/partial/form.blade.php
page 305 by @namo429
// 코드 28-13
-public function boot(Router $router)
+public function boot()
-parent::boot($router);
+parent::boot();
page 327 by by @namo429
// 코드 29-12
-class CommentsEvent extends Event
+class CommentsEvent
page 347 by @namo429
// 코드 블록 제목
-코드 29-40 app/Http/Controller/Cacheable.php
+코드 29-40 app/Http/Controllers/Cacheable.php
// 코드 29-40
-namespace App\Http\Cacheable.php;
+namespace App\Http\Controllers;
page 352 by @dalicom
// 코드 30-4의 파일 경로가 틀렸고, 편집 오류로 2개의 코드 블록으로 분리되어야 합니다.
-resources/lang/ko/comments.php
+resources/lang/ko/forum.php
page 407 by @dalicom
// 코드 34-3
-public function transform(\App\Article $item)
+public function transform(\App\Article $article)
page 497 by @tiher
-PSR-2 표준 권고안은 어디까지나 elsif다
+PSR-2 표준 권고안은 어디까지나 elseif다
page 512 by @nosent79
// 코드 C-13 박스 제목
-Writing.php
+Post.php

이상의 내용은 곧 나올 2쇄에 모두 반영되었습니다.


page 109 by @dalgonafactory 
-유효성 검사 오류가 발생하면 컨트롤러는 lluminate\Support\MessageBag 인스턴스를 만들어
+유효성 검사 오류가 발생하면 컨트롤러는 Illuminate\Support\MessageBag 인스턴스를 만들어
page 237 by @harryhan24
-갓허브
+깃허브
typo_237
page 510 by @luritas
// 코드 C-10
-new Post('Lorem ipsum dolor sit amet')->save();
+(new Post('Lorem ipsum dolor sit amet'))->save();
page 125 by @dalicom
- 우리가 앞에서 이 클래스의 boot() 메서드 본문에 $events->listen()으로 여러 번 ...
+ 우리가 앞에서 이 클래스의 boot() 메서드 본문에 \Event::listen()으로 여러 번 ...

이상의 내용은 3쇄에 모두 반영되었습니다.


page 363 by @YongukMoon
- $timezone = (auth->user->timezone) ?: config('app.timezone');
+$timezone = (auth()->user()->timezone) ?: config('app.timezone'); 
tiher commented 7 years ago
namo429 commented 7 years ago

page 223

-코드 23-14 app/Events/ArticleCreated.php +코드 23-14 app/Events/UserCreated.php

-class UserCreated extends Event +class UserCreated

show0910 commented 7 years ago

page 72 쿠키를 이용한 세션 유지 메커니즘에서 웹브라우저 쪽 마지막 쿠키 저장소에 기록에서 expires=zzz -> expires=aaa 일것 같습니다.

show0910 commented 7 years ago

page 101 코드 12-3을 참고해서 포럼 글 목록을 포시할 뷰를 만들자. -> 표시할 뷰를 만들자. 일것 같습니다~

namo429 commented 7 years ago

page 233 코드 23-29 -class PasswordRemindCreated extends Event +class PasswordRemindCreated

------- extends Event 를 삭제하지 않을경우 아래와 같은 오류 발생합니다 ---------- FatalErrorException in PasswordRemindCreated.php line 13: Class 'App\Events\Event' not found

namo429 commented 7 years ago

page 232 코드 23-27 비밀번호 업데이트 하는 부분 누락 ( Git Hub 소스에도 해당하는 부분이 없는 것 같습니다 ) 저는 아래와 같이 추가해서 동작 되게 했습니다.

$email = \DB::table( 'password_resets')->whereToken( $token)->first()->email; \DB::table('users')->whereEmail( $email)->update(['password' => bcrypt( $request->input( 'password'))]);

그리고 토큰 뿐만 아니라 이메일도 일치하는지 확인해야 하는 것 같습니다.

appkr commented 7 years ago

@namo429 @show0910 신고 고맙습니다. 이벤트 클래스에 extends Event가 붙어 있는 것은 라라벨 5.2때 원고를 썼다가, 5.3이 나오고 원고를 고치하는 과정에 꼼꼼이 살피지 못해서 라라벨 5.2의 찌꺼기가 남아 있는 것입니다. @namo429 님이 지적하신 비밀번호 변경 로직 누락 부분! 완전 고맙습니다.

namo429 commented 7 years ago

page 250 코드 25-1 -parent::boot($router); +parent::boot(); ------------- 에러 발생 ------------ ErrorException in RouteServiceProvider.php line 28: Undefined variable: router

namo429 commented 7 years ago

page 64 표 8-1

-ArticlesController@delete +ArticlesController@destroy

-> 이부분이 php artisan route:list 로 출력하면 ArticlesController@destroy로 나옵니다. 그런데 소스 전반적으로 destroy로 되어있습니다. 혹시 delete 로 작성해도 되는 것인지는 모르겠습니다만..

nosent79 commented 7 years ago

P512에 코드 C-13 제목에 Writing.php -> Post.php 가 되야할거 같아요.

appkr commented 7 years ago

@namo429 라우팅 정의 파일에서 Route::resource('articles', 'ArticlesController')로 정의하고, $php artisan make:controller ArticlesController --resource로 컨트롤러를 만들면, 책에 쓴대로 DELETE /articles/{article} URL은 자동으로 ArticlesController::destroy()로 연결됩니다.

직접 하나씩 하나씩 정의한다면 컨트롤러 메서드 이름은 delete로 쓰셔도 됩니다. 예를 들어

<?php // routes/web.php

Route::delete('articles/{article}', 'ArticlesController@delete');
<?php // app/Http/Controllers/ArticlesController.php

class ArticlesController ... {
    public function delete($article)
    {
        // HTTP 요청 처리 로직
    }
}

처럼이요.

namo429 commented 7 years ago

page 285 코드 27-13 -{{ $file->filename }} ({{ $file->bytes }}) +{{ $attachment->filename }} ({{ $attachment->bytes }})

namo429 commented 7 years ago

page 287 -코드 27-17 routes/web.php +코드 27-17 resources/views/articles/partial/form.blade.php

namo429 commented 7 years ago

page 305 코드 28-13 -public function boot( Router $router) +public function boot() -parent::boot($router); +parent::boot();

namo429 commented 7 years ago

page 327 코드 29-12 -class CommentsEvent extends Event +class CommentsEvent

namo429 commented 7 years ago

page 343 dd('캐싱되면 출력 안됨'); 등의 문장을 넣어 놓고.. -> dd 로 했을경우 다음 return 문에 도달하지 못해서요, echo나 var_dump 등의 문장을 넣어 놓고.. 로 바꾸어야 할 것 같습니다.

namo429 commented 7 years ago

page 347 코드 29-40 -namespace App\Http\Cacheable.php; +namespace App\Http\Controllers;

appkr commented 7 years ago

오탈자가 왜 이리 많죠 ㅜㅜ @namo429 님 꼼꼼이 봐주셔 정말 고맙습니다. 평일 낮에 삼성역 근처를 지나실 기회가 있으면 페북 메시지로 꼭 한번 연락 주세요. 신고해 주신 3건은 내일 아침에 볼게요~

corean commented 7 years ago

page 137 중간 -string g iven +string given

corean commented 7 years ago

page 228 -코드 23-21를 참고하여 +코드 23-12를 참고하여

appkr commented 7 years ago

@namo429 page 343의 캐싱에서 dd()를 찍는 부분은 책 내용이 맞습니다.

class Controller extends BaseController
{
    protected function cache($key, $minutes, $query, $method, ...$args)
    {
        // ...
        return \Cache::remember($key, $minutes, function () use ($query, $method, $args) {
            // 캐시 저장소에 만료되지 않은 $key가 있다면 이 콜백은 실행되지 않습니다.
            dd('캐싱되면 출력 안됨');
            return $query->{$method}($args);
        });
    }
}
mAKEkr commented 7 years ago

page 52 코드설명줄

    public function down()
    {
        Schema::drop('posts');
    }

부분을

    public function down()
    {
        Schema::dropIfExists('posts');
    }

로 고쳐주셔야될것같습니다 ^^; artisan make로 실행해도 dropIfExists로 생성되네요.

page 88번째 10.2.2 관계확인 tinker 커맨드라인 에제

>>> App\User::find(2)->articles()->create([

로 된 부분을

>>> App\User::find(1)->articles()->create([

로 수정해야될것같아요. 이전 예제에서 User모델로 생성한 데이터가 1건밖에 없는데 2번째 데이터를 찾으려고 하니 오류가 뜨네요.

mAKEkr commented 7 years ago

또하나 발견했습니다. page 122 예제코드 14-4의 코드경로

app/Http/Listeners/ArticlesEventListener.php

app/Listeners/ArticlesEventListener.php

로 변경

page 123 예제코드 14-6의 코드경로

app/Http/Events/ArticleCreated.php

app/Events/ArticleCreated.php

로 변경해야될듯하네요

corean commented 7 years ago

263p public function edit()는 있는데, update()는 권한 체크가 없어서 왜 여기서 권한 체크를 안할까?라고 생각해서 Repository의 해당 소스(app/Http/Controllers/Articelscontroller.php)를 찾아보니 update()에는 적용이 되어 있습니다.

appkr commented 7 years ago

@corean 그냥 지면을 아끼기 위해 생략한 것이라 보시면 되겠습니다. 고맙습니다.

dalicom commented 7 years ago

262p 코드 25-18 의 Gate::define 부분인데, 아래 설명부분에는 $gate->define('update', ~~~) 으로 되어 있습니다.

dalicom commented 7 years ago

266page 262p 와 마찬가지 오타입니다. 코드 25-25 의 Gate::define 부분의 아래 설명에서 $gate->define 으로 되어 있습니다.

dalicom commented 7 years ago

352page 코드 30-4 의 파일명이 resources/lang/ko/comments.php 가 아닌 resource/lang/ko/forum.php 입니다.

dalicom commented 7 years ago

407page 코드 34-3 에서 public function transform(\App\Article $item) 부분이 public function transform(\App\Article $article) 로 바뀌어야 합니다.

$item 변수명이 잘못되어 있네요.

dspaudio commented 7 years ago

129p wehreEmail()은 동적 메서드다 -> whereEmail()은 동적 메서드다

jhylmb commented 7 years ago

https://github.com/appkr/l5code/blob/443c010666eeb0baf6fa152307527cd48d28ab7c/app/Http/Controllers/AttachmentsController.php#L60

오타 신고합니다. 책에는 없지만 (27장의 27.4 마치며 단원의 추가 코드 변경 내용입니다.)

$path = attachments_path($attachment->name);

를 아래와 같이 고쳐야 하네요.

$path = attachments_path($attachment->filename);

appkr commented 7 years ago

@jhylmb 고맙습니다. @everybody 책 본문이 아니라 예제 코드의 오타(버그)입니다.

dalgonafactory commented 7 years ago

109page

유효성 검사 오류가 발생하면 컨트롤러는 lluminate\Support|MessageBag 인스턴스를 만들어 유효성 검사 오류가 발생하면 컨트롤러는 Illuminate\Support|MessageBag 인스턴스를 만들어

harryhan24 commented 7 years ago

의도하고 내신 오류인지는 모르겠지만 237페이지 하단 도표에서 깃허브가 아니라 갓허브라고 되어있습니다 깃허브는 정말 갓하네요... ㄷㄷ

luritas commented 7 years ago

510 page

코드 C-10 에 new Post('~~')->save() ==> (new Post('~~~'))->save() 으로 해야 되네요

dalicom commented 7 years ago

125page 중간쯤 이 클래스의 boot() 메소드 본문에 $events->listen() 을 여러 번 --> 이 클래스의 boot() 메소드 본문에 \Event::list() 을 여러 번

YongukMoon commented 6 years ago

page 363

$timezone=(auth->user->timezone) ?: config('app.timezone'); $timezone=(auth()->user()->timezone) ?: config('app.timezone');

php7, laravel 5.6 에서는 작동이 안되는군요

appkr commented 6 years ago

@YongukMoon 제보 고맙습니다. Laravel 5.6은 PHP7.1 이상이 필요합니다.

~/l5code(laravel56) $ tinker
Psy Shell v0.8.17 (PHP 7.1.22 — cli) by Justin Hileman
>>> $timezone = 'Asia/Seoul';
=> "Asia/Seoul"
>>> $datetime = Carbon\Carbon::now();
=> Carbon\Carbon @1538536041 {#875
     date: 2018-10-03 03:07:21.062260 UTC (+00:00),
   }
>>> $datetime->timezone($timezone);
=> Carbon\Carbon @1538536041 {#875
     date: 2018-10-03 12:07:21.062260 Asia/Seoul (+09:00),
   }
>>> exit
Exit:  Goodbye.

~/l5code(laravel56) $ php -v
PHP 7.1.22 (cli) (built: Sep 13 2018 21:14:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.22, Copyright (c) 1999-2018, by Zend Technologies

~/l5code(laravel56) $ artisan --version
Laravel Framework 5.6.12
YongukMoon commented 5 years ago

page 421 class ArticlesController extends Controller implements Cacheable class ArticlesController extends ParentController

allnight123 commented 2 years ago

page 212

flash()->danger('오류가 발생했습니다.'); flash('오류가 발생했습니다.', 'danger');

클래스 파일 확인해보니 flash()->error('오류가 발생했습니다.'); 로 고쳐서 확인했습니다.

allnight123 commented 2 years ago

page 232 코드23-26 resources/views/passwords/reset.blade.php 이부분 오탈자 입니다. 아래 처럼 수정되어야 합니다.

resources/views/emails/passwords/reset.blade.php

appkr commented 2 years ago

error api가 바꼈나봅니다.