Example #1
0
 public function chitiettintuc($id)
 {
     $brands = $this->brands;
     $socho = $this->sochoxe;
     $tintucs = $this->tintucs;
     $tintuc = TinTuc::where('id', $id)->get()->first();
     $tintuckhac = TinTuc::whereNotIn('id', [$id])->get();
     return view('frontend.pages.chitiettintuc', compact('tintuc', 'tintucs', 'socho', 'brands', 'tintuckhac'));
 }
Example #2
0
 public function destroy($id)
 {
     $tintuc = TinTuc::findOrFail($id);
     $tintuc->delete();
     return redirect()->route('quanlytintuc');
 }
Example #3
0
 public function __construct()
 {
     $this->brands = Brand::all();
     $this->sochoxe = Cars::select('socho_xe')->distinct()->orderBy('socho_xe', 'asc')->get();
     $this->tintucs = TinTuc::select('id', 'tieude', 'noidung')->orderBy('id', 'desc')->take(5)->get();
 }