model->count(); $new = $this->model->whereSeen(0)->count(); return compact('total', 'new'); } /** * Destroy a model. * * @param int $id * @return void */ public function destroy($id) { $this->getById($id)->delete(); } /** * Get Model by id. * * @param int $id * @return App\Models\Model */ public function getById($id) { return $this->model->findOrFail($id); } /** * Get Model by id. * * @param int $id * @return App\Models\Model */ public function getAll() { return $this->model->all(); } /** * @return Illuminate\Database\Eloquent\Model */ public function getModel() { return $this->model; } }