웹마짱구의 블로그

728x90

herd 에서 새 라라벨 프로젝트 생성시에 Error: Cannot find module '../lightningcss.win32-x64-msvc.node' 이 에러가 나는 이유

 

Laravel Herd에서 새 Laravel 프로젝트를 생성할 때 lightningcss 패키지의 네이티브 바이너리 모듈을 찾을 수 없어서 발생하는 문제

 

# 기존 의존성 제거
rm -rf node_modules package-lock.json

# 의존성 재설치
npm install

 

위 방법으로 안될시에 아래 방법 추가.

 

# npm 캐시 클리어
npm cache clean --force

 

npm uninstall lightningcss
npm install lightningcss

728x90

1. config/app.php 수정

    'timezone' => 'Asia/Seoul',

    'locale' => env('APP_LOCALE', 'ko'),

    'fallback_locale' => env('APP_FALLBACK_LOCALE', 'ko'),

    'faker_locale' => env('APP_FAKER_LOCALE', 'ko_KR'),

 

 2. 한국어 번역 파일을 생성하기 위해 resources/lang/ko 디렉토리를 만들 기본 번역 파일들을 생성

$ php artisan lang:publish

$ mkdir -p lang/ko

 

lang/ko/auth.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are used during authentication for various
    | messages that we need to display to the user. You are free to modify
    | these language lines according to your application's requirements.
    |
    */

    'failed' => '메일 또는 비밀번호가 올바르지 않습니다.',
    'password' => '비밀번호가 올바르지 않습니다.',
    'throttle' => '로그인 시도가 너무 많습니다. :seconds초 후에 다시 시도해주세요.',

];

 

lang/ko/pagination.php  

 

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Pagination Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are used by the paginator library to build
    | the simple pagination links. You are free to change them to anything
    | you want to customize your views to better match your application.
    |
    */

    'previous' => '&laquo; 이전',
    'next' => '다음 &raquo;',

];

 

lang/ko/passwords.php  

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Password Reset Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are the default lines which match reasons
    | that are given by the password broker for a password update attempt
    | has failed, such as for an invalid token or invalid new password.
    |
    */

    'reset' => '비밀번호가 재설정되었습니다!',
    'sent' => '비밀번호 재설정 링크를 이메일로 보냈습니다!',
    'throttled' => '다시 시도하기 전에 기다려주세요.',
    'token' => '비밀번호 재설정 토큰이 유효하지 않습니다.',
    'user' => '해당 이메일 주소로 등록된 사용자를 찾을 수 없습니다.',

];

 

