Skip to content

Commit ffff4b4

Browse files
committed
Added php syntax highlighting
1 parent c2afb63 commit ffff4b4

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

readme.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ All parts of the project (whether Completed, In Progress or Todo) are subject to
4545

4646
## Initiate connection
4747

48-
48+
```php
4949
DB::factory(array(
50-
'driver' => 'pdo',
51-
'connection_string' => 'mysql:dbname=test;host=127.0.0.1',
52-
'username' => 'root',
53-
'password' => '',
50+
'driver' => 'pdo',
51+
'connection_string' => 'mysql:dbname=test;host=127.0.0.1',
52+
'username' => 'root',
53+
'password' => '',
5454
));
55-
55+
```
5656

5757
## Standard select and consequent update & delete queries
5858

59-
59+
```php
6060
// Execute query to get first row from table
6161
$result = DB::factory()->for_table('test')->find_one();
6262

@@ -70,11 +70,11 @@ All parts of the project (whether Completed, In Progress or Todo) are subject to
7070

7171
// Delete the row
7272
$result->delete();
73-
73+
```
7474

7575
## Select query with ACL
7676

77-
77+
```php
7878
// Define the rules, note that if the select action is not set on the table but IS set on the field then select queries will not work,
7979
// both the table and the fields being used need to have the permission set
8080
$rules = array(
@@ -92,11 +92,11 @@ All parts of the project (whether Completed, In Progress or Todo) are subject to
9292

9393
// So this will fail
9494
$result = DB::factory()->acl()->for_table('test')->find_one();
95-
95+
```
9696

9797
## Insert row
9898

99-
99+
```php
100100
// Execute query to get first row from table
101101
$entry = DB::factory()->for_table('test');
102102

@@ -107,11 +107,11 @@ All parts of the project (whether Completed, In Progress or Todo) are subject to
107107
$entry->save();
108108

109109
$entry->delete();
110-
110+
```
111111

112112
## Select and consequent update & delete queries on multiple entries
113113

114-
114+
```php
115115
// Execute query to get first row from table
116116
$result = DB::factory()->for_table('test')->where_like('name', 'a%')->find_many();
117117

@@ -127,15 +127,16 @@ All parts of the project (whether Completed, In Progress or Todo) are subject to
127127

128128
// Delete rows
129129
$result->delete();
130-
130+
```
131131

132132
## Model usage
133133

134-
134+
```php
135135
class Model_Test extends Model {
136136
protected $table_name = 'test'; // optional, table name can be detected from class name
137137
protected $db_id = 'default'; // redundant, 'default' is already assumed
138138
}
139139

140140
$Test = new Model_Test;
141141
$result = $Test->find_one();
142+
```

0 commit comments

Comments
 (0)