Creating Models In Laravel 5.4

laravel models An Introduction What Model’s are in Laravel. Laravel Models are used to interact with database tables using Eloquent ORM. Generally, all models are kept in app directory of your application, but use is free to place them anywhere in your application directory that can be auto-loaded according to your composer.json file. All ELOQUENT […]

Read More

Explain Laravel Eloquent

Laravel’s Eloquent ORM is one the most popular PHP ORM (OBJECT RELATIONSHIP MAPPING). It provides a beautiful, simple ActiveRecord implementation to work with your database. In Eloquent each database table has the corresponding MODEL that is used to interact with table and perform a database related operation on the table. Sample Model Class in Laravel. […]

Read More

Answered : How to get records between two date in Laravel using eloquent

laravel where date between laravel eloquent between dates We can get records between two dates laravel5 with using Eloquent “whereBetween” method. Here sample function to get posts between two dates from database. public function getPosts(){ $fromDate = date(‘Y-m-d’ . ‘ 00:00:00’, time()); $toDate = date(‘Y-m-d’ . ‘ 22:00:40’, time()); $posts = POST:: where(‘user_id’,$this->user_id)->where(‘status’,1)->whereBetween(‘posted_on’,[$fromDate, $toDate])->get(); return […]

Read More