model query laravel code example
Example 1: laravel eloquent get first
$user = App\User::where('id',$id)->first();
$userId = App\User::where(...)->pluck('id');
Example 2: eloquent first
$user = User::where('mobile', Input::get('mobile'))->get();
if (!$user->isEmpty()){
$firstUser = $user->first()
}
Example 3: laravel model::query
Model::where()->get();
Model::query()->where()->get();
Model::query();
Example 4: create new record via model in laravel
$userData = array('username' => 'Me', 'email' => 'me@yahoo.com');
User::create($userData);