Last active
September 29, 2018 01:47
-
-
Save anytizer/10b98046e2d55bf25677b27b1dd4ee62 to your computer and use it in GitHub Desktop.
Eloquent database without laravel
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
{ | |
"require": { | |
"anytizer/guid.php": "dev-master", | |
"illuminate/database": "^5.7", | |
"illuminate/events": "^5.7", | |
"illuminate/container": "^5.7", | |
"illuminate/contracts": "^5.6", | |
} | |
} |
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
<?php | |
$table = new Table(); | |
$table->id = (new Guid())->NewGuid(); | |
$table->name = $_POST["name"]; | |
$table->email = $_POST["email"]; | |
$table->save(); |
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
<?php | |
use Illuminate\Database\Capsule\Manager; | |
use Illuminate\Database\Eloquent\Model; | |
$manager = new Manager(); | |
$manager->addConnection([ | |
"driver" => "mysql", | |
"host" => "localhost", | |
"database" => "test", | |
"username" => "root", | |
"password" => "", | |
"charset" => "utf8mb4", | |
"collation" => "utf8mb4_unicode_ci", | |
"prefix" => "", | |
]); | |
$manager->setAsGlobal(); | |
$manager->bootEloquent(); |
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
<?php | |
abstract class ORM extends Illuminate\Database\Eloquent\Model | |
{ | |
#public $timestamps = false; | |
protected $hidden = array( | |
"created_at", | |
"updated_at", | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment