本文整理汇总了PHP中app\Article::getArticle方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::getArticle方法的具体用法?PHP Article::getArticle怎么用?PHP Article::getArticle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Article
的用法示例。
在下文中一共展示了Article::getArticle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxPublish
public function ajaxPublish(Request $request)
{
$id = (int) $request->get('id');
$portal = new Portal();
$portals = $portal->getPortals();
$data = array("portals" => $portals);
if (isset($id) && $id > 0) {
$model = new Article();
$article = $model->getArticle(["id" => $id]);
$data['article'] = $article;
}
return view('ajax/admin/publish', $data)->renderSections();
}
示例2: create
public function create($id)
{
//
$model = new Article();
$article = $model->getArticle(["id" => $id]);
$usrlike = new UserLikeModel();
$islike = $usrlike->islike(['Article_id' => $id, 'User_id' => \Session::get('id')]);
$user_model = new User();
if ($article) {
$user = $user_model->getUser(['id' => $article->Users_id]);
}
return view("article.index", ["article" => $article, 'islike' => $islike, 'author' => $user]);
}
示例3: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
$usrlike = new UserLikeModel();
$user_model = new User();
if ($Uid = \Session::get('id')) {
$user = $user_model->getUser(['id' => $Uid]);
$attributes = ['User_id' => $Uid];
$alllikes = $usrlike->getAll($attributes, ['Article_id']);
$article_model = new Article();
$articles = null;
foreach ($alllikes as $Aid) {
$articles[] = $article_model->getArticle(['id' => $Aid->Article_id]);
}
}
return view("user.create", ['articles' => $articles, 'alllikes' => $alllikes, 'user' => $user]);
}
示例4: index
/**
*
*/
public function index()
{
//\Session::getId();
// echo('<pre>');
// print_r(\Session::getId());
// die();
//MENU
$mainMenu = Category::getParentMenu();
$allMenu = Category::getAllMenu($mainMenu);
//HOT PRODUCTS.
$hotProduct = Product::hotProduct();
//DISCOUNT PRODUCTS.
$discountProduct = Product::discountProduct();
//NEW PRODUCTS.
$newProduct = Product::newProduct();
//ARTICLES
$article = Article::getArticle();
// dd($hotProduct);
return view('index', compact('allMenu', 'newProduct', 'discountProduct', 'hotProduct', 'article'));
// return view("fornindex.detail",compact('allMenu'));
}
示例5: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
$user_like_model = new UserLikeModel();
$article_model = new Article();
$user_model = new User();
$ids = $user_like_model->getAll(['User_id' => $id], ['Article_id']);
$articles = [];
$index = 0;
foreach ($ids->items() as $item) {
$tmp = $article_model->getArticle(['id' => $item->Article_id]);
$articles[$index]['title'] = strip_tags($tmp->title);
$articles[$index]['content'] = strip_tags($tmp->content);
$articles[$index]['author'] = $user_model->getUser(['id' => $tmp->Users_id], ['name'])->name;
$articles[$index]['created_at'] = $tmp->created_at;
$articles[$index]['updated_at'] = $tmp->updated_at;
++$index;
}
$response = [];
$response['s'] = '1';
$response['msg'] = 'okay!';
$response['articles'] = $articles;
die(json_encode($response));
}