本文整理汇总了PHP中Stat::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Stat::create方法的具体用法?PHP Stat::create怎么用?PHP Stat::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stat
的用法示例。
在下文中一共展示了Stat::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::all();
$validation = Validator::make($input, Stat::$rules);
if ($validation->passes()) {
$this->stat->create($input);
return Redirect::route('stats.index');
}
return Redirect::route('stats.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
}
示例2: postAddBoard
public function postAddBoard()
{
if (Auth::check()) {
$rules = array('hashtag' => 'required|min:3', 'avatar' => 'mimes:jpg,jpeg,png|image|max:1024|image_size:>=300', 'cover' => 'mimes:jpg,jpeg,png|image|max:3072|image_size:>=1200,>=150', 'presentation_cover' => 'mimes:jpg,jpeg,png|image|max:4096|image_size:>=1200,*', 'website_url' => 'url', 'refresh_interval' => 'integer|min:10|max:120', 'refresh_count' => 'integer|min:1|max:100');
$user = Auth::user();
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
$messages = $validator->messages();
return Redirect::to('/konto/tablica/dodaj')->withInput(Input::flash())->withErrors($validator)->with('alert', array('type' => 'error', 'content' => 'Błąd! Sprawdź wszystkie pola.'));
} else {
$data = Input::get('hashtag');
$data = explode(' ', trim($data));
$result = preg_replace('/#([\\w-]+)/i', '$1', $data[0]);
$hashtag = Sanitize::string($result);
$board = Board::create(array('hashtag' => $hashtag, 'description' => Input::get('description'), 'avatar' => Input::file('avatar'), 'cover' => Input::file('cover'), 'presentation_cover' => Input::file('presentation_cover'), 'fb_user' => Input::get('fb_user'), 'tw_user' => Input::get('tw_user'), 'insta_user' => Input::get('insta_user'), 'google_user' => Input::get('google_user'), 'website_url' => Input::get('website_url')));
$fb = Input::has('has_fb') ? 0 : -1;
$insta = Input::has('has_insta') ? 0 : -1;
$tw = Input::has('has_tw') ? 0 : -1;
$google = Input::has('has_google') ? 0 : -1;
$vine = Input::has('has_vine') ? 0 : -1;
$refreshInterval = Input::has('refresh_interval') ? Input::get('refresh_interval') : 30;
$refreshCount = Input::has('refresh_count') ? Input::get('refresh_count') : 2;
$bannedUsers = Input::has('banned_users') ? Input::get('banned_users') : '';
$filter = Input::has('filters') ? Input::get('filters') : '';
$live = Input::has('live') ? 1 : 0;
$presentation = Input::has('presentation') ? 1 : 0;
$color = Input::has('color') ? Input::get('color') : '';
$config = BoardConfig::create(array('board_id' => $board->id, 'user_id' => $user->id, 'has_fb' => $fb, 'has_insta' => $insta, 'has_tw' => $tw, 'has_google' => $google, 'has_vine' => $vine, 'refresh_interval' => $refreshInterval, 'refresh_count' => $refreshCount, 'presentation' => $presentation, 'color' => $color, 'live' => $live, 'banned_users' => $bannedUsers, 'filter' => $filter));
Stat::create(array('board_id' => $board->id));
return Redirect::to('/konto/tablice')->with('alert', array('type' => 'success', 'content' => 'Tablica utworzona!'));
}
}
}