Exemplo n.º 1
0
 public function frontendIndex(Request $request)
 {
     $page = $request->input('page', 1);
     $limit = 20;
     $offset = ($page - 1) * $limit;
     $result = News::offset($offset)->take($limit)->get();
     $result1 = DB::table('parent_menu')->get();
     $siteTitle = Setting::where('name', 'title')->get();
     if (count($siteTitle) > 0) {
         $bah = $siteTitle->first()->value;
     } else {
         $bah = 'Website';
     }
     $footer = Setting::where('name', 'footer')->get();
     if (count($footer) > 0) {
         $footer = $footer->first()->value;
     } else {
         $footer = '(c) 2015, Ordent, All Right Reserved.';
     }
     $logo = Setting::where('name', 'logo')->get();
     if (count($logo) > 0) {
         $logo = asset('/uploads/logo/') . '/' . $logo->first()->value;
         $logo = preg_replace('/\\s+/', '', $logo);
     } else {
         $logo = '#';
     }
     $count = ceil(count(News::all()) / 20);
     return view('frontend.news-index', compact('result', 'title', 'result1', 'footer', 'count', 'logo'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $news = News::all()->where('status_id', 3);
     return view('front.news.index', compact('news'));
 }
Exemplo n.º 3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return $news = News::all();
     return $news;
 }
Exemplo n.º 4
0
 /**
  * Display a listing of the resource in administration side.
  *
  * @return Response
  */
 public function admin()
 {
     $news = News::all();
     return view('news.backend.index', compact('news'));
 }
Exemplo n.º 5
0
                        <br/><br/>
                            <div class="dataTable_wrapper">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                   <thead>
                                        <tr>
                                            <th>Title</th>
                                            <th width="30%">Category</th>
                                            <th width="10%">Edit</th>
                                            <th width="10%">Delete</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php 
use App\Models\News;
use App\Models\Category;
$news = News::all();
?>
                                         @foreach ($news as $item)
                                            <tr>
                                                <td><?php 
echo $item->nTitle;
?>
</td>
                                                <td><?php 
echo Category::find($item->catId)->catName;
?>
</td>
                                                <td><a href="{{URL::to('news/edit',$item->nId)}}">Edit</a></td>
                                                <td><a href="{{URL::to('deleteNews',$item->nId)}}" onclick="if(!confirm('Are you sure to delete this item?')){return false;};" title="Delete this Item">Delete</a></td>
                                            </tr>
                                        @endforeach