Skip to content

Commit 5b24156

Browse files
committed
first
0 parents  commit 5b24156

File tree

181 files changed

+10290
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+10290
-0
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/vendor
2+
/resources/docs
3+
/public/api
4+
/build/sami/build
5+
/build/sami/cache
6+
/node_modules
7+
composer.phar
8+
composer.lock
9+
.env.*
10+
.DS_Store
11+
Thumbs.db

app/Console/InspireCommand.php

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php namespace App\Console;
2+
3+
use Illuminate\Console\Command;
4+
use Illuminate\Foundation\Inspiring;
5+
use Symfony\Component\Console\Input\InputOption;
6+
use Symfony\Component\Console\Input\InputArgument;
7+
8+
class InspireCommand extends Command {
9+
10+
/**
11+
* The console command name.
12+
*
13+
* @var string
14+
*/
15+
protected $name = 'inspire';
16+
17+
/**
18+
* The console command description.
19+
*
20+
* @var string
21+
*/
22+
protected $description = 'Display an inspiring quote';
23+
24+
/**
25+
* Create a new command instance.
26+
*
27+
* @return void
28+
*/
29+
public function __construct()
30+
{
31+
parent::__construct();
32+
}
33+
34+
/**
35+
* Execute the console command.
36+
*
37+
* @return mixed
38+
*/
39+
public function fire()
40+
{
41+
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
42+
}
43+
44+
}

app/Documentation.php

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php namespace App;
2+
3+
use Illuminate\Contracts\Cache\Cache;
4+
use Illuminate\Contracts\Filesystem\Filesystem;
5+
6+
class Documentation {
7+
8+
/**
9+
* The filesystem implementation.
10+
*
11+
* @var Filesystem
12+
*/
13+
protected $files;
14+
15+
/**
16+
* The cache implementation.
17+
*
18+
* @var Cache
19+
*/
20+
protected $cache;
21+
22+
/**
23+
* Create a new documentation instance.
24+
*
25+
* @param Filesystem $files
26+
* @param Cache $cache
27+
* @return void
28+
*/
29+
public function __construct(Filesystem $files, Cache $cache)
30+
{
31+
$this->files = $files;
32+
$this->cache = $cache;
33+
}
34+
35+
/**
36+
* Get the documentation index page.
37+
*
38+
* @param string $version
39+
* @return string
40+
*/
41+
public function getIndex($version)
42+
{
43+
return $this->cache->remember('docs.'.$version.'.index', 5, function() use ($version) {
44+
return markdown($this->files->get('resources/docs/'.$version.'/documentation.md'));
45+
});
46+
}
47+
48+
/**
49+
* Get the given documentation page.
50+
*
51+
* @param string $version
52+
* @param string $page
53+
* @return string
54+
*/
55+
public function get($version, $page)
56+
{
57+
return $this->cache->remember('docs.'.$version.'.'.$page, 5, function() use ($version, $page) {
58+
return markdown($this->files->get('resources/docs/'.$version.'/'.$page.'.md'));
59+
});
60+
}
61+
62+
}
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php namespace App\Http\Controllers;
2+
3+
use App\Documentation;
4+
use Illuminate\Routing\Controller;
5+
use Illuminate\Contracts\Cache\Cache;
6+
use Illuminate\Contracts\Filesystem\Filesystem;
7+
8+
class DocsController extends Controller {
9+
10+
/**
11+
* The documentation repository.
12+
*
13+
* @var Documentation
14+
*/
15+
protected $docs;
16+
17+
/**
18+
* Create a new controller instance.
19+
*
20+
* @param Documentation $docs
21+
* @return void
22+
*/
23+
public function __construct(Documentation $docs)
24+
{
25+
$this->docs = $docs;
26+
}
27+
28+
/**
29+
* Show the root documentation page (/docs).
30+
*
31+
* @return Response
32+
*/
33+
public function showRootPage()
34+
{
35+
return redirect(url('docs/'.DEFAULT_VERSION));
36+
}
37+
38+
/**
39+
* Show a documentation page.
40+
*
41+
* @return Response
42+
*/
43+
public function show($version, $page = null)
44+
{
45+
if ( ! $this->isVersion($version)) {
46+
return redirect(url('docs/'.DEFAULT_VERSION.'/'.$version));
47+
}
48+
49+
return view('layouts.docs', [
50+
'index' => $this->docs->getIndex($version),
51+
'content' => $this->docs->get($version, $page ?: 'introduction'),
52+
'currentVersion' => $version,
53+
'versions' => $this->getDocVersions(),
54+
]);
55+
}
56+
57+
/**
58+
* Determine if the given URL segment is a valid version.
59+
*
60+
* @param string $version
61+
* @return bool
62+
*/
63+
protected function isVersion($version)
64+
{
65+
return in_array($version, ['dev', '5.0', '4.2', '4.1', '4.0']);
66+
}
67+
68+
/**
69+
* Get the available documentation versions.
70+
*
71+
* @return array
72+
*/
73+
protected function getDocVersions()
74+
{
75+
return [
76+
'master' => 'Dev',
77+
'4.2' => '4.2',
78+
'4.1' => '4.1',
79+
'4.0' => '4.0',
80+
];
81+
}
82+
83+
}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php namespace App\Http\Controllers;
2+
3+
use Illuminate\Routing\Controller;
4+
5+
class HomeController extends Controller {
6+
7+
/*
8+
|--------------------------------------------------------------------------
9+
| Default Home Controller
10+
|--------------------------------------------------------------------------
11+
|
12+
| You may wish to use controllers instead of, or in addition to, Closure
13+
| based routes. That's great! Here is an example controller method to
14+
| get you started. To route to this controller, just add the route:
15+
|
16+
| Route::get('/', 'HomeController@index');
17+
|
18+
*/
19+
20+
public function index()
21+
{
22+
return view('hello');
23+
}
24+
25+
}

