Skip to content

Commit 3524da1

Browse files
author
Fredrick Peter
committed
Crucial update, Same usage
1 parent 6d6b3e3 commit 3524da1

21 files changed

+122
-76
lines changed

.env.example

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
APP_NAME="ORM Database"
2+
APP_ENV=local
3+
APP_KEY=base64:gLf20f1FOUlfG/l5-BccCrdZBXy6iEsVZA7nEBtS84zU=
4+
APP_DEBUG=true
5+
SITE_EMAIL=
6+
7+
DB_CONNECTION=mysql
8+
DB_HOST="127.0.0.1"
9+
DB_PORT=3306
10+
DB_USERNAME="root"
11+
DB_PASSWORD=
12+
DB_DATABASE=
13+
14+
DB_CHARSET=utf8mb4
15+
DB_COLLATION=utf8mb4_general_ci
16+
17+
MAIL_MAILER=smtp
18+
MAIL_HOST=
19+
MAIL_PORT=465
20+
MAIL_USERNAME=
21+
MAIL_PASSWORD=
22+
MAIL_ENCRYPTION=tls
23+
MAIL_FROM_ADDRESS="${MAIL_USERNAME}"
24+
MAIL_FROM_NAME="${APP_NAME}"
25+
26+
AWS_ACCESS_KEY_ID=
27+
AWS_SECRET_ACCESS_KEY=
28+
AWS_DEFAULT_REGION=us-east-1
29+
AWS_BUCKET=
30+
AWS_URL=
31+
AWS_USE_PATH_STYLE_ENDPOINT=false
32+
33+
CLOUDINARY_SECRET_KEY=
34+
CLOUDINARY_KEY=
35+
CLOUDINARY_NAME=
36+
CLOUDINARY_URL=
37+
CLOUDINARY_SECURE=false
38+
39+
PUSHER_APP_ID=
40+
PUSHER_APP_KEY=
41+
PUSHER_APP_SECRET=
42+
PUSHER_HOST=
43+
PUSHER_PORT=443
44+
PUSHER_SCHEME=https
45+
PUSHER_APP_CLUSTER=mt1

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,6 @@ class Post extends Model{
12051205
## Useful Links
12061206

12071207
- @author Fredrick Peterson (Tame Developers)
1208+
- If you love this PHP Library, you can [Buy Tame Developers a coffee](https://www.buymeacoffee.com/tamedevelopers)
12081209
- [Lightweight - PHP ORM Database](https://github.com/tamedevelopers/database)
12091210
- [Support - Library](https://github.com/tamedevelopers/support)
1210-
- If you love this PHP Library, you can [Buy Tame Developers a coffee](https://www.buymeacoffee.com/tamedevelopers)
1211-
- Udemy Course on Usage [Coming Soon]()

src/AutoLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ class AutoLoader{
1717
/**
1818
* Star env configuration
1919
*
20-
* @param string $custom_path
20+
* @param string|null $custom_path
2121
* path \Path to .env file
2222
* - [optional] path \By default we use project root path
2323
*
2424
* @return void
2525
*/
26-
public static function start(?string $custom_path = null)
26+
public static function start($custom_path = null)
2727
{
2828
/*
2929
|--------------------------------------------------------------------------

src/Connectors/Connector.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Connector {
3838
* @param mixed $connection \Connection instance
3939
*
4040
*/
41-
public function __construct(?string $name = null, mixed $connection = null)
41+
public function __construct($name = null, mixed $connection = null)
4242
{
4343
$this->setConnectionName($name);
4444
$this->setConnection($connection);
@@ -62,11 +62,11 @@ public function table(string $table)
6262
/**
6363
* Check if table exists
6464
*
65-
* @param string $table
65+
* @param string|null $table
6666
*
6767
* @return bool
6868
*/
69-
public function tableExists(?string $table)
69+
public function tableExists($table)
7070
{
7171
return $this->table('')->tableExists($table);
7272
}
@@ -204,7 +204,6 @@ public function getConfig()
204204
* Get Table Name
205205
* @param string $table
206206
* @param array $data
207-
*
208207
* @return string
209208
*/
210209
private static function compileTableWithPrefix($table = null, ?array $data = null)
@@ -222,11 +221,10 @@ private static function compileTableWithPrefix($table = null, ?array $data = nul
222221
/**
223222
* Get currently selected driver data
224223
*
225-
* @param string $mode
226-
*
224+
* @param string|null $mode
227225
* @return mixed
228226
*/
229-
private function getDataByMode(?string $mode = null)
227+
private function getDataByMode($mode = null)
230228
{
231229
return $this->getConfig()[$mode] ?? null;
232230
}
@@ -247,9 +245,10 @@ private function setConnection($connection = null)
247245
/**
248246
* Set connection connection name
249247
*
248+
* @param string|null $name
250249
* @return void
251250
*/
252-
private function setConnectionName(?string $name = null)
251+
private function setConnectionName($name = null)
253252
{
254253
$this->name = empty($name) ? 'default' : $name;
255254
}

src/Connectors/SQLiteConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class SQLiteConnector
2323
* @var array
2424
*/
2525
protected $options = [
26-
PDO::ATTR_CASE => PDO::CASE_NATURAL,
26+
PDO::ATTR_CASE => PDO::CASE_LOWER,
2727
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
2828
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
2929
PDO::ATTR_STRINGIFY_FETCHES => false,

src/DatabaseConnector.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ protected static function getDriverData($data = null)
3030

3131
/**
3232
* Find Database Driver Name
33-
* @param string $name
33+
* @param string|null $name
3434
* @return string
3535
*/
36-
protected static function getDriverName(?string $name = null)
36+
protected static function getDriverName($name = null)
3737
{
3838
// try to get driver config data
3939
$config = config(
@@ -74,11 +74,11 @@ protected static function createDriverData(?array $options = [])
7474

7575
/**
7676
* Get supported database Driver
77-
* @param string $driver
77+
* @param string|null $driver
7878
*
7979
* @return string|null
8080
*/
81-
public static function findDriver(?string $driver = null)
81+
public static function findDriver($driver = null)
8282
{
8383
// collation get
8484
$driver = Str::lower($driver);
@@ -91,11 +91,11 @@ public static function findDriver(?string $driver = null)
9191

9292
/**
9393
* Get supported database Collation
94-
* @param string $collation
94+
* @param string|null $collation
9595
*
9696
* @return string|null
9797
*/
98-
public static function findCollation(?string $collation = null)
98+
public static function findCollation($collation = null)
9999
{
100100
// collation get
101101
$collation = Str::lower($collation);
@@ -108,11 +108,11 @@ public static function findCollation(?string $collation = null)
108108

109109
/**
110110
* Get supported database Charset
111-
* @param string $charset
111+
* @param string|null $charset
112112
*
113113
* @return string|null
114114
*/
115-
public static function findCharset(?string $charset = null)
115+
public static function findCharset($charset = null)
116116
{
117117
// charset get
118118
$charset = Str::lower($charset);
@@ -150,7 +150,7 @@ private static function supportedCharsets()
150150
*/
151151
private static function supportedCollations()
152152
{
153-
return ['utf8mb4_unicode_ci', 'utf8mb4_general_ci', 'utf8mb4_bin', 'utf8_general_ci', 'utf8_bin', 'latin1_general_ci', 'latin1_bin',];
153+
return ['utf8mb4_unicode_ci', 'utf8mb4_general_ci', 'utf8mb4_bin', 'utf8_general_ci', 'utf8_bin', 'latin1_general_ci', 'latin1_bin'];
154154
}
155155

156156
}

src/DatabaseManager.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class DatabaseManager extends DatabaseConnector {
2121
/**
2222
* Connect to a Database
2323
*
24-
* @param string $name
24+
* @param string|null $name
2525
* - [name] of connections in [config/database.php] file
2626
*
2727
* @param array $default
2828
* [optional] The default value to return if the configuration option is not found
2929
*
3030
* @return $this
3131
*/
32-
public static function connection(?string $name = null, ?array $default = [])
32+
public static function connection($name = null, ?array $default = [])
3333
{
3434
$config = self::driverValidator($name);
3535
if (!FileCache::has($config['key'])) {
@@ -54,12 +54,12 @@ public static function connection(?string $name = null, ?array $default = [])
5454
/**
5555
* Get Connection data
5656
*
57-
* @param string $name
57+
* @param string|null $name
5858
* - [name] of connections\Default name is `default`
5959
*
6060
* @return mixed
6161
*/
62-
public static function getConnection(?string $name = null)
62+
public static function getConnection($name = null)
6363
{
6464
$key = self::getCacheKey($name);
6565
if (FileCache::has($key)) {
@@ -75,7 +75,7 @@ public static function getConnection(?string $name = null)
7575
* @param string|null $name
7676
* @return void
7777
*/
78-
public static function disconnect(?string $name = null)
78+
public static function disconnect($name = null)
7979
{
8080
$name = empty($name) ? 'default' : $name;
8181
$key = self::getCacheKey($name);
@@ -94,7 +94,7 @@ public static function disconnect(?string $name = null)
9494
*
9595
* @return object
9696
*/
97-
public static function reconnect(?string $name = null, mixed $default = null)
97+
public static function reconnect($name = null, mixed $default = null)
9898
{
9999
return self::connection($name, $default);
100100
}
@@ -113,10 +113,10 @@ public static function getCacheKey($name = null)
113113
/**
114114
* get Cache Key name
115115
*
116-
* @param string $name
116+
* @param string|null $name
117117
* @return array
118118
*/
119-
private static function driverValidator(?string $name = null)
119+
private static function driverValidator($name = null)
120120
{
121121
$name = self::getDriverName($name);
122122
return [

src/Dummy/dummyGitIgnore.dum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
/.vscode
55
/.github
66
.gitignore
7+
.env
78
composer.lock

src/Migrations/Blueprint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class Blueprint{
2727
/**
2828
* Creating Managers
2929
*
30-
* @param string $tableName
30+
* @param string|null $tableName
3131
*/
32-
public function __construct(?string $tableName = null)
32+
public function __construct($tableName = null)
3333
{
3434
$this->db = DB::connection();
3535
$this->tableName = $tableName;

src/Migrations/Migration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ public static function getSession()
3030
/**
3131
* Create migration name
3232
* @param string $table_name
33-
* @param string $type
33+
* @param string|null $type
3434
* - optional $jobs\To create dummy Jobs table Data
3535
*
3636
* @return void
3737
*/
38-
public static function create(?string $table_name, ?string $type = null)
38+
public static function create($table_name, $type = null)
3939
{
4040
self::initStatic();
4141

0 commit comments

Comments
 (0)