Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit 456fbb7

Browse files
committed
feat: update underlying libraries
1 parent e489d01 commit 456fbb7

File tree

3 files changed

+26
-64
lines changed

3 files changed

+26
-64
lines changed

app/controllers/Controller.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ public function __construct()
1313
{
1414
parent::__construct();
1515

16-
// In this version, request isn't initialised for you. You can use
17-
// request() to get request data or initialise it yourself
18-
1916
// autoConnect uses the .env variables to quickly connect to db
20-
// Leaf auth will automagically connect to this db instance
21-
// Note that you only need to enable this if you didn't
22-
// already connect to the db in your public/index.php file
23-
// If you did, you can delete this whole block
17+
// Leaf auth will smartly connect to this db connection.
18+
// If you enabled db sync in public/index.php, you can
19+
// delete this line.
2420
db()->autoConnect();
2521

2622
// You can configure auth to get additional customizations

leaf

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env php
22
<?php
3+
34
/*
45
|--------------------------------------------------------------------------
56
| Register The Auto Loader
@@ -13,17 +14,6 @@
1314
*/
1415
require __DIR__ . '/vendor/autoload.php';
1516

16-
/*
17-
|--------------------------------------------------------------------------
18-
| Load MVC Core
19-
|--------------------------------------------------------------------------
20-
|
21-
| MVC core provides Leaf's auto loading, configuration and shortcut
22-
| functions right off the bat.
23-
|
24-
*/
25-
Leaf\Core::paths(PathsConfig());
26-
2717
/*
2818
|--------------------------------------------------------------------------
2919
| Bring in (env)
@@ -40,13 +30,16 @@ try {
4030

4131
/*
4232
|--------------------------------------------------------------------------
43-
| Additional Leaf Database Config
33+
| Load Leaf configuration
4434
|--------------------------------------------------------------------------
4535
|
46-
| Load leaf database configuration
36+
| Leaf MVC allows you to customize Leaf and it's modules using
37+
| configuration files defined in the config folder. This line
38+
| loads the configuration files and makes them available to
39+
| your application.
4740
|
4841
*/
49-
Leaf\Database::config(DatabaseConfig());
42+
Leaf\Core::loadApplicationConfig();
5043
Leaf\Database::connect();
5144

5245
/*
@@ -57,7 +50,7 @@ Leaf\Database::connect();
5750
| Initialise aloe CLI
5851
|
5952
*/
60-
$console = new \Aloe\Console("Leaf API", "v3.0");
53+
$console = new \Aloe\Console("Leaf API", "v3.5.0");
6154

6255
/*
6356
|--------------------------------------------------------------------------

public/index.php

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
| Composer provides a convenient, automatically generated class loader
2020
| for our application. We just need to utilize it! We'll require it
2121
| into the script here so that we do not have to worry about the
22-
| loading of any our classes 'manually'. Feels great to relax.
22+
| loading of any our classes "manually". Feels great to relax.
2323
|
2424
*/
2525
require dirname(__DIR__) . '/vendor/autoload.php';
@@ -38,18 +38,6 @@
3838
trigger_error($th);
3939
}
4040

41-
/*
42-
|--------------------------------------------------------------------------
43-
| Attach blade view
44-
|--------------------------------------------------------------------------
45-
|
46-
| Since blade no longer ships with Leaf by default, we
47-
| can attach blade back to Leaf so you can use Leaf MVC
48-
| as you've always used it.
49-
|
50-
*/
51-
Leaf\View::attach(\Leaf\Blade::class);
52-
5341
/*
5442
|--------------------------------------------------------------------------
5543
| Load application paths
@@ -70,23 +58,28 @@
7058

7159
/*
7260
|--------------------------------------------------------------------------
73-
| Load application paths
61+
| Attach blade view
7462
|--------------------------------------------------------------------------
7563
|
76-
| Tell Leaf MVC Core where to locate application paths
64+
| Since blade no longer ships with Leaf by default, we
65+
| can attach blade back to Leaf so you can use Leaf MVC
66+
| as you've always used it.
7767
|
7868
*/
79-
Leaf\Core::paths(PathsConfig());
69+
Leaf\View::attach(\Leaf\Blade::class);
8070

8171
/*
8272
|--------------------------------------------------------------------------
83-
| Additional Leaf Database Config
73+
| Load Leaf configuration
8474
|--------------------------------------------------------------------------
8575
|
86-
| Load leaf database configuration
76+
| Leaf MVC allows you to customize Leaf and it's modules using
77+
| configuration files defined in the config folder. This line
78+
| loads the configuration files and makes them available to
79+
| your application.
8780
|
8881
*/
89-
Leaf\Database::config(DatabaseConfig());
82+
Leaf\Core::loadApplicationConfig();
9083

9184
/*
9285
|--------------------------------------------------------------------------
@@ -97,33 +90,13 @@
9790
| This allows you to use Leaf Db without having to initialize it
9891
| in your controllers.
9992
|
100-
| This is optional, you can still use Leaf Db in your controllers. If you
101-
| want to opt into this, just uncomment the line below.
93+
| This is optional, you can still use your own Leaf Db connections in
94+
| your controllers. If you want to opt into this,
95+
| just uncomment the line below.
10296
|
10397
*/
10498
// Leaf\Database::syncLeafDb();
10599

106-
/*
107-
|--------------------------------------------------------------------------
108-
| Initialise Config
109-
|--------------------------------------------------------------------------
110-
|
111-
| Pass your application configuration into your leaf app.
112-
|
113-
*/
114-
app()->config(AppConfig());
115-
116-
/*
117-
|--------------------------------------------------------------------------
118-
| Default fix for CORS
119-
|--------------------------------------------------------------------------
120-
|
121-
| This just prevents the connection client from throwing
122-
| CORS errors at you.
123-
|
124-
*/
125-
app()->cors(CorsConfig());
126-
127100
/*
128101
|--------------------------------------------------------------------------
129102
| Route Config

0 commit comments

Comments
 (0)