Skip to content

Commit 53221dd

Browse files
committed
data accessor, readme
1 parent ce2c761 commit 53221dd

File tree

24 files changed

+90
-72
lines changed

24 files changed

+90
-72
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,23 @@
1515

1616
This is a [Laravel](https://laravel.com) build. If you're not familiar with it, give it a look! There's quite a few folders in this install but below are the only ones to be concerned with.
1717

18+
`data/` - This contains the data for all the methods and configuration that are displayed on the docs page. This also contains the data that tells the docs what pages to render per section.
19+
1820
`resources/` - The views and assets.
1921

2022
      |---`views/` - The view template files.
2123

24+
            |---`documentation/` -This is where the main documentation files live. For each section of the docs, a folder with sub pages lives.
25+
26+
                  |---`methods & configuration` - Each one if these has a `code` folder where, if a file is created, it will be displayed below its definition on the docs page.
27+
2228
      |---`assets/` - The js.
2329

2430
            |---`sass/` -The sass
2531

2632
            |---`js/` -The JS for minor things such as code formatting and the config builder. Not really necessary to edit.
2733

2834
### Linting Your Sass
29-
If you make any changes to the sass you must follow the guidelines in the scsslint.yml. If you're not familiar with this, have a look [here](https://github.com/brigade/scss-lint/blob/master/lib/scss_lint/linter/README.md). Running the `gulp lint-sass` command should have no errors before commiting.
35+
If you make any changes to the sass you must follow the guidelines in the scsslint.yml. If you're not familiar with this, have a look [here](https://github.com/brigade/scss-lint/blob/master/lib/scss_lint/linter/README.md). Please follow the BEM syntax as I am loosley following it. Running the `gulp lint-sass` command should have no errors before commiting.
3036

3137
gulp lint-sass

app/Data/Accessor.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace App\Data;
4+
5+
class Accessor {
6+
7+
public static function dir() {
8+
return base_path('data');
9+
}
10+
11+
public static function fileName ($name) {
12+
return self::dir() . '/' . $name . '.php';
13+
}
14+
15+
public static function get ($key) {
16+
17+
$data = [];
18+
19+
if (!$key) {
20+
return null;
21+
}
22+
23+
if (file_exists(self::fileName($key))) {
24+
$data = require(self::fileName($key)); //collect(json_decode(file(self::fileName($key))))->toArray();
25+
}
26+
27+
return $data;
28+
}
29+
}

app/Helpers/JSONResponse.php

Lines changed: 0 additions & 47 deletions
This file was deleted.

app/Providers/DataServiceProvider.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
7+
class DataServiceProvider extends ServiceProvider
8+
{
9+
/**
10+
* Bootstrap the application services.
11+
*
12+
* @return void
13+
*/
14+
public function boot()
15+
{
16+
//
17+
}
18+
19+
/**
20+
* Register the application services.
21+
*
22+
* @return void
23+
*/
24+
public function register()
25+
{
26+
$this->app->bind('data', 'App\Data\Accessor');
27+
}
28+
}

app/Helpers/Helpers.php renamed to app/helpers.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
22

3+
function data ($key) {
4+
return app('data')::get($key);
5+
}
6+
37
/**
48
* Make a route for the docs from a key and a value
59
*

composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
"psr-4": {
2222
"App\\": "app/"
2323
},
24-
"files": [
25-
"app/Helpers/Helpers.php"
26-
]
24+
"files": ["app/helpers.php"]
2725
},
2826
"autoload-dev": {
2927
"psr-4": {

config/app.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@
180180
App\Providers\EventServiceProvider::class,
181181
App\Providers\RouteServiceProvider::class,
182182

183+
App\Providers\DataServiceProvider::class
184+
183185
],
184186

185187
/*
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)