This file contains hidden or 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
Route.php | |
$app->get('member/{member_id}','MemberController@show'); | |
--------- | |
MemberController.php | |
public function show(Request $request , $member_id) | |
{ | |
$request['member_id'] = $member_id; |
This file contains hidden or 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
class MeetController extends Controller | |
{ | |
public function store() | |
{ | |
$v = Validator::make(request()->all(), Meets::rules()); | |
if($v->fails()) { | |
#return error | |
} | |
This file contains hidden or 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
try { | |
DB::connection('pgsql')->getPdo()->beginTransaction(); | |
DB::connection('pgsql')->getPdo()->commit(); | |
} catch (\PDOException $e) { | |
DB::connection('pgsql')->getPdo()->rollBack(); | |
} |
This file contains hidden or 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
public function youtube_views($url) | |
{ | |
$api_key = "Your_Api_for_youtube"; | |
$count = viewCount //viewCount,likeCount,dislikeCount,favoriteCount,commentCount | |
parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars ); | |
$video_ID = $my_array_of_vars['v']; | |
$url_content = "https://www.googleapis.com/youtube/v3/videos?id={$video_ID}&key={$api_key}&part=statistics"; | |
$ch = curl_init(); |
This file contains hidden or 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
//echo get_chinese_weekday(‘2014-05-26 00:11:12’); | |
public function get_chinese_weekday($datetime) | |
{ | |
$weekday = date('w', strtotime($datetime)); | |
$weeklist = array('日', '一', '二', '三', '四', '五', '六'); | |
return '星期' . $weeklist[$weekday]; | |
} | |
public function get_number_weekday($datetime) |
NewerOlder