本文整理汇总了PHP中Board::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Board::create方法的具体用法?PHP Board::create怎么用?PHP Board::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Board::create([]);
}
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$types = Config::get('poster.board_types');
$rules = array('code' => 'required|alpha_dash', 'type' => 'required|in:' . implode(',', $types));
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Response::json(['success' => false, 'messages' => $validator->errors()]);
}
Board::create(['type' => Input::get('type'), 'code' => Input::get('code'), 'description' => Input::get('description')]);
return Response::json(['success' => true]);
}
示例3: run
public function run()
{
$normal = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'];
$large = ['W', 'X', 'Y', 'Z'];
$stair = ['S'];
foreach ($normal as $code) {
Board::create(array('type' => 'normal', 'code' => $code, 'description' => "一般佈告欄{$code}"));
}
foreach ($large as $code) {
Board::create(array('type' => 'large', 'code' => $code, 'description' => "大掛報{$code}"));
}
foreach ($stair as $code) {
Board::create(array('type' => 'stairs', 'code' => $code, 'description' => "樓梯佈告欄{$code}"));
}
}
示例4: 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!'));
}
}
}
示例5: showBoard
public function showBoard($query, $id = NULL, $presentation = NULL)
{
Asset::add('//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.0.0/isotope.pkgd.min.js', 'footer');
Asset::add('//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js', 'footer');
Asset::add('/js/libs/jquery.dropdown.js', 'footer');
//Asset::add('/js/posts.js', 'footer');
Asset::add('/js/posts-new.js', 'footer');
//check if board exists
if (strlen($query) > 2) {
$query = explode(' ', trim($query));
$result = preg_replace('/#([\\w-]+)/i', '$1', $query[0]);
$query = Sanitize::string($result);
} else {
App::abort(404);
}
if (isset($id)) {
$board = Board::find($id);
if (!is_null($board)) {
if ($board->hashtag != $query || $board->config()->first()->user_id == 0) {
App::abort(404);
}
} else {
App::abort(404);
}
} else {
$board = Board::where('hashtag', '=', $query)->whereHas('config', function ($q) {
$q->where('user_id', '=', 0);
})->first();
if (is_null($board)) {
$board = Board::create(array('hashtag' => $query));
$visit = Visit::create(array('ip' => Request::ip()));
$config = BoardConfig::create(array('board_id' => $board->id));
}
}
if ($board->config()->first()->is_active == 1) {
if (!is_null($board->cover_file_name)) {
$data['layout'] = $this->layout->cover = 'with-cover';
} else {
$data['layout'] = $this->layout->cover = 'no-cover';
}
if (Auth::check()) {
$user = Auth::user();
$data['username'] = preg_replace('/@.*?$/', '', $user->email);
$data['userBoards'] = Board::byUserId($user)->orderBy('created_at', 'asc')->get();
$data['user'] = $user;
if ($user->id == $board->config()->first()->user_id) {
$userOwned = true;
}
if (!is_null($user->provider()->first()) && $user->provider()->first()->provider == 'facebook') {
$data['avatar'] = '<img src="http://graph.facebook.com/' . $user->provider()->first()->provider_id . '/picture?type=small" alt="avatar" />';
}
}
if (Session::get('session-stat') != $board->id) {
$stats = Stat::firstOrCreate(array('board_id' => $board->id))->increment('hits');
Session::put('session-stat', $board->id);
}
$data['board'] = $board;
$data['boardData'] = $this->layout->boardData = $board;
$data['title'] = $this->layout->title = $board->hashtag;
$data['bodyClass'] = $this->layout->bodyClass = $board->hashtag . (isset($userOwned) ? ' user-owned' : '');
if (isset($presentation) && $presentation != 'live') {
App::abort(404);
}
if (isset($id) && $presentation == 'live' && $board->config()->first()->presentation == 1) {
$data['bodyClass'] = $this->layout->bodyClass = $board->hashtag . (isset($userOwned) ? ' user-owned' : '') . ' board-presentation';
$this->layout->content = View::make('boards.board-presentation', $data);
} else {
$this->layout->content = View::make('boards.index', $data);
}
} else {
App::abort(404);
}
}
示例6: header
if ($background == "") {
header("HTTP/1.0 400 Bad Request");
print "Bad url";
exit;
}
$length = 0;
if ($_REQUEST['length'] != "") {
$length = trim($_REQUEST['length']);
}
$width = 0;
if ($_REQUEST['width'] != "") {
$width = trim($_REQUEST['width']);
}
$session = "pets";
///////REPLACE/////////
$board = Board::create($session, $background, $length, $width);
if ($board == null) {
header("HTTP/1.0 500 Server Error");
print "Server couldn't create new board";
exit;
}
header("Content-type: application/json");
print $board->getJSON();
exit;
} else {
header("HTTP/1.0 400 Bad Request");
print "Not valid RESTful url";
exit;
}
}
} else {