최근 tricks

laravel 5.4 새 기능
동영상 Laracast 무료 시리즈 - What's New in Laravel 5.4 Laracast 무료 시리즈 - Laravel 5.4 From Scratch Laravel 5.4 New Features - Part 1: All the Small Changes Overview Part 2: Laravel Mix [Laravel 5.4 New Features] articles What’s New…
Submitted 7 years ago in Features
4691
0
0
5.4
console 로그와 웹 로그 분리하기
로그 설정을 daily로 하고, artisan command 등의 console 명령을 스케쥴링을 통하여 수행하는 경우 console 계정과 웹 계정의 차이로 인해 다음의 문제가 발생하는 경우가 있다. Failed to open stream:…
Submitted 7 years ago in Configuration, Debugging
5977
0
0
5.1
Laravel 5에서 로깅 설정 변경하기
Illuminate\Foundation\Bootstrap\ConfigureLogging 오버라이딩 bootstrap\ConfigureLogging.php 생성 <?php namespace Bootstrap; use Illuminate\Log\Writer; use Illuminate\Contracts\Foundation\Application; use…
Submitted 8 years ago in Debugging, Configuration
5477
0
0
Lumen에서 daily log 사용하기
Lumen에서는 storage/logs/lumen.log 하나의 파일에 로그가 기록된다. 로그에 대한 설정은 getMonologHandler에서 행해진다. Laravel\Lumen\Application ... /** * Register container bindings for the application. * * @return void */…
Submitted 8 years ago in Configuration, Lumen, Debugging
6152
0
0
스키마 빌더에서 컬럼 주석 사용하기
스키마 작성시 comment 메서드를 사용하면 컬럼에 주석을 달 수 있다. public function up() { Schema::create('posts', function(Blueprint $table) { $table->increments('id')->comment('Unique identifier');…
Submitted 8 years ago in Migration
3513
0
0
로그인한 후 리다이렉트 되는 URL 변경하기
Laravel은 로그인이 성공한 뒤 /home 으로 라다이렉트한다. 이를 다른 URL로 변경하려면 AuthController에 $redirectPath 속성을 추가해서 지정하면 된다. App\Http\Controllers\Auth\AuthController namespace…
Submitted 8 years ago in Security
4117
0
0
5.1
PasswordBroker 오버라이딩하기
비밀번호 리셋에 관련된 로직은 Illuminate\Auth\Passwords\PasswordBroker 클래스에서 수행이 되는데, 이 로직을 변경하고자 한다면 다음의 방법을 사용하면 된다. CustomPassowordBroker 생성…
Submitted 8 years ago in Security
3527
0
0
5.1
blade의 @endsection 과 @stop 의 차이점
@section('content') @stop blade의 섹션을 닫을 때, Laravel 3에서는 @endsection, Laravel 4에서는 @stop으로 바뀐 걸로 알고 있었는데, Laravel 5 예제 소스들에서 @endsection이 보여서 둘 간의 차이점을 찾아봤다.…
Submitted 8 years ago in Views, Template
4072
0
0
Lumen, Laravel 겸용 패키지 만들기
패키지를 개발할 때, Laravel과 Lumen을 동시에 지원하고자 한다면, config 관련해서는 다음의 방법을 사용할 수 있다. class SampleServiceProvider extends ServiceProvider { /** * Bootstrap the application events. * *…
Submitted 8 years ago in Lumen
4393
0
0
최적화 명령어들
최적화 명령어들 php artisan optimize php artisan config:cache php artisan route:cache 최적화 명령어로 생성된 캐시 삭제 명령어들 php artisan clear-compiled php artisan config:clear php artisan route:clear php artisan view:clear…
Submitted 8 years ago in Performance
3784
0
0
특정 라우팅은 HTTPS 만 가능하게 하기
특정 요청은 무조건 https로만 접근하게 하고자 할 때, http로 접속한 경우 https로 리다이렉트 하도록 하기 위해서 다음의 Middleware를 사용하면 된다. app/Http/Middleware/ForceHttps.php <?php namespace…
Submitted 8 years ago in Routing
3636
0
0
URL과 쿼리스트링 구하기
http://example.com/test?foo=bar url() // http://example.com Request::getPathInfo() // /test Request::url() // http://example.com/test Request::fullurl() // http://example.com/test?foo=bar Request::getQueryString() // foo=bar
Submitted 8 years ago in Request and Input
3816
0
0
updated_at 컬럼 사용하지 않기
Laravel Eloquent는 timestamp 컬럼인 created_at, updated_at 에 대해서 자동으로 날짜를 설정하고, 갱신하는 작업을 수행하다. 이 중 created_at 컬럼은 사용하고, updated_at 컬럼은 사용하지 않을 경우에는…
Submitted 8 years ago in Eloquent
3980
0
0
개발 환경과 서비스 환경 쉽게 바꾸기
Laravel 5에서 환경 설정 방법이 변경되서 개발 환경과 서비스 환경을 관리하기가 전 버전보다 귀찮은 것 같다. 그래서, 환경 설정 파일을 변경하는 스크립트를 만들어서 사용하면 좀 편하지…
Submitted 8 years ago in Configuration
4940
0
0
Laravel 5에서 DB 쿼리 로그 남기기
Laravel 5에서는 쿼리 로그가 기본적으로 비활성화 되어 있어서, 이전 버전처럼 바로 DB::getQueryLog()를 하면 빈 배열이 반환된다. 쿼리로그 활성화 DB::enableQueryLog(); 쿼리로그 얻기 $queries =…
Submitted 8 years ago in Queries, Eloquent
6978
0
0