How to check if data exist, if it not exist then redirect to different page.
It keep saying data is exist even it does not exist.
In the model file, I have:
public static function getPackage($id)
{
return Packages::where('id', '=', $id);
}
In the controller:
protected function checkPackage($id)
{
if (!Packages::getPackage($id)->get()) {
Redirect::to('/')
}
}