Skip to content

Instantly share code, notes, and snippets.

View corean's full-sized avatar

corean corean

  • connple co., ltd.
  • chuncheon, korea
  • 18:35 (UTC +09:00)
View GitHub Profile
@corean
corean / message.blade.php
Created April 21, 2017 03:56
laravel session errors return $this->validate
@if ($errors->any())
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true" >&times; </button>
@foreach($errors->all() as $error)
<p>{{ $error }}</p>
@endforeach
</div>
@endif
@corean
corean / show.blade.php
Created April 18, 2017 03:45
CRUD중 Delete를 AJAX로 처리
<script>
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{csrf_token()}}'
}
});
$('.btn__delete').on('click', function (e) {
var boardID = '{{ $board->id }}';
var boardUri = '{{ $board->board_uri }}';
@corean
corean / StatController.php
Created April 16, 2017 06:41
(group by)ML_ID별 Y값 갯수, N값 갯수, P값 갯수
$query = Plan::with('movie')
->select(
'ML_ID',
DB::raw('count(ML_ID) as cnt'),
DB::raw("count(if(PLAN_STAT = 'Y',PLAN_STAT, null)) as Y"),
DB::raw("count(if(PLAN_STAT = 'N',PLAN_STAT, null)) as N"),
DB::raw("count(if(PLAN_STAT = 'P',PLAN_STAT, null)) as P")
)
->groupby('ML_ID')
->havingRaw('count(ML_ID)>0 AND ML_ID != ""')
@corean
corean / 0_reuse_code.js
Created April 14, 2017 08:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@corean
corean / daterange.js
Last active April 14, 2017 06:02
날짜관련 daterange picker (jquery)
$('input[name="daterange"]').daterangepicker({
locale: {
format: 'YYYY-MM-DD',
"separator": " ~ ",
"daysOfWeek": ["일","월","화","수","목","금","토"],
"monthNames": ["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]
},
startDate: '{{ \Carbon\Carbon::now()->subMonths(1)->toDateString() }}',
endDate: '{{ \Carbon\Carbon::now()->toDateString() }}'
});