lang/ko/validation.php  

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Validation Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines contain the default error messages used by
    | the validator class. Some of these rules have multiple versions such
    | as the size rules. Feel free to tweak each of these messages here.
    |
    */

    'accepted' => ':attribute을(를) 동의해야 합니다.',
    'accepted_if' => ':other이(가) :value일 때 :attribute을(를) 동의해야 합니다.',
    'active_url' => ':attribute은(는) 유효한 URL이 아닙니다.',
    'after' => ':attribute은(는) :date 이후 날짜여야 합니다.',
    'after_or_equal' => ':attribute은(는) :date 이후이거나 같은 날짜여야 합니다.',
    'alpha' => ':attribute은(는) 문자만 포함할 수 있습니다.',
    'alpha_dash' => ':attribute은(는) 문자, 숫자, 대시, 밑줄만 포함할 수 있습니다.',
    'alpha_num' => ':attribute은(는) 문자와 숫자만 포함할 수 있습니다.',
    'array' => ':attribute은(는) 배열이어야 합니다.',
    'ascii' => ':attribute은(는) 단일 바이트 영숫자 문자와 기호만 포함할 수 있습니다.',
    'before' => ':attribute은(는) :date 이전 날짜여야 합니다.',
    'before_or_equal' => ':attribute은(는) :date 이전이거나 같은 날짜여야 합니다.',
    'between' => [
        'array' => ':attribute은(는) :min개에서 :max개 사이의 항목을 가져야 합니다.',
        'file' => ':attribute은(는) :minKB에서 :maxKB 사이여야 합니다.',
        'numeric' => ':attribute은(는) :min에서 :max 사이여야 합니다.',
        'string' => ':attribute은(는) :min자에서 :max자 사이여야 합니다.',
    ],
    'boolean' => ':attribute 필드는 true 또는 false여야 합니다.',
    'can' => ':attribute 필드에 권한이 없습니다.',
    'confirmed' => ':attribute 확인이 일치하지 않습니다.',
    'current_password' => '비밀번호가 올바르지 않습니다.',
    'date' => ':attribute은(는) 유효한 날짜가 아닙니다.',
    'date_equals' => ':attribute은(는) :date와 같은 날짜여야 합니다.',
    'date_format' => ':attribute이(가) :format 형식과 일치하지 않습니다.',
    'decimal' => ':attribute은(는) :decimal 소수점 자릿수를 가져야 합니다.',
    'declined' => ':attribute을(를) 거부해야 합니다.',
    'declined_if' => ':other이(가) :value일 때 :attribute을(를) 거부해야 합니다.',
    'different' => ':attribute과(와) :other은(는) 달라야 합니다.',
    'digits' => ':attribute은(는) :digits 자릿수여야 합니다.',
    'digits_between' => ':attribute은(는) :min에서 :max 자릿수 사이여야 합니다.',
    'dimensions' => ':attribute 이미지 차원이 유효하지 않습니다.',
    'distinct' => ':attribute 필드에 중복 값이 있습니다.',
    'doesnt_end_with' => ':attribute은(는) 다음 중 하나로 끝나지 않아야 합니다: :values.',
    'doesnt_start_with' => ':attribute은(는) 다음 중 하나로 시작하지 않아야 합니다: :values.',
    'email' => ':attribute은(는) 유효한 이메일 주소여야 합니다.',
    'ends_with' => ':attribute은(는) 다음 중 하나로 끝나야 합니다: :values.',
    'enum' => '선택된 :attribute이(가) 유효하지 않습니다.',
    'exists' => '선택된 :attribute이(가) 유효하지 않습니다.',
    'extensions' => ':attribute은(는) 다음 확장자 중 하나를 가져야 합니다: :values.',
    'file' => ':attribute은(는) 파일이어야 합니다.',
    'filled' => ':attribute 필드가 있어야 합니다.',
    'gt' => [
        'array' => ':attribute은(는) :value개보다 많은 항목을 가져야 합니다.',
        'file' => ':attribute은(는) :valueKB보다 커야 합니다.',
        'numeric' => ':attribute은(는) :value보다 커야 합니다.',
        'string' => ':attribute은(는) :value자보다 길어야 합니다.',
    ],
    'gte' => [
        'array' => ':attribute은(는) :value개 이상의 항목을 가져야 합니다.',
        'file' => ':attribute은(는) :valueKB 이상이어야 합니다.',
        'numeric' => ':attribute은(는) :value 이상이어야 합니다.',
        'string' => ':attribute은(는) :value자 이상이어야 합니다.',
    ],
    'hex_color' => ':attribute은(는) 유효한 16진수 색상이어야 합니다.',
    'image' => ':attribute은(는) 이미지여야 합니다.',
    'in' => '선택된 :attribute이(가) 유효하지 않습니다.',
    'in_array' => ':attribute 필드가 :other에 존재하지 않습니다.',
    'integer' => ':attribute은(는) 정수여야 합니다.',
    'ip' => ':attribute은(는) 유효한 IP 주소여야 합니다.',
    'ipv4' => ':attribute은(는) 유효한 IPv4 주소여야 합니다.',
    'ipv6' => ':attribute은(는) 유효한 IPv6 주소여야 합니다.',
    'json' => ':attribute은(는) 유효한 JSON 문자열이어야 합니다.',
    'lowercase' => ':attribute은(는) 소문자여야 합니다.',
    'lt' => [
        'array' => ':attribute은(는) :value개보다 적은 항목을 가져야 합니다.',
        'file' => ':attribute은(는) :valueKB보다 작아야 합니다.',
        'numeric' => ':attribute은(는) :value보다 작아야 합니다.',
        'string' => ':attribute은(는) :value자보다 짧아야 합니다.',
    ],
    'lte' => [
        'array' => ':attribute은(는) :value개 이하의 항목을 가져야 합니다.',
        'file' => ':attribute은(는) :valueKB 이하여야 합니다.',
        'numeric' => ':attribute은(는) :value 이하여야 합니다.',
        'string' => ':attribute은(는) :value자 이하여야 합니다.',
    ],
    'mac_address' => ':attribute은(는) 유효한 MAC 주소여야 합니다.',
    'max' => [
        'array' => ':attribute은(는) :max개 이하의 항목을 가져야 합니다.',
        'file' => ':attribute은(는) :maxKB 이하여야 합니다.',
        'numeric' => ':attribute은(는) :max 이하여야 합니다.',
        'string' => ':attribute은(는) :max자 이하여야 합니다.',
    ],
    'max_digits' => ':attribute은(는) :max 자릿수 이하여야 합니다.',
    'mimes' => ':attribute은(는) 다음 유형의 파일이어야 합니다: :values.',
    'mimetypes' => ':attribute은(는) 다음 유형의 파일이어야 합니다: :values.',
    'min' => [
        'array' => ':attribute은(는) :min개 이상의 항목을 가져야 합니다.',
        'file' => ':attribute은(는) :minKB 이상이어야 합니다.',
        'numeric' => ':attribute은(는) :min 이상이어야 합니다.',
        'string' => ':attribute은(는) :min자 이상이어야 합니다.',
    ],
    'min_digits' => ':attribute은(는) :min 자릿수 이상이어야 합니다.',
    'missing' => ':attribute이(가) 누락되었습니다.',
    'missing_if' => ':other이(가) :value일 때 :attribute이(가) 누락되었습니다.',
    'missing_unless' => ':other이(가) :value가 아닐 때 :attribute이(가) 누락되었습니다.',
    'missing_with' => ':values가 존재할 때 :attribute이(가) 누락되었습니다.',
    'missing_with_all' => ':values가 모두 존재할 때 :attribute이(가) 누락되었습니다.',
    'multiple_of' => ':attribute은(는) :value의 배수여야 합니다.',
    'not_in' => '선택된 :attribute이(가) 유효하지 않습니다.',
    'not_regex' => ':attribute 형식이 유효하지 않습니다.',
    'numeric' => ':attribute은(는) 숫자여야 합니다.',
    'password' => [
        'letters' => ':attribute은(는) 최소 하나의 문자를 포함해야 합니다.',
        'mixed' => ':attribute은(는) 최소 하나의 대문자와 소문자를 포함해야 합니다.',
        'numbers' => ':attribute은(는) 최소 하나의 숫자를 포함해야 합니다.',
        'symbols' => ':attribute은(는) 최소 하나의 기호를 포함해야 합니다.',
        'uncompromised' => '주어진 :attribute이(가) 데이터 유출에 나타났습니다. 다른 :attribute을(를) 선택해주세요.',
    ],
    'present' => ':attribute 필드가 있어야 합니다.',
    'present_if' => ':other이(가) :value일 때 :attribute 필드가 있어야 합니다.',
    'present_unless' => ':other이(가) :value가 아닐 때 :attribute 필드가 있어야 합니다.',
    'present_with' => ':values가 존재할 때 :attribute 필드가 있어야 합니다.',
    'present_with_all' => ':values가 모두 존재할 때 :attribute 필드가 있어야 합니다.',
    'prohibited' => ':attribute 필드가 금지되어 있습니다.',
    'prohibited_if' => ':other이(가) :value일 때 :attribute 필드가 금지되어 있습니다.',
    'prohibited_unless' => ':other이(가) :values에 없을 때 :attribute 필드가 금지되어 있습니다.',
    'prohibits' => ':attribute 필드가 :other 필드의 존재를 금지합니다.',
    'regex' => ':attribute 형식이 유효하지 않습니다.',
    'required' => ':attribute 필드가 필요합니다.',
    'required_array_keys' => ':attribute 필드에는 다음 항목이 필요합니다: :values.',
    'required_if' => ':other이(가) :value일 때 :attribute 필드가 필요합니다.',
    'required_if_accepted' => ':other이(가) 수락되었을 때 :attribute 필드가 필요합니다.',
    'required_unless' => ':other이(가) :values에 없을 때 :attribute 필드가 필요합니다.',
    'required_with' => ':values가 존재할 때 :attribute 필드가 필요합니다.',
    'required_with_all' => ':values가 모두 존재할 때 :attribute 필드가 필요합니다.',
    'required_without' => ':values가 없을 때 :attribute 필드가 필요합니다.',
    'required_without_all' => ':values가 모두 없을 때 :attribute 필드가 필요합니다.',
    'same' => ':attribute과(와) :other이(가) 일치해야 합니다.',
    'size' => [
        'array' => ':attribute은(는) :size개의 항목을 가져야 합니다.',
        'file' => ':attribute은(는) :sizeKB여야 합니다.',
        'numeric' => ':attribute은(는) :size여야 합니다.',
        'string' => ':attribute은(는) :size자여야 합니다.',
    ],
    'starts_with' => ':attribute은(는) 다음 중 하나로 시작해야 합니다: :values.',
    'string' => ':attribute은(는) 문자열이어야 합니다.',
    'timezone' => ':attribute은(는) 유효한 시간대여야 합니다.',
    'unique' => ':attribute이(가) 이미 사용되었습니다.',
    'uploaded' => ':attribute 업로드에 실패했습니다.',
    'uppercase' => ':attribute은(는) 대문자여야 합니다.',
    'url' => ':attribute 형식이 유효하지 않습니다.',
    'ulid' => ':attribute은(는) 유효한 ULID여야 합니다.',
    'uuid' => ':attribute은(는) 유효한 UUID여야 합니다.',

    /*
    |--------------------------------------------------------------------------
    | Custom Validation Language Lines
    |--------------------------------------------------------------------------
    |
    | Here you may specify custom validation messages for attributes using the
    | convention "rule.attribute" to name the lines. This makes it quick to
    | specify a specific custom language line for a given attribute rule.
    |
    */

    'custom' => [
        'attribute-name' => [
            'rule-name' => 'custom-message',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Custom Validation Attributes
    |--------------------------------------------------------------------------
    |
    | The following language lines are used to swap our attribute placeholder
    | with something more reader friendly such as "E-Mail Address" instead
    | of "email". This simply helps us make our message more expressive.
    |
    */

    'attributes' => [
        'name' => '이름',
        'username' => '사용자명',
        'email' => '이메일',
        'password' => '비밀번호',
        'password_confirmation' => '비밀번호 확인',
        'city' => '도시',
        'country' => '국가',
        'address' => '주소',
        'phone' => '전화번호',
        'mobile' => '휴대전화',
        'age' => '나이',
        'sex' => '성별',
        'gender' => '성별',
        'day' => '일',
        'month' => '월',
        'year' => '년',
        'hour' => '시간',
        'minute' => '분',
        'second' => '초',
        'title' => '제목',
        'content' => '내용',
        'description' => '설명',
        'excerpt' => '요약',
        'date' => '날짜',
        'time' => '시간',
        'available' => '사용 가능',
        'size' => '크기',
    ],

];

 

728x90

Laravel 10 + Sail + Redis + Inertia.js + Vue3 + Tailwind CSS + Ziggy 기반의 개발환경음부터 한 번에 구축할 수 있는 전체 과정을 아래에 정드립니다.


1. 프로젝트 생성 및 기본 환경 구축

 
bashn

2. Redis 서비스 추가

docker-compose.yml 파일에서 redis 서비스가 없다면 아래를 추가:

 
yaml

.env 파일 수정

 
env

3. 프론트엔드 패키지 설치

 
bash

4. 설정 파일 작성  수정

vite.config.js

 
js

tailwind.config.js

 
js

resources/css/app.css

 
css

resources/js/app.js

 
js
 

5. Inertia 미들웨어 및 라우트 설정

 
bash

app/Http/Kernel.phpweb 미들웨어 그룹에 아래 한 줄 추가:

 
php

resources/views/app.blade.php(아래와 같이 생성)

 
blade

6. 예제 컨트롤러, 라우트, Vue 페이지 생성

 
bash
 
 
php
 

routes/web.php

 
php
 
Apply

resources/js/Pages/Home.vue

 
vue

7. 빌드 및 실행

 
bash

8. 브라우저에서 확인

  • http://localhost (또 .env의 APP_URL) 접속
  • Inertia + Vue3 기반의 화면이 정상적으로 보이면 성공!

추가 팁

  • Sail 컨테이너 중지: ./vendor/bin/sail down
  • 마이그레이션: ./vendor/bin/sail artisan migrate
  • 스트: ./vendor/bin/sail artisan test

이 순서대로 따라하면,라라  + Vue3 + Inertia + Tailwind + Ziggy + Redis + Sail최신 개발환경을 한 번에 구축할 수 있습니다!

 

=========================================================================

 

curl -s "https://laravel.build/myProject?version=10.*" | bash

10.x 버전이 설치가 안될때

$ composer create-project laravel/laravel:^10.0 myProject

$ cd myProject

$ php artisan sail:install

728x90

원문 : https://ecwebservices.medium.com/adding-phpmyadmin-to-laravel-sail-64823687e084

 

Adding PHPMyAdmin to Laravel Sail

PHPMyAdmin is very widely used, and it makes MySQL much easier.

ecwebservices.medium.com

 

1. docker-compose.yml 수

...
depends_on:
   - mysql
   - redis
   - minio
   - phpmyadmin
...


phpmyadmin:
   image: 'phpmyadmin:latest'
   ports:
      - 8080:80
   networks:
      - sail
   environment:
      - PMA_ARBITRARY=1

 

2. sail up -d

3. localhost:8080 접속

4. 서버 필드에는 mysql 로 기입.

728x90

원문 : https://digitalogia.tistory.com/282

 

Laravel - 다국어설정, 지역화에 대해서

Laravel 11 버전 이상에서.env 파일에서만 세팅하면 끝난다.APP_TIMEZONE=Asia/SeoulAPP_LOCALE=koAPP_FALLBACK_LOCALE=koAPP_FAKER_LOCALE=ko_KR 지역 설정 하기config/app.php'timezone' => 'Asia/Seoul','locale' => 'ko', 'fallback_locale' =>

digitalogia.tistory.com

 

[ .env  ]

APP_TIMEZONE=Asia/Seoul

APP_LOCALE=ko
APP_FALLBACK_LOCALE=ko
APP_FAKER_LOCALE=ko_KR

 

728x90

$ php artisan schedule:run
No scheduled commands are ready to run.

 

$ php artisan up
Application is now live.

 

$ php artisan schedule:run
Running scheduled command: 

728x90

원문 : tutsforweb.com/how-to-set-up-task-scheduling-cron-job-in-laravel/

 

How to set up Task Scheduling with Cron job in Laravel - TutsForWeb

Implementing Cron Job in Laravel. Set up and demonstrate the use of Task Scheduler using Cron Job in Laravel. Version control Cron jobs and Artisan command.

tutsforweb.com

 

커맨드 생성

php artisan make : command WordOfTheDay

 

스케쥴링 등록

app / Console / Kernel.php

 

crontab 등록 
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

728x90

https://stackoverflow.com/questions/18024237/increment-row-number-with-laravel-pagination

 

increment row number with laravel pagination

How to make increment row number with laravel pagination ? When i use pagination and i go to page 2 and above it will back to beginning. for example i will paginate(3) <tr...< p=""> </tr...<>

stackoverflow.com

 

 

@foreach ($telephone as $key=> $whatever)

<td>{{ $key+ $telephone->firstItem() }}</td>

@endforeach

728x90

https://code-examples.net/ko/q/16a7614


composer create-project laravel/laravel=4.1.27 your-project-name --prefer-dist


또는


composer create-project laravel/laravel your-project-name --prefer-dist  4.1.27


버전은 패키지스트 https://packagist.org/packages/laravel/laravel 에 존재하는 버전이어야 한다.



5.8 버전 설치시

composer create-project laravel/laravel="5.8.*" [프로젝트 이름] 예: composer create-project laravel/laravel="5.8.*" blog

728x90

원문 : https://code.i-harness.com/ko-kr/q/196bb1c



win7에서이 명령을 실행할 수 있습니다.

box add homestead file:///c:/homestead.box

또한이 중 하나가 작동합니다 :

box add homestead file:///c:\homestead.box