/** * Display a listing of the resource. * * @return Response */ public function share_index($page = '') { if (Input::get('class')) { $lifes = Article::with('cla')->orderBy('created_at', 'DESC')->where('classify', (int) Input::get('class'))->paginate(10)->setPath('share'); } else { $classify = Classify::where('pid', '=', '2')->lists('id'); $lifes = Article::with('cla')->orderBy('created_at', 'DESC')->whereIn('classify', $classify)->paginate(10)->setPath('share'); } return view('home.life')->withLifes($lifes); }
public function getControlAttribute() { return Classify::where('id', $this->attributes['classify'])->get()[0]->control; }