편집을 취소할 수 있습니다. 이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 게시해주세요.
최신판 | 당신의 편집 | ||
10번째 줄: | 10번째 줄: | ||
Laravel의 기본 기능들을 샘플로 다루어 보기 위해, 태스크들을 다루는 태스크 목록 애플리케이션을 만들어 보겠습니다. 즉, 전형적인 "할 일" 목록 예제를 다루게 됩니다. 이 프로젝트의 완성된 소스코드는 [https://github.com/laravel/quickstart-basic GitHub에서 확인]할 수 있습니다. | Laravel의 기본 기능들을 샘플로 다루어 보기 위해, 태스크들을 다루는 태스크 목록 애플리케이션을 만들어 보겠습니다. 즉, 전형적인 "할 일" 목록 예제를 다루게 됩니다. 이 프로젝트의 완성된 소스코드는 [https://github.com/laravel/quickstart-basic GitHub에서 확인]할 수 있습니다. | ||
== | ==도커 환경== | ||
<syntaxhighlight lang='console'> | <syntaxhighlight lang='console'> | ||
testuser@lcoalhost:~$ mkdir ~/workspace && cd ~/workspace | |||
testuser@localhost:~/workspace$ docker run --name laravel --rm -it -v ${PWD}:/workspace -w /workspace --entrypoint="" --network host bitnami/laravel:latest bash | |||
Unable to find image 'bitnami/laravel:latest' locally | Unable to find image 'bitnami/laravel:latest' locally | ||
latest: Pulling from bitnami/laravel | latest: Pulling from bitnami/laravel | ||
28번째 줄: | 19번째 줄: | ||
Digest: sha256:d16af27a0d4c2f6f3f71c730d7def97de91e0b2ea0233e84dc758340521b1629 | Digest: sha256:d16af27a0d4c2f6f3f71c730d7def97de91e0b2ea0233e84dc758340521b1629 | ||
Status: Downloaded newer image for bitnami/laravel:latest | Status: Downloaded newer image for bitnami/laravel:latest | ||
root@ | root@localhost:/workspace# | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | ==설치== | ||
환경이 준비되면 Composer를 사용하여 Laravel 프레임워크를 설치할 수 있습니다: | 우선, Laravel 프레임워크을 새로 설치해야 합니다. [[Laravel Homestead|Homestead 가상머신]]을 사용하거나 선택한 로컬 PHP 환경을 사용하여 프레임워크를 실행할 수 있습니다. 로컬 환경이 준비되면 Composer를 사용하여 Laravel 프레임워크를 설치할 수 있습니다: | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
39번째 줄: | 30번째 줄: | ||
<syntaxhighlight lang='console'> | <syntaxhighlight lang='console'> | ||
root@ | root@localhost:/workspace# composer create-project laravel/laravel quickstart --prefer-dist | ||
Creating a "laravel/laravel" project at "./quickstart" | Creating a "laravel/laravel" project at "./quickstart" | ||
Installing laravel/laravel (v11.1.1) | Installing laravel/laravel (v11.1.1) | ||
54번째 줄: | 45번째 줄: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang='console'> | <syntaxhighlight lang='console'> | ||
root@ | root@localhost:/workspace# cd quickstart/ | ||
root@ | root@localhost:/workspace/quickstart# find app/ routes/ resources/ | grep .php | ||
app/Providers/AppServiceProvider.php | app/Providers/AppServiceProvider.php | ||
app/Http/Controllers/Controller.php | app/Http/Controllers/Controller.php | ||
62번째 줄: | 53번째 줄: | ||
routes/web.php | routes/web.php | ||
resources/views/welcome.blade.php | resources/views/welcome.blade.php | ||
</syntaxhighlight> | </syntaxhighlight> | ||
'''참고''': [[composer create-project laravel/laravel quickstart --prefer-dist]] | '''참고''': [[composer create-project laravel/laravel quickstart --prefer-dist]] | ||
==데이터베이스 준비== | ==데이터베이스 준비== | ||
99번째 줄: | 69번째 줄: | ||
$ php artisan make:migration create_tasks_table --create=tasks | $ php artisan make:migration create_tasks_table --create=tasks | ||
INFO Migration [database/migrations/ | INFO Migration [database/migrations/2024_06_15_161234_create_tasks_table.php] created successfully. | ||
</syntaxhighlight> | </syntaxhighlight> | ||
마이그레이션 파일은 프로젝트의 <code>database/migrations</code> 디렉토리에 생성됩니다. 아마도 <code>make:migration</code> 명령어가 이미 자동 증가 ID와 타임스탬프를 마이그레이션 파일에 추가한 것을 보셨을 것입니다. 이 파일을 편집하여 작업 이름을 위한 <code>name</code> 문자열 컬럼을 추가해봅시다: | 마이그레이션 파일은 프로젝트의 <code>database/migrations</code> 디렉토리에 생성됩니다. 아마도 <code>make:migration</code> 명령어가 이미 자동 증가 ID와 타임스탬프를 마이그레이션 파일에 추가한 것을 보셨을 것입니다. 이 파일을 편집하여 작업 이름을 위한 <code>name</code> 문자열 컬럼을 추가해봅시다: | ||
{{소스헤더|database/migrations/ | {{소스헤더|database/migrations/2024_06_15_161234_create_tasks_table.php}} | ||
<syntaxhighlight lang='php' highlight='16'> | <syntaxhighlight lang='php' highlight='16'> | ||
<?php | <?php | ||
146번째 줄: | 116번째 줄: | ||
INFO Running migrations. | INFO Running migrations. | ||
2024_06_15_161234_create_tasks_table ....................................... 9.24ms DONE | |||
</syntaxhighlight> | </syntaxhighlight> | ||
491번째 줄: | 461번째 줄: | ||
<button type="submit" class="btn btn-danger"> | <button type="submit" class="btn btn-danger"> | ||
Delete | <i class="fa fa-trash"></i> Delete | ||
</button> | </button> | ||
</form> | </form> |