本文整理汇总了PHP中Website::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Website::where方法的具体用法?PHP Website::where怎么用?PHP Website::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Website
的用法示例。
在下文中一共展示了Website::where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: home
/**
* [home 网站设置]
* @return [type] [description]
*/
public function home()
{
if (IS_POST) {
$data = ['web_title' => I('post.web_title'), 'web_keyword' => I('post.web_keyword'), 'web_desription' => I('post.web_desription'), 'web_footer' => I('post.web_footer')];
Website::where(['id' => 1])->update($data);
View::success('更新成功');
die;
}
$webData = Website::find(1)->toArray();
//print_r($webData);
$this->smarty->assign('webData', $webData);
$this->smarty->assign('title', '网站设置_ISisWeb中文网后台管理_ISirPHPFramework');
$this->smarty->display('Admin/System/home.html');
die;
// $this->view = View::make('/Admin/System/home')
// ->with('webData',$webData)
// ->with('title','网站设置_ISirWeb中文网');
}
示例2: doEditWebsite
public function doEditWebsite($id)
{
$user_id = Auth::user()->id;
$rules = array('title' => 'required', 'type' => 'required', 'account_id' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('/websites/' . $id)->withErrors($validator)->withInput();
} else {
$title = Input::get('title');
$tagline = Input::get('tagline');
$about = Input::get('about');
$type = Input::get('type');
$account_id = Input::get('account_id');
$domain_name = Input::get('domain_name');
$is_public = 0;
if (Input::has('public')) {
$is_public = 1;
}
$website = Website::where('user_id', '=', $user_id)->where('id', '=', $id)->first();
$website->user_id = $user_id;
$website->type = $type;
$website->account_id = $account_id;
$website->domain_name = $domain_name;
$website->title = $title;
$website->tagline = $tagline;
$website->about = $about;
$website->public = $is_public;
$website->save();
return Redirect::to('/websites/' . $id)->with('message', array('type' => 'success', 'text' => 'You have successfully updated the website!'));
}
}
示例3: function
}
});
$app->post('/checkWebsite', function () {
session_start();
session_regenerate_id();
if (isset($_SESSION['userId'])) {
$url = $_POST['url'];
$userId = $_SESSION['userId'];
// Need to check for an active session
$session = Session::where('endTime', "=", null)->where('userId', '=', $userId)->first();
// If there is an active session, grab the environment and websites.
// Compare the url to the urls of the websites.
// If it is blacklisted, update the session accordingly.
if (isset($session) && !empty($session)) {
$environmentId = $session->environmentId;
$websites = Website::where('environmentId', '=', $environmentId)->get();
foreach ($websites as $website) {
$blacklistedUrl = $website->domainName;
if (strpos($url, $blacklistedUrl) !== false) {
$session->blacklistedSitesVisited++;
} else {
$session->nonBlacklistedSitesVisited++;
}
$session->save();
break;
}
$response['success'] = 1;
$response['session'] = $session->toArray();
echo json_encode($response);
} else {
$response['success'] = 0;