Laravel Where Clause with Mysql Function Example
https://www.itsolutionstuff.com/post/how-to-use-where-clause-with-mysql-function-in-laravel-5example.html
Last updated
https://www.itsolutionstuff.com/post/how-to-use-where-clause-with-mysql-function-in-laravel-5example.html
Last updated
By Hardik Savani March 9, 2016 Category : Laravel MySqlPlayUnmuteLoaded: 1.17%FullscreenWhen you are working on laravel projects and you need to use mysql function in where clause then you can easily use that using DB::raw() and whereRaw(). In this example you can show how to i use mysql function in where clause. In this example i want to compare with year of created_at field but not whole date, that's whay i use mysql function Year(), this function will return only year from timestamp and compare with given value. I add two example of how to use sql function in where cause. let's See both example.
Example 1:
Example 2: