Detailed explanation of rare laravel frameworks and laravel frameworks

Source: Internet
Author: User

Detailed explanation of rare laravel frameworks and laravel frameworks
1. whereDate () method

1 $ q-> where ('created _ at', '> =', date ('Y-m-d'). '00:00:00 '));

In the previous data query, the where condition is used to determine the ratio, but the format has strict requirements. If the third parameter of the above Code is date ('Y-m-d ') if you do not add the following 00:00:00, you will not be able to find it in the database.

Determining whether they are equal also imposes strict format requirements.

$ Q-> whereDate ('created _ at', '=', date ('Y-m-d '));

Now the whereDate and laravel methods are used to automatically process the date format and ensure that the date format matches the search format.

$ Q-> whereDay ('created _ at', '=', date ('D'); $ q-> whereMonth ('created _ at', '= ', date ('M'); $ q-> whereYear ('created _ at', '=', date ('y '));

For example, in the above Code, when only a certain number of days is searched, whereDay will be used to search for the matching value of a certain day in the database.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.