Skip to content

Instantly share code, notes, and snippets.

View corean's full-sized avatar

corean corean

  • connple co., ltd.
  • chuncheon, korea
  • 20:04 (UTC +09:00)
View GitHub Profile
@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() }}'
});
@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 / 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 / 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 / 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 / ApplicationsController.php
Created April 21, 2017 04:06
laravel try-catch
try {
//
} catch (\Exception $e) {
return $e->getMessage();
}
@corean
corean / show.blade.php
Created April 21, 2017 05:15
ViewErrorBag in Blade
@php
/** @var \Illuminate\Support\ViewErrorBag $errors */
@endphp
@corean
corean / ApiController.php
Created May 23, 2017 02:34
history - serialize()
$history[Carbon::now()->toDateTimeString()] = [
"title" => "무통장입금 저장",
"application_no" => $application_no,
"discount_id" => $discount_id,
"discount_code" => $discount_code,
"premium_expect" => $premium_expect,
"account_id" => $account_id,
"account_name" => $account_name,
];
@corean
corean / dos
Last active September 4, 2017 00:29
[robocopy]
robocopy h: f: /mir /w:1 r:1 & shurdown -s -f -t 0
@corean
corean / User.php
Last active September 4, 2017 10:09
[Laravel] Laravel Eloquent ORM관련 #PHP #Laravel #ORM #Eloquent
//controller에서 패스워드를 인코딩할 필요없이 모델에서 적용
public function setPasswordAttribute($password)
{
$this->attributes['password'] = bcrypt($password);
}
public function getPasswordAttribute($password)
{
return bcrypt($password);
}