laravel query if exists code example
Example 1: limit laravel
$posts = Post::all()->limit(10)->get();
Example 2: laravel check record exists
$user = User::where('email', '=', Input::get('email'))->first();
if ($user === null) {
// user doesn't exist
}
Example 3: laravel not in query
DB::table(..)->select(..)->whereNotIn('book_price', [100,200])->get();
Example 4: if notexists in laravel query
if (User::where('email', '=', Input::get('email'))->exists()) {
// user found
}