라라벨
-
413 Large entity(ngnix) 에러 수정(업로드 용량 확대)Laravel/Forge 2021. 12. 30. 01:45
# What? 이미지 업로드하다보면 큰 용량은 안되는 경우 있음 이럴 때 ngnix 설정 변경해야함 # How? 1. laravel forge > 사이트 선택 > Edit Files > ngnix 선택 > server 밑에 client_max_body_size 넣기 ... server { client_max_body_size 20000M; ... } # FORGE CONFIG (DO NOT REMOVE!) include forge-conf/erounlife.com/after/*; 2. laravel forge > 서버 선택 > PHP > Max File Upload Size 수정(메가바이트 M 기준)
-
whereDoesntHaveLaravel 2021. 11. 25. 16:59
# What? 관계 테이블 중 특정 데이터를 갖고 있지 않는 목록 가져오기 # Why? ex. 상품 알러지성분 관계가 있을 때 A,B,C 알러지 성분을 갖고 있는 상품들을 제외한 상품목록을 가져오고 싶을 때 사용 # How? $items = $items->whereDoesntHave("allergies", function($query) use ($attributes){ $query->whereIn("id", $attributes["allergy_ids"]); });
-
한 컨트롤러에서 여러 모델에 대한 pagination 사용하고 싶을 때(페이지네이션)Laravel 2021. 11. 16. 14:22
# What? 한 컨트롤러에서 Post, Category 모델에 대해 페이지네이션 다중처리하기 # Why? page=2로 파라미터 넘어오면 Post, Category 둘 다의 2페이지 값들이 넘어감 # How? paginate(30, [*], "custom_page_name")과 같이 이름 변경 가능 $categories = Category::orderBy("order", "asc")->paginate(30, ["*"], "categories_page"); $workers = $workers->where("worker", true)->orderBy($orderBy, $align)->paginate(1);
-
Shared DataLaravel/Inertia.js 2021. 9. 21. 21:39
# What? - 전역변수처럼 프론트단 어떤 페이지에서나 가져다 쓸 수 있게 공유되는 데이터 # Why? - User나 Flash 메시지같은거 공유 필요 # How? @HandleInertiaRequests public function share(Request $request) { return array_merge(parent::share($request), [ "user" => auth()->user(), "flash" => function() use ($request){ return [ "success" => $request->session()->get("success"), "error" => $request->session()->get("error"), ]; }, // 기타 공유하고픈 데이터 ]);..
-
초기세팅Laravel/Inertia.js 2021. 9. 7. 17:07
# What? laravel mpa 구조 그대로 spa 구현 가능하게 도와주는 라이브러리 (후원자는 ssr까지 제공) # How? 1. Back-end 세팅 composer require inertiajs/inertia-laravel - welcome.blade.php => app.blade.php로 변경 @ app.blade.php @inertia php artisan inertia:middleware @ Kernel.php 'web' => [ // ... \App\Http\Middleware\HandleInertiaRequests::class, ], @ UserController.php
-
패키지 실제로 배포해보기Laravel/Package 2021. 9. 3. 22:32
- 본인 github에 올리기 @ gitignore build vendor composer.lock - packgist에 등록하기 1. https://packagist.org/ =7.4"" data-og-host="packagist.org" data-og-source-url="https://packagist.org/" data-og-url="https://packagist.org/" data-og-image=""> Packagist Define Your Package Put a file named composer.json at the root of your package's repository, containing this information: { "name": "your-vendor-name/pack..
-
만든 패키지 사용해보기(로컬, 퍼블리싱 전)Laravel/Package 2021. 9. 2. 00:11
- 테스트할 라라벨 프로젝트 생성 laravel new chunknorris - 로컬에 있는 패키지 경로 직접 명시해주기 @composer.json { ... "repositories": [ { "type" : "path", "url" : "../chunk-norris-jokes" } ] } - 패키지 설치하기 composer require june/chunk-norris-jokes composer dump-autoload - 패키지 사용해보기 @ web.php