-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. 'Date/year/month/day/time' functions were added.
2. 'Advanced Joins' implemented ( which involves the solution for the #2 issue ) 3. Licence file added 4. Some work on Aliased Tables (on from and joins)
- Loading branch information
1 parent
c680a83
commit ce4ce91
Showing
12 changed files
with
240 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Rexhep Shijaku | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
use RexShijaku\SQLToLaravelBuilder\SQLToLaravelBuilder; | ||
|
||
require_once dirname(__FILE__) . '/../vendor/autoload.php'; | ||
|
||
//========================================================== | ||
$converter = new SQLToLaravelBuilder(); | ||
|
||
$sql = 'SELECT * FROM members WHERE DATE(created_at) = "2021-03-31" '; | ||
echo $converter->convert($sql); | ||
// prints | ||
// DB::table('members') | ||
// ->whereDate('created_at', '=', '2021-03-31') | ||
// ->get(); | ||
|
||
//========================================================== | ||
|
||
$sql = 'SELECT * FROM members WHERE YEAR(created_at) = 1991'; | ||
echo $converter->convert($sql); | ||
// prints | ||
// DB::table('members') | ||
// ->whereYear('created_at', '=', 1991) | ||
// ->get(); | ||
|
||
//========================================================== | ||
|
||
$sql = 'SELECT * FROM members WHERE MONTH(created_at) = 12 '; | ||
echo $converter->convert($sql); | ||
// DB::table('members') | ||
// ->whereMonth('created_at', '=', 12) | ||
// ->get(); | ||
|
||
//========================================================== | ||
|
||
$sql = 'SELECT * FROM members WHERE DAY(created_at) = 15 '; | ||
echo $converter->convert($sql); | ||
// prints | ||
// DB::table('members') | ||
// ->whereDay('created_at', '=', 15) | ||
// ->get(); | ||
|
||
//========================================================== | ||
|
||
$sql = 'SELECT * FROM members WHERE TIME(created_at) = "11:20:45" '; | ||
echo $converter->convert($sql); | ||
// prints | ||
// DB::table('members') | ||
// ->whereTime('created_at', '=', '11:20:45') | ||
// ->get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.