app/Http/Filters/AuthFilter.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php namespace App\Http\Filters;
2+
3+
use Illuminate\Http\Request;
4+
use Illuminate\Routing\Route;
5+
use Auth, Redirect, Response;
6+
7+
class AuthFilter {
8+
9+
/**
10+
* Run the request filter.
11+
*
12+
* @param \Illuminate\Routing\Route $route
13+
* @param \Illuminate\Http\Request $request
14+
* @return mixed
15+
*/
16+
public function filter(Route $route, Request $request)
17+
{
18+
if (Auth::guest())
19+
{
20+
if ($request->ajax())
21+
{
22+
return Response::make('Unauthorized', 401);
23+
}
24+
else
25+
{
26+
return Redirect::guest('auth/login');
27+
}
28+
}
29+
}
30+
31+
}

app/Http/Filters/BasicAuthFilter.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php namespace App\Http\Filters;
2+
3+
use Auth;
4+
5+
class BasicAuthFilter {
6+
7+
/**
8+
* Run the request filter.
9+
*
10+
* @return mixed
11+
*/
12+
public function filter()
13+
{
14+
return Auth::basic();
15+
}
16+
17+
}

app/Http/Filters/CsrfFilter.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php namespace App\Http\Filters;
2+
3+
use Session;
4+
use Illuminate\Http\Request;
5+
use Illuminate\Routing\Route;
6+
use Illuminate\Session\TokenMismatchException;
7+
8+
class CsrfFilter {
9+
10+
/**
11+
* Run the request filter.
12+
*
13+
* @param \Illuminate\Routing\Route $route
14+
* @param \Illuminate\Http\Request $request
15+
* @return void
16+
*
17+
* @throws \Illuminate\Session\TokenMismatchException
18+
*/
19+
public function filter(Route $route, Request $request)
20+
{
21+
if (Session::token() != $request->input('_token'))
22+
{
23+
throw new TokenMismatchException;
24+
}
25+
}
26+
27+
}

app/Http/Filters/GuestFilter.php

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php namespace App\Http\Filters;
2+
3+
use Auth, Redirect;
4+
5+
class GuestFilter {
6+
7+
/**
8+
* Run the request filter.
9+
*
10+
* @return mixed
11+
*/
12+
public function filter()
13+
{
14+
if (Auth::check())
15+
{
16+
return Redirect::to('/');
17+
}
18+
}
19+
20+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php namespace App\Http\Filters;
2+
3+
use App, Response;
4+
5+
class MaintenanceFilter {
6+
7+
/**
8+
* Run the request filter.
9+
*
10+
* @return mixed
11+
*/
12+
public function filter()
13+
{
14+
if (App::isDownForMaintenance())
15+
{
16+
return Response::make('Be right back!');
17+
}
18+
}
19+
20+
}

app/Http/Requests/.gitkeep

Whitespace-only changes.

app/Http/routes.php

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Application Routes
6+
|--------------------------------------------------------------------------
7+
|
8+
| Here is where you can register all of the routes for an application.
9+
| It's a breeze. Simply tell Laravel the URIs it should respond to
10+
| and give it the Closure to execute when that URI is requested.
11+
|
12+
*/
13+
14+
/**
15+
* Set the default documentation version...
16+
*/
17+
define('DEFAULT_VERSION', '4.2');
18+
19+
/**
20+
* Convert some text to Markdown...
21+
*/
22+
function markdown($text) {
23+
return (new Parsedown)->text($text);
24+
}
25+
26+
/**
27+
* Root route...
28+
*/
29+
get('/', function() {
30+
return view('index');
31+
});
32+
33+
/**
34+
* Documentation routes...
35+
*/
36+
get('docs', 'DocsController@showRootPage');
37+
get('docs/{version}/{page?}', 'DocsController@show');

0 commit comments

Comments
 (0)