本文整理匯總了PHP中News::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::all方法的具體用法?PHP News::all怎麽用?PHP News::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類News
的用法示例。
在下文中一共展示了News::all方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getIndex
public function getIndex()
{
if (Input::get('_request', 'http') == "http") {
$this->layout->body = View::make('page.all_news');
} elseif (Input::get('_request', 'http') == "ajax") {
return News::all()->toJson();
}
}
示例2: index
public function index()
{
$news = News::all();
return View::make('admin.pages.news.index')->with(['news' => $news]);
}
示例3: deleteNewsInfo
public function deleteNewsInfo()
{
$id = Input::get('id');
$deleteReserveInfo = News::find($id);
if ($deleteReserveInfo->delete()) {
$allNews = News::all();
foreach ($allNews as $allNew) {
$response[] = array("ban_id" => $allNew['id'], "ban_title" => $allNew['title'], "ban_content" => $allNew['content']);
}
}
return $response;
}
示例4: saveItem
//.........這裏部分代碼省略.........
if ($cat_id == 2) {
//通知編輯
$item->title = $title;
$item->content = $content;
$item->save();
return Redirect::to(URL::to('/notice-detail', [$item_id]));
} else {
if ($cat_id == 3) {
//課程編輯
$item->course_name = $course_name;
$item->course_info = $course_info;
$item->teacher_address = $teacher_address;
$item->teacher_mail = $teacher_mail;
$item->TA_name = $TA_name;
$item->TA_address = $TA_address;
$item->TA_mail = $TA_mail;
$item->save();
$course_notices_add_count = Input::get('course_notice_add_count');
if ($course_notices_add_count) {
//增加新的通知
for ($i = 1; $i <= $course_notices_add_count; $i++) {
$add_or_not = Input::get('course_notice_add_or_not' . $i);
if (!$add_or_not) {
$notice = new Comments();
$notice->course_id = $item_id;
$notice->comment = Input::get('course_notice_add_content' . $i);
$notice->created_at = date("Y-m-d H:i:s");
$notice->updated_at = date("Y-m-d H:i:s");
$notice->save();
}
}
}
$homework_add_count = Input::get('homework_add_count');
if ($homework_add_count) {
//當添加了新的作業,將其添加到homework數據庫中
for ($i = 1; $i <= $homework_add_count; $i++) {
$add_or_not = Input::get('homework_add_or_not' . $i);
if (!$add_or_not) {
$homework = new Homework();
$homework->course_id = $item_id;
$homework->homework_item = Input::get('homework_add_item' . $i);
$homework->submit_deadline = Input::get('homework_add_submit_time' . $i);
$homework->deliver_deadline = Input::get('homework_add_deliver_time' . $i);
$homework->created_at = date("Y-m-d H:i:s");
$homework->updated_at = date("Y-m-d H:i:s");
$homework->save();
}
}
}
$courseware_add_count = Input::get('courseware_add_count');
if ($courseware_add_count) {
//當添加了新的課件,將其添加到courseware表中
for ($i = 1; $i <= $courseware_add_count; $i++) {
$courseware = new Courseware();
$courseware->course_id = $item_id;
$courseware->label = Input::get('courseware_add_label' . $i);
//先將課件上傳到數據庫中
$file_source = 'courseware_add_source' . $i;
$courseware->source = HomeController::upload_course($item_id, $file_source);
$courseware->created_at = date("Y-m-d H:i:s");
$courseware->updated_at = date("Y-m-d H:i:s");
$courseware->save();
}
}
return Redirect::to(URL::to('/course', [$item_id]));
}
}
}
}
} else {
//對已有條目進行更新
if ($cat_id == 0) {
//新聞條目
News::insert(['title' => $title, 'abstract' => $abstract, 'content' => $content]);
$item = News::all()->last();
return Redirect::to(URL::to('/news-detail', [$item->id]));
} else {
if ($cat_id == 1) {
//項目條目
Researches::insert(['title' => $title, 'abstract' => $abstract, 'content' => $content, 'begin_time' => $begin_time, 'end_time' => $end_time]);
$item = Researches::all()->last();
return Redirect::to(URL::to('/research-detail', [$item->id]));
} else {
if ($cat_id == 2) {
//通知編輯
Notices::insert(['title' => $title, 'content' => $content]);
$item = Notices::all()->last();
return Redirect::to(URL::to('/notice-detail', [$item->id]));
} else {
if ($cat_id == 3) {
Courses::insert(['course_name' => $course_name, 'course_info' => $course_info, 'teacher_address' => $teacher_address, 'TA_name' => $TA_name, 'TA_address' => $TA_address]);
$item = Courses::all()->last();
return Redirect::to(URL::to('/course', [$item->id]));
}
}
}
}
}
//return View::make('/news-detail',[$item_id]);
}
示例5:
</div>
<div class="input-group">
<span class="input-group-addon" id="basic-addon1">Content</span>
<input type="text" class="form-control" id= "content" name= "content" placeholder="content" aria-describedby="basic-addon1">
</div>
<button type="submit" id="saveInfo" class="btn btn-info">Save Information</button>
<button type="button" id="updateInfo"class="btn btn-warning">Update Information</button>
</div>
<div class="col-md-8">
<div class="list-group">
<a href="#" class="list-group-item active">
News
</a>
<div id="guest_list">
<?php
$allNews = News::all();
?>
@if(!empty($allNews))
@foreach($allNews as $allNew)
<div class="input-group" id="reserve{{$allNew['id']}}">
<a href="javascript:void(0)" class="list-group-item">{{$allNew['title']}}</a>
<span class="input-group-addon" data-type="edit" data-id="{{$allNew['id']}}" style="cursor:pointer">Edit</span>
<span class="input-group-addon" data-type="delete" data-id="{{$allNew['id']}}" style="cursor:pointer">Delete</span>
</div>
@endforeach
@endif
<div>
</div>
</div>
</div>
</div>
示例6: showAll
public function showAll()
{
$news = News::all();
return View::make('news.show-all')->with('news', $news)->with('page_title', 'News');
}
示例7: rss
/**
* RSS лента
*/
public function rss()
{
$news_list = News::all(['limit' => 15, 'order' => 'created_at desc', 'include' => ['user']]);
header("Content-type:application/rss+xml; charset=utf-8");
App::view('news.rss', compact('news_list'));
}
示例8:
@include('layout.master')
<div class="container" style="margin-top:80px;text-align:center">
<h1>FPP News</h1>
<?php
$news = News::all();
foreach ($news as $article) {
?>
<div class="panel panel-default" style="margin-top:40px;">
<div class="panel-heading">
<h3 class="panel-title">{{$article->title}}</h3>
</div>
<div class="panel-body">
{{ str_limit($article->content, $limit = 300, $end = '...') }}
@if(strlen($article->content) > 300)<br><br><a href="/news/{{$article->slug}}">Read More</a>@endif
</div>
</div>
<?php
}
?>
</div>
@include('layout.footer')
示例9: index
/**
* Display a listing of news
*
* @return Response
*/
public function index()
{
$news = News::all();
return View::make('news.index', compact('news'));
}
示例10: list_news
/**
* Display the list of the news
*
* @return Response
*/
public function list_news()
{
$news = News::all();
return View::make('admin.news', ['news' => $news]);
}
示例11: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$message = Session::get('message');
$news = News::all();
return View::make('news', ['news' => $news, 'message' => $message]);
}