本文整理汇总了PHP中Link::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::find方法的具体用法?PHP Link::find怎么用?PHP Link::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::find方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: countLinks
function countLinks($categoryName)
{
App::import('Model', 'Link');
$link = new Link();
$settings = array('conditions' => array('LinkCategory.name' => $categoryName));
return $link->find('count', $settings);
}
示例2: post_edit
public function post_edit()
{
$link = Link::find(Input::get('id'));
$link->name = Input::get('name');
$product->short_description = Input::get('short_description');
$product->slug = Str::slug(Input::get('name'), '_');
$product->save();
return Redirect::to_action('admin.products@view', array($product->id))->with('flash', true)->with('flash_type', 'success')->with('flash_msg', 'Product updated successfully.');
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$this->link = Link::find($id);
$this->link->fill(Input::all());
if (!$this->link->valid()) {
return Redirect::back()->withInput()->with('errors', $this->link->errors);
} else {
$this->link->update();
return Redirect::route('projects.index');
}
}
示例4: link_update
/**
* [link_update description]
* @param [type] $slug [description]
* @return [type] [description]
*/
public function link_update($slug)
{
if (IS_POST) {
$data = ['name' => I('post.name'), 'url' => I('post.url'), 'is_look' => I('post.is_look')];
Link::where('id', '=', $slug)->update($data);
View::success('修改成功');
die;
}
$link = Link::find($slug)->toArray();
$this->smarty->assign('link', $link);
$this->smarty->assign('title', '修改友情链接_ISisWeb中文网后台管理_ISirPHPFramework');
$this->smarty->display('Admin/System/update_link.html');
// $this->view = View::make('/Admin/System/update_link')
// ->with('link',$link)
// ->with('title','修改友情链接_ISirPHP Framework');
}
示例5: postDelete
/**
* Delete Link
*
* @return Response
*/
public function postDelete()
{
if (!\Auth::check()) {
return \Response::json(array('error' => array('code' => 'NOT-AUTH', 'http_code' => '403', 'message' => 'Forbidden')), 403);
}
if (!\Input::has("linkid")) {
return \Response::json(array('error' => array('code' => 'MISSING-PARAMETERS', 'http_code' => '400', 'message' => 'Bad Request')), 400);
}
$linkID = \Input::get("linkid");
$shortenedLink = \Link::find($linkID);
if (\Auth::user()->id != $shortenedLink->user_id) {
return \Response::json(array('error' => array('code' => 'NOT-AUTH', 'http_code' => '403', 'message' => 'Forbidden')), 403);
}
$shortenedLink->delete();
if (\Auth::user()->quota_used - 1 >= 0) {
\Auth::user()->quota_used -= 1;
\Auth::user()->save();
}
return \Response::json(array('ok' => array('code' => 'LINK-DELETED', 'http_code' => '200', 'message' => 'OK')), 200);
}
示例6: getCategoryLink
public function getCategoryLink($id)
{
$link = Link::find($id);
if (isset($link->gov_id)) {
$this->breadcrumbs->push('หมวดหมู่', URL::to('/categories'));
$this->breadcrumbs->push($link->MiddleCategories->name, URL::to('/category/' . $link->MiddleCategories->id . '/new'));
$this->breadcrumbs->push($link->name, URL::to('/category/link/' . $link->Gov->id . '/show'));
$this->breadcrumbs->generate();
return View::make('home.category_link')->with('link', $link);
} else {
App::abort(404);
}
}
示例7: updateLink
public function updateLink()
{
$id = Input::get('id');
$fieldname = Input::get('field');
$value = Input::get('value');
$link = Link::find($id);
$link->{$fieldname} = $value;
$link->save();
return $this->success(null, null);
}
示例8: deleteLink
public function deleteLink()
{
$link_id = Input::get('link_id');
$link = Link::find($link_id);
if (!$link->delete()) {
return Response::json(array('errCode' => '1', 'message' => '删除失败!'));
}
return Response::json(array('errCode' => 0, 'message' => '删除成功!'));
}
示例9: getShowLink
public function getShowLink($id)
{
$link = Link::find($id);
if (isset($link->gov_id)) {
$gov = Gov::findOrFail($link->gov_id);
$gov = $gov->name;
} else {
$gov = "ไม่ได้กำหนดหน่วยงาน";
}
$columns = Schema::getColumnListing('links');
return View::make('admin.show_link')->with('link', $link)->with('columns', $columns)->with('govName', $gov);
}