This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::get('/', function() | |
{ | |
return 'Hello Laravel!'; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
// 'username' => 'Username', | |
'username' => 'ユーザー名', | |
// 'password' => 'Password', | |
'password' => 'パスワード', | |
// 'password_confirmation' => 'Confirm Password', | |
'password_confirmation' => 'パスワードの確認', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// env == local の場合 noindex, nofollow する | |
HTML::macro('follow', function() { | |
if (App::environment() === 'local') { | |
return PHP_EOL . '<meta name="robots" content="noindex,nofollow" />'; | |
} | |
return ''; | |
}); | |
// 配列を分解して keywords にセット | |
HTML::macro('keywords', function($keywords) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::post('save', function() { | |
$user = new User; | |
$user->username = 'foo'; | |
$user->password = Hash::make('password'); | |
$user->email = '[email protected]'; | |
DB::transaction(function() use ($user) { | |
$user->save(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::before(function($request) | |
{ | |
// POST / PUT / DELETE / PATCH also included You can use the $request-> getRealMethod() | |
if ($request->getMethod() === 'POST') { | |
Route::callRouteFilter('csrf', [], '', $request); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.define :node do |node| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# chkconfig: 345 20 80 | |
# description: Play start/shutdown script | |
# processname: play | |
# | |
# Instalation: | |
# copy file to /etc/init.d | |
# chmod +x /etc/init.d/play | |
# chkconfig --add /etc/init.d/play | |
# chkconfig play on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Response::macro('xml', function(array $vars, $status = 200, array $header = [], $xml = null) | |
{ | |
if (is_null($xml)) { | |
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><response/>'); | |
} | |
foreach ($vars as $key => $value) { | |
if (is_array($value)) { | |
Response::xml($value, $status, $header, $xml->addChild($key)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Carbon のインストール | |
// Composer 使います。使ってない人はそろそろ手を付けたほうがいいですよ | |
// composer.json にこう書いて… | |
// { | |
// "require": { | |
// "nesbot/Carbon": "*" | |
// } | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$clientId = 'xxxxxxxxxxxxxxxxxxxx'; | |
$clientSecret = 'xxxxxxxxxxxxxxxxxxxx'; | |
$topicId = 'xxx'; | |
$msg = 'Hello! typetalk! use PHP API!'; | |
$tokenQuery = http_build_query([ | |
'client_id' => $clientId, |
OlderNewer