├── .bowerrc
├── .coveralls.yml
├── .env.example
├── .gitattributes
├── .gitignore
├── .scrutinizer.yml
├── .travis.yml
├── README.md
├── app
├── Commands
│ ├── Command.php
│ └── MarkdownCommand.php
├── Console
│ ├── Commands
│ │ └── .gitkeep
│ └── Kernel.php
├── Events
│ ├── Event.php
│ └── ToDoEvent.php
├── Exceptions
│ └── Handler.php
├── Handlers
│ ├── Commands
│ │ └── .gitkeep
│ └── Events
│ │ └── .gitkeep
├── Http
│ ├── Controllers
│ │ ├── Api
│ │ │ ├── MarkdownController.php
│ │ │ └── ToDoController.php
│ │ ├── Controller.php
│ │ ├── HomeController.php
│ │ ├── MarkdownController.php
│ │ ├── Old
│ │ │ └── LegacyController.php
│ │ └── ToDoController.php
│ ├── Kernel.php
│ ├── Middleware
│ │ ├── Authenticate.php
│ │ ├── RedirectIfAuthenticated.php
│ │ └── VerifyCsrfToken.php
│ ├── Requests
│ │ ├── LegacyFormRequest.php
│ │ ├── MarkdownRequest.php
│ │ ├── Request.php
│ │ └── ToDoRequest.php
│ └── routes.php
├── Providers
│ ├── AppServiceProvider.php
│ ├── BusServiceProvider.php
│ ├── ConfigServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
├── Renders
│ └── XsrfTokenComposer.php
├── Repositories
│ ├── .gitkeep
│ ├── MarkdownRepository.php
│ ├── MarkdownRepositoryInterface.php
│ ├── ToDoRepository.php
│ └── ToDoRepositoryInterface.php
└── Services
│ └── .gitkeep
├── artisan
├── bootstrap
├── app.php
└── autoload.php
├── bower.json
├── build
└── logs
│ └── .gitignore
├── composer.json
├── composer.lock
├── config
├── app.php
├── auth.php
├── cache.php
├── compile.php
├── database.php
├── filesystems.php
├── mail.php
├── queue.php
├── sample.php
├── services.php
├── session.php
└── view.php
├── database
├── .gitignore
├── migrations
│ ├── .gitkeep
│ ├── 2014_10_12_000000_create_users_table.php
│ └── 2014_10_12_100000_create_password_resets_table.php
└── seeds
│ ├── .gitkeep
│ └── DatabaseSeeder.php
├── gulpfile.js
├── package.json
├── phpspec.yml
├── phpunit.xml
├── public
├── .htaccess
├── assets
│ ├── css
│ │ ├── bootstrap-theme.min.css
│ │ ├── bootstrap.min.css
│ │ ├── github.css
│ │ ├── material-wfont.min.css
│ │ ├── material.min.css
│ │ └── ripples.min.css
│ ├── fonts
│ │ ├── Material-Design-Icons.eot
│ │ ├── Material-Design-Icons.svg
│ │ ├── Material-Design-Icons.ttf
│ │ ├── Material-Design-Icons.woff
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ ├── glyphicons-halflings-regular.woff
│ │ └── glyphicons-halflings-regular.woff2
│ └── js
│ │ ├── Showdown.min.js
│ │ ├── bootstrap.min.js
│ │ ├── github.min.js
│ │ ├── highlight.pack.js
│ │ ├── jquery.min.js
│ │ ├── material.min.js
│ │ ├── prettify.min.js
│ │ ├── react-with-addons.min.js
│ │ ├── react.min.js
│ │ ├── ripples.min.js
│ │ ├── sizzle.min.js
│ │ ├── table.min.js
│ │ └── twitter.min.js
├── css
│ └── app.css
├── favicon.ico
├── index.php
├── js
│ ├── markdown.js
│ └── todo.js
└── robots.txt
├── resources
├── js
│ └── react
│ │ ├── markdown.jsx
│ │ └── todo.jsx
├── lang
│ └── en
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
└── views
│ ├── elements
│ ├── footer.blade.php
│ └── header.blade.php
│ ├── errors
│ └── 503.blade.php
│ ├── home
│ └── index.blade.php
│ ├── layouts
│ └── default.blade.php
│ ├── legacy
│ └── old
│ │ ├── apply.blade.php
│ │ ├── confirm.blade.php
│ │ └── form.blade.php
│ ├── markdown
│ └── index.blade.php
│ └── todo
│ └── index.blade.php
├── server.php
├── storage
├── .gitignore
├── app
│ └── markdown
│ │ ├── .gitignore
│ │ └── markdown.md
├── framework
│ ├── .gitignore
│ ├── cache
│ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
└── tests
├── Commands
└── MarkdwonCommandTest.php
├── ControllersTest.php
├── Events
└── ToDoEventTest.php
├── ExampleTest.php
├── ExceptionHandlerTest.php
├── Renders
└── XsrfTokenComposerTest.php
├── TestCase.php
├── ToDoRepositoryTest.php
└── resources
└── testing.md
/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "vendor/bower_components"
3 | }
--------------------------------------------------------------------------------
/.coveralls.yml:
--------------------------------------------------------------------------------
1 | src_dir: ./
2 | coverage_clover: build/logs/clover.xml
3 | json_path: build/logs/coveralls-upload.json
4 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | APP_ENV=local
2 | APP_DEBUG=true
3 | APP_KEY=SomeRandomString
4 |
5 | DB_HOST=localhost
6 | DB_DATABASE=homestead
7 | DB_USERNAME=homestead
8 | DB_PASSWORD=secret
9 |
10 | CACHE_DRIVER=file
11 | SESSION_DRIVER=file
12 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | .env
3 | .idea
4 | /node_modules
5 | /resources/assets
6 | _ide_helper.php
7 |
8 |
--------------------------------------------------------------------------------
/.scrutinizer.yml:
--------------------------------------------------------------------------------
1 | tools:
2 | external_code_coverage: false
3 | checks:
4 | php:
5 | code_rating: true
6 | duplication: true
7 | filter:
8 | excluded_paths:
9 | - tests/*
10 | - spec/*
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | php:
3 | - 5.4
4 | - 5.5
5 | - 5.6
6 | - hhvm
7 | before_script:
8 | - composer self-update
9 | - composer install
10 | - chmod -R 777 storage
11 | script:
12 | - mkdir -p build/logs
13 | - chmod -R 777 build/logs
14 | - chmod -R 777 tests/resources
15 | - phpunit
16 | after_script:
17 | - php vendor/bin/coveralls -v
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Laravel5.BasicArchitecture
2 | [](https://travis-ci.org/ytake/Laravel5.BasicArchitecture)
3 | [](https://coveralls.io/r/ytake/Laravel5.BasicArchitecture?branch=develop-basic)
4 | [](https://scrutinizer-ci.com/g/ytake/Laravel5.BasicArchitecture/?branch=develop-basic)
5 | 
6 | [](https://www.versioneye.com/user/projects/54b7d9e605064657eb0001e5)
7 | [](https://www.versioneye.com/user/projects/54b7d9e4050646ca5c0001dd)
8 | [](https://www.versioneye.com/user/projects/54b7da2405064657eb00023d)
9 |
10 | [](https://insight.sensiolabs.com/projects/d189ea77-de47-4869-8889-b7ac8ccd879a)
11 |
12 | ## Samples
13 |
14 | ### ToDo Application
15 | Session Store / Events / laravel-elixir / React.js
16 |
17 | ### Realtime Markdown Editor
18 | Filesystem / CommandBus / laravel-elixir / React.js
19 |
20 | ### Simple Form
21 | form Request / Legacy Controller & no namespace (by classmap)
22 |
23 |
--------------------------------------------------------------------------------
/app/Commands/Command.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class MarkdownCommand extends Command implements SelfHandling
13 | {
14 |
15 | /** @var string */
16 | protected $markdown;
17 |
18 | /**
19 | * @param $markdown
20 | */
21 | public function __construct($markdown)
22 | {
23 | $this->markdown = $markdown;
24 | }
25 |
26 | /**
27 | * @param MarkdownRepositoryInterface $markdown
28 | */
29 | public function handle(MarkdownRepositoryInterface $markdown)
30 | {
31 | $markdown->put($this->markdown);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/app/Console/Commands/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ytake/Laravel5.BasicArchitecture/be0fe708dee0a7c6b3e0667f604b9ceacafae978/app/Console/Commands/.gitkeep
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class ToDoEvent extends Event
13 | {
14 |
15 | /** @var Log */
16 | protected $log;
17 |
18 | /**
19 | * @param Log $log
20 | */
21 | public function __construct(Log $log)
22 | {
23 | $this->log = $log;
24 | }
25 |
26 | /**
27 | * @return void
28 | */
29 | public function handle()
30 | {
31 | $this->log->useFiles(storage_path('logs/todo.log'));
32 | $this->log->info("added new Task", ["created" => Carbon::now()->getTimestamp()]);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class Handler extends ExceptionHandler
13 | {
14 |
15 | /**
16 | * A list of the exception types that should not be reported.
17 | *
18 | * @var array
19 | */
20 | protected $dontReport = [
21 | 'Symfony\Component\HttpKernel\Exception\HttpException'
22 | ];
23 |
24 | /**
25 | * Report or log an exception.
26 | *
27 | * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
28 | *
29 | * @param \Exception $e
30 | * @return void
31 | */
32 | public function report(Exception $e)
33 | {
34 | parent::report($e);
35 | }
36 |
37 | /**
38 | * Render an exception into an HTTP response.
39 | *
40 | * @param \Illuminate\Http\Request $request
41 | * @param \Exception $e
42 | * @return \Illuminate\Http\Response
43 | */
44 | public function render($request, Exception $e)
45 | {
46 | if ($this->isHttpException($e)) {
47 | return $this->renderHttpException($e);
48 | }
49 | if($e instanceof \Illuminate\Session\TokenMismatchException) {
50 | if($request->ajax()) {
51 | return \Response::json(["error" => $e->getMessage()], 500);
52 | }
53 | return redirect("/");
54 | }
55 | return parent::render($request, $e);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/Handlers/Commands/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ytake/Laravel5.BasicArchitecture/be0fe708dee0a7c6b3e0667f604b9ceacafae978/app/Handlers/Commands/.gitkeep
--------------------------------------------------------------------------------
/app/Handlers/Events/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ytake/Laravel5.BasicArchitecture/be0fe708dee0a7c6b3e0667f604b9ceacafae978/app/Handlers/Events/.gitkeep
--------------------------------------------------------------------------------
/app/Http/Controllers/Api/MarkdownController.php:
--------------------------------------------------------------------------------
1 |
13 | */
14 | class MarkdownController extends Controller
15 | {
16 |
17 | use DispatchesCommands;
18 |
19 | /** @var MarkdownRepositoryInterface */
20 | protected $markdown;
21 |
22 | /**
23 | * @param MarkdownRepositoryInterface $markdown
24 | */
25 | public function __construct(MarkdownRepositoryInterface $markdown)
26 | {
27 | $this->markdown = $markdown;
28 | }
29 |
30 | /**
31 | * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
32 | */
33 | public function index()
34 | {
35 | return response(["markdown" => $this->markdown->read()]);
36 | }
37 |
38 | /**
39 | * @param MarkdownRequest $request
40 | * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
41 | */
42 | public function store(MarkdownRequest $request)
43 | {
44 | $this->dispatchFrom("App\Commands\MarkdownCommand", $request);
45 | return response(["markdown" => $request->markdown]);
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Api/ToDoController.php:
--------------------------------------------------------------------------------
1 |
13 | */
14 | class ToDoController extends Controller
15 | {
16 |
17 | /** @var TodoRepositoryInterface */
18 | protected $todo;
19 |
20 | /**
21 | * @param TodoRepositoryInterface $todo
22 | */
23 | public function __construct(TodoRepositoryInterface $todo)
24 | {
25 | $this->todo = $todo;
26 | }
27 |
28 | /**
29 | * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
30 | */
31 | public function index()
32 | {
33 | return response($this->todo->all());
34 | }
35 |
36 | /**
37 | * @param ToDoRequest $request
38 | * @param Dispatcher $dispatcher
39 | * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
40 | */
41 | public function store(ToDoRequest $request, Dispatcher $dispatcher)
42 | {
43 | $this->todo->store($request->get("title"));
44 | $dispatcher->fire('todo.add');
45 | return response($this->todo->all());
46 | }
47 |
48 | /**
49 | * @param $id
50 | * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
51 | */
52 | public function destroy($id)
53 | {
54 | $this->todo->remove($id);
55 | return response($this->todo->all());
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 | class MarkdownController extends Controller
10 | {
11 |
12 | /**
13 | * @return \Illuminate\View\View
14 | */
15 | public function index()
16 | {
17 | return view('markdown.index');
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Old/LegacyController.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class LegacyController extends \App\Http\Controllers\Controller
12 | {
13 |
14 | /**
15 | * @return \Illuminate\View\View
16 | */
17 | public function getForm()
18 | {
19 | return view('legacy.old.form');
20 | }
21 |
22 | /**
23 | * フォームリクエストと、これまでのViewファサードを利用した例
24 | *
25 | * @param \App\Http\Requests\LegacyFormRequest $request
26 | * @return \Illuminate\View\View
27 | */
28 | public function postConfirm(\App\Http\Requests\LegacyFormRequest $request)
29 | {
30 | // global function
31 | return View::make('legacy.old.confirm');
32 | }
33 |
34 | /**
35 | * Requestクラスをメソッドインジェクションで利用せずに、
36 | * 従来のInputファサードを利用する例
37 | * @param \Illuminate\Http\Request $request
38 | * @return $this
39 | */
40 | public function postApply(\Illuminate\Http\Request $request)
41 | {
42 | if(!is_null($request->_return)) {
43 | return \Redirect::route('legacy.form')->withInput();
44 | }
45 | $request = Input::only('name', 'email');
46 | // 同様にnamespaceを利用せずにEloquentなどを利用することができます
47 | Session::forget('_token');
48 | return view('legacy.old.apply')->with('request', $request);
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/app/Http/Controllers/ToDoController.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 | class ToDoController extends Controller
10 | {
11 |
12 | /**
13 | * @return \Illuminate\View\View
14 | */
15 | public function index()
16 | {
17 | return view('todo.index');
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class Kernel extends HttpKernel
12 | {
13 |
14 | /**
15 | * The application's global HTTP middleware stack.
16 | *
17 | * @var array
18 | */
19 | protected $middleware = [
20 | 'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
21 | 'Illuminate\Cookie\Middleware\EncryptCookies',
22 | 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
23 | 'Illuminate\Session\Middleware\StartSession',
24 | 'Illuminate\View\Middleware\ShareErrorsFromSession',
25 | 'App\Http\Middleware\VerifyCsrfToken',
26 | ];
27 |
28 | /**
29 | * The application's route middleware.
30 | *
31 | * @var array
32 | */
33 | protected $routeMiddleware = [
34 | 'auth' => 'App\Http\Middleware\Authenticate',
35 | 'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
36 | 'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
37 | ];
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | auth = $auth;
24 | }
25 |
26 | /**
27 | * Handle an incoming request.
28 | *
29 | * @param \Illuminate\Http\Request $request
30 | * @param \Closure $next
31 | * @return mixed
32 | */
33 | public function handle($request, Closure $next)
34 | {
35 | if ($this->auth->guest())
36 | {
37 | if ($request->ajax())
38 | {
39 | return response('Unauthorized.', 401);
40 | }
41 | else
42 | {
43 | return redirect()->guest('auth/login');
44 | }
45 | }
46 |
47 | return $next($request);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/app/Http/Middleware/RedirectIfAuthenticated.php:
--------------------------------------------------------------------------------
1 | auth = $auth;
25 | }
26 |
27 | /**
28 | * Handle an incoming request.
29 | *
30 | * @param \Illuminate\Http\Request $request
31 | * @param \Closure $next
32 | * @return mixed
33 | */
34 | public function handle($request, Closure $next)
35 | {
36 | if ($this->auth->check())
37 | {
38 | return new RedirectResponse(url('/home'));
39 | }
40 |
41 | return $next($request);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class VerifyCsrfToken extends BaseVerifier
13 | {
14 |
15 | /**
16 | * Handle an incoming request.
17 | *
18 | * @param \Illuminate\Http\Request $request
19 | * @param \Closure $next
20 | * @return mixed
21 | */
22 | public function handle($request, Closure $next)
23 | {
24 | return parent::handle($request, $next);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/Http/Requests/LegacyFormRequest.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 | class LegacyFormRequest extends Request
10 | {
11 |
12 | /** @var string */
13 | protected $redirectRoute = "legacy.form";
14 |
15 | /**
16 | * @return array
17 | */
18 | public function rules()
19 | {
20 | return [
21 | "name" => "required",
22 | "email" => "required|email"
23 | ];
24 | }
25 |
26 | /**
27 | * @return bool
28 | */
29 | public function authorize()
30 | {
31 | return true;
32 | }
33 |
34 | /**
35 | * custom error message
36 | * @return array
37 | */
38 | public function messages()
39 | {
40 | return [
41 | "name.required" => "名前を入力してください",
42 | "email.required" => "メールアドレスを入力してください",
43 | "email.email" => "メールアドレスを正しく入力してください",
44 | ];
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/app/Http/Requests/MarkdownRequest.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class MarkdownRequest extends Request
12 | {
13 |
14 | /**
15 | * @return array
16 | */
17 | public function rules()
18 | {
19 | return [
20 | "markdown" => "required"
21 | ];
22 | }
23 |
24 | /**
25 | * @return bool
26 | */
27 | public function authorize()
28 | {
29 | return true;
30 | }
31 |
32 | /**
33 | * @param array $errors
34 | * @return JsonResponse
35 | */
36 | public function response(array $errors)
37 | {
38 | return new JsonResponse($errors, 403);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/app/Http/Requests/Request.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 | class ToDoRequest extends Request
10 | {
11 |
12 | /**
13 | * @return array
14 | */
15 | public function rules()
16 | {
17 | return [
18 | "title" => "required"
19 | ];
20 | }
21 |
22 | /**
23 | * @return bool
24 | */
25 | public function authorize()
26 | {
27 | return true;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/Http/routes.php:
--------------------------------------------------------------------------------
1 | controller("legacy", "LegacyController", [
4 | "getForm" => 'legacy.form',
5 | "postConfirm" => 'legacy.confirm',
6 | "postApply" => 'legacy.apply'
7 | ]);
8 | $router->group(["namespace" => "App\Http\Controllers"], function ($router) {
9 | $router->get('', ['uses' => "HomeController@index", 'as' => 'index']);
10 | $router->get("todo", ['uses' => "ToDoController@index", 'as' => 'todo.front.index']);
11 | $router->get("markdown", ['uses' => "MarkdownController@index", 'as' => 'markdown.index']);
12 |
13 | $router->group(['prefix' => 'api/v1', "namespace" => "Api"], function ($router) {
14 | $router->resource("todo", "ToDoController", [
15 | "names" => [
16 | "index" => "api.todo.index",
17 | "store" => "api.todo.store",
18 | "destroy" => "api.todo.destroy"
19 | ],
20 | "only" => [
21 | "index", "store", "destroy"
22 | ]
23 | ]);
24 | $router->resource("markdown", "MarkdownController", [
25 | "names" => [
26 | "index" => "api.markdown.index",
27 | "store" => "api.markdown.store"
28 | ],
29 | "only" => [
30 | "index", "store"
31 | ]
32 | ]);
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class AppServiceProvider extends ServiceProvider
12 | {
13 |
14 | /**
15 | * Bootstrap any application services.
16 | *
17 | * @return void
18 | */
19 | public function boot()
20 | {
21 |
22 | }
23 |
24 | /**
25 | * Register any application services.
26 | *
27 | * This service provider is a great spot to register your various container
28 | * bindings with the application. As you can see, we are registering our
29 | * "Registrar" implementation here. You can add your own bindings too!
30 | *
31 | * @return void
32 | */
33 | public function register()
34 | {
35 | $this->app->bind(
36 | 'Illuminate\Contracts\Auth\Registrar',
37 | 'App\Services\Registrar'
38 | );
39 | $this->app->when('App\Http\Controllers\Api\ToDoController')
40 | ->needs("App\Repositories\ToDoRepositoryInterface")
41 | ->give("App\Repositories\ToDoRepository");
42 | //
43 | $this->app->bind(
44 | "App\Repositories\MarkdownRepositoryInterface",
45 | "App\Repositories\MarkdownRepository"
46 | );
47 | // field injection
48 | $this->app->resolving("App\Repositories\MarkdownRepositoryInterface", function ($app) {
49 | $app->path = config('sample.markdown');
50 | });
51 | // view compose
52 | $this->app->view->composer(['markdown.index', 'todo.index'], "App\Renders\XsrfTokenComposer");
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/app/Providers/BusServiceProvider.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class BusServiceProvider extends ServiceProvider
13 | {
14 |
15 | /**
16 | * Bootstrap any application services.
17 | *
18 | * @param \Illuminate\Bus\Dispatcher $dispatcher
19 | * @return void
20 | */
21 | public function boot(Dispatcher $dispatcher)
22 | {
23 | $dispatcher->mapUsing(function ($command) {
24 | return Dispatcher::simpleMapping(
25 | $command, 'App\Commands', 'App\Handlers\Commands'
26 | );
27 | });
28 | }
29 |
30 | /**
31 | * Register any application services.
32 | *
33 | * @return void
34 | */
35 | public function register()
36 | {
37 | //
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/Providers/ConfigServiceProvider.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ConfigServiceProvider extends ServiceProvider
12 | {
13 |
14 | /**
15 | *
16 | */
17 | public function register()
18 | {
19 | if ($this->app->environment("local")) {
20 | $this->app->register('Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider');
21 | }
22 |
23 | config([
24 | //
25 | ]);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class EventServiceProvider extends ServiceProvider
13 | {
14 |
15 | /**
16 | * The event handler mappings for the application.
17 | *
18 | * @var array
19 | */
20 | protected $listen = [
21 | 'todo.add' => [
22 | 'App\Events\ToDoEvent',
23 | ]
24 | ];
25 |
26 | /**
27 | * Register any other events for your application.
28 | *
29 | * @param \Illuminate\Contracts\Events\Dispatcher $events
30 | * @return void
31 | */
32 | public function boot(DispatcherContract $events)
33 | {
34 | parent::boot($events);
35 | //
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class RouteServiceProvider extends ServiceProvider
13 | {
14 |
15 | /**
16 | * @var string
17 | */
18 | protected $namespace = null;
19 |
20 | /**
21 | * Define your route model bindings, pattern filters, etc.
22 | *
23 | * @param \Illuminate\Routing\Router $router
24 | * @return void
25 | */
26 | public function boot(Router $router)
27 | {
28 | parent::boot($router);
29 |
30 | //
31 | }
32 |
33 | /**
34 | * @param Router $router
35 | */
36 | public function map(Router $router)
37 | {
38 | $router->group(['namespace' => $this->namespace], function ($router) {
39 | require app_path('Http/routes.php');
40 | });
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/Renders/XsrfTokenComposer.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class XsrfTokenComposer
13 | {
14 |
15 | /** @var Encrypter */
16 | protected $encrypt;
17 |
18 | /**
19 | * @param Encrypter $encrypt
20 | */
21 | public function __construct(Encrypter $encrypt)
22 | {
23 | $this->encrypt = $encrypt;
24 | }
25 |
26 | /**
27 | * Bind data to the view.
28 | *
29 | * @param View $view
30 | * @return void
31 | */
32 | public function compose(View $view)
33 | {
34 | $view->with('xsrf_token', $this->encrypt->encrypt(csrf_token()));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/Repositories/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ytake/Laravel5.BasicArchitecture/be0fe708dee0a7c6b3e0667f604b9ceacafae978/app/Repositories/.gitkeep
--------------------------------------------------------------------------------
/app/Repositories/MarkdownRepository.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 | class MarkdownRepository implements MarkdownRepositoryInterface
10 | {
11 |
12 | /** @var null */
13 | public $path;
14 |
15 | /**
16 | * @param $path
17 | * @return $this
18 | */
19 | public function file($path)
20 | {
21 | $this->path = $path;
22 | return $this;
23 | }
24 |
25 | /**
26 | * @return string
27 | */
28 | public function read()
29 | {
30 | return \File::get($this->path);
31 | }
32 |
33 | /**
34 | * @param $text
35 | * @return int
36 | */
37 | public function put($text)
38 | {
39 | return \File::put($this->path, $text);
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/app/Repositories/MarkdownRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 | class ToDoRepository implements ToDoRepositoryInterface
10 | {
11 |
12 | /** @var string */
13 | protected $key = "todo.session";
14 |
15 | /** @var array */
16 | protected $default = [
17 | [
18 | "id" => 1,
19 | "title" => "hello"
20 | ],
21 | [
22 | "id" => 2,
23 | "title" => "Laravel5"
24 | ]
25 | ];
26 |
27 | /**
28 | * @param string $title
29 | * @return mixed
30 | */
31 | public function store($title)
32 | {
33 | $data = $this->all();
34 | $result = array_merge($data, [["id" => count($data) + 1, "title" => $title]]);
35 | \Session::set($this->key, $result);
36 | }
37 |
38 | /**
39 | * @return array
40 | */
41 | public function all()
42 | {
43 | $result = \Session::get($this->key);
44 | if(!count($result)) {
45 | $result = $this->default;
46 | }
47 | return $result;
48 | }
49 |
50 | /**
51 | * @param $id
52 | * @return mixed
53 | */
54 | public function remove($id)
55 | {
56 | $result = \Session::get($this->key);
57 | foreach($result as $row => $value) {
58 | if($value['id'] === (int)$id) {
59 | unset($result[$row]);
60 | }
61 | }
62 | \Session::set($this->key, $result);
63 | return $this->all();
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/app/Repositories/ToDoRepositoryInterface.php:
--------------------------------------------------------------------------------
1 | make('Illuminate\Contracts\Console\Kernel');
32 |
33 | $status = $kernel->handle(
34 | $input = new Symfony\Component\Console\Input\ArgvInput,
35 | new Symfony\Component\Console\Output\ConsoleOutput
36 | );
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Shutdown The Application
41 | |--------------------------------------------------------------------------
42 | |
43 | | Once Artisan has finished running. We will fire off the shutdown events
44 | | so that any final work may be done by the application before we shut
45 | | down the process. This is the last thing to happen to the request.
46 | |
47 | */
48 |
49 | $kernel->terminate($input, $status);
50 |
51 | exit($status);
52 |
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | singleton(
30 | 'Illuminate\Contracts\Http\Kernel',
31 | 'App\Http\Kernel'
32 | );
33 |
34 | $app->singleton(
35 | 'Illuminate\Contracts\Console\Kernel',
36 | 'App\Console\Kernel'
37 | );
38 |
39 | $app->singleton(
40 | 'Illuminate\Contracts\Debug\ExceptionHandler',
41 | 'App\Exceptions\Handler'
42 | );
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Return The Application
47 | |--------------------------------------------------------------------------
48 | |
49 | | This script returns the application instance. The instance is given to
50 | | the calling script so we can separate the building of the instances
51 | | from the actual running of the application and sending responses.
52 | |
53 | */
54 |
55 | return $app;
56 |
--------------------------------------------------------------------------------
/bootstrap/autoload.php:
--------------------------------------------------------------------------------
1 | env('APP_DEBUG'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application URL
21 | |--------------------------------------------------------------------------
22 | |
23 | | This URL is used by the console to properly generate URLs when using
24 | | the Artisan command line tool. You should set this to the root of
25 | | your application so that it is used when running Artisan tasks.
26 | |
27 | */
28 |
29 | 'url' => 'http://localhost',
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application Timezone
34 | |--------------------------------------------------------------------------
35 | |
36 | | Here you may specify the default timezone for your application, which
37 | | will be used by the PHP date and date-time functions. We have gone
38 | | ahead and set this to a sensible default for you out of the box.
39 | |
40 | */
41 |
42 | 'timezone' => 'Asia/Tokyo',
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application Locale Configuration
47 | |--------------------------------------------------------------------------
48 | |
49 | | The application locale determines the default locale that will be used
50 | | by the translation service provider. You are free to set this value
51 | | to any of the locales which will be supported by the application.
52 | |
53 | */
54 |
55 | 'locale' => 'en',
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Application Fallback Locale
60 | |--------------------------------------------------------------------------
61 | |
62 | | The fallback locale determines the locale to use when the current one
63 | | is not available. You may change the value to correspond to any of
64 | | the language folders that are provided through your application.
65 | |
66 | */
67 |
68 | 'fallback_locale' => 'en',
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Encryption Key
73 | |--------------------------------------------------------------------------
74 | |
75 | | This key is used by the Illuminate encrypter service and should be set
76 | | to a random, 32 character string, otherwise these encrypted strings
77 | | will not be safe. Please do this before deploying an application!
78 | |
79 | */
80 |
81 | 'key' => env('APP_KEY', 'SomeRandomString'),
82 |
83 | 'cipher' => MCRYPT_RIJNDAEL_128,
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | Logging Configuration
88 | |--------------------------------------------------------------------------
89 | |
90 | | Here you may configure the log settings for your application. Out of
91 | | the box, Laravel uses the Monolog PHP logging library. This gives
92 | | you a variety of powerful log handlers / formatters to utilize.
93 | |
94 | | Available Settings: "single", "daily", "syslog", "errorlog"
95 | |
96 | */
97 |
98 | 'log' => 'daily',
99 |
100 | /*
101 | |--------------------------------------------------------------------------
102 | | Autoloaded Service Providers
103 | |--------------------------------------------------------------------------
104 | |
105 | | The service providers listed here will be automatically loaded on the
106 | | request to your application. Feel free to add your own services to
107 | | this array to grant expanded functionality to your applications.
108 | |
109 | */
110 |
111 | 'providers' => [
112 |
113 | /*
114 | * Laravel Framework Service Providers...
115 | */
116 | 'Illuminate\Foundation\Providers\ArtisanServiceProvider',
117 | 'Illuminate\Auth\AuthServiceProvider',
118 | 'Illuminate\Bus\BusServiceProvider',
119 | 'Illuminate\Cache\CacheServiceProvider',
120 | 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
121 | 'Illuminate\Routing\ControllerServiceProvider',
122 | 'Illuminate\Cookie\CookieServiceProvider',
123 | 'Illuminate\Database\DatabaseServiceProvider',
124 | 'Illuminate\Encryption\EncryptionServiceProvider',
125 | 'Illuminate\Filesystem\FilesystemServiceProvider',
126 | 'Illuminate\Foundation\Providers\FoundationServiceProvider',
127 | 'Illuminate\Hashing\HashServiceProvider',
128 | 'Illuminate\Mail\MailServiceProvider',
129 | 'Illuminate\Pagination\PaginationServiceProvider',
130 | 'Illuminate\Pipeline\PipelineServiceProvider',
131 | 'Illuminate\Queue\QueueServiceProvider',
132 | 'Illuminate\Redis\RedisServiceProvider',
133 | 'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
134 | 'Illuminate\Session\SessionServiceProvider',
135 | 'Illuminate\Translation\TranslationServiceProvider',
136 | 'Illuminate\Validation\ValidationServiceProvider',
137 | 'Illuminate\View\ViewServiceProvider',
138 |
139 | /*
140 | * Application Service Providers...
141 | */
142 | 'App\Providers\AppServiceProvider',
143 | 'App\Providers\BusServiceProvider',
144 | 'App\Providers\ConfigServiceProvider',
145 | 'App\Providers\EventServiceProvider',
146 | 'App\Providers\RouteServiceProvider',
147 |
148 | ],
149 |
150 | /*
151 | |--------------------------------------------------------------------------
152 | | Class Aliases
153 | |--------------------------------------------------------------------------
154 | |
155 | | This array of class aliases will be registered when this application
156 | | is started. However, feel free to register as many as you wish as
157 | | the aliases are "lazy" loaded so they don't hinder performance.
158 | |
159 | */
160 |
161 | 'aliases' => [
162 |
163 | 'App' => 'Illuminate\Support\Facades\App',
164 | 'Artisan' => 'Illuminate\Support\Facades\Artisan',
165 | 'Auth' => 'Illuminate\Support\Facades\Auth',
166 | 'Blade' => 'Illuminate\Support\Facades\Blade',
167 | 'Bus' => 'Illuminate\Support\Facades\Bus',
168 | 'Cache' => 'Illuminate\Support\Facades\Cache',
169 | 'Config' => 'Illuminate\Support\Facades\Config',
170 | 'Cookie' => 'Illuminate\Support\Facades\Cookie',
171 | 'Crypt' => 'Illuminate\Support\Facades\Crypt',
172 | 'DB' => 'Illuminate\Support\Facades\DB',
173 | 'Eloquent' => 'Illuminate\Database\Eloquent\Model',
174 | 'Event' => 'Illuminate\Support\Facades\Event',
175 | 'File' => 'Illuminate\Support\Facades\File',
176 | 'Hash' => 'Illuminate\Support\Facades\Hash',
177 | 'Input' => 'Illuminate\Support\Facades\Input',
178 | 'Inspiring' => 'Illuminate\Foundation\Inspiring',
179 | 'Lang' => 'Illuminate\Support\Facades\Lang',
180 | 'Log' => 'Illuminate\Support\Facades\Log',
181 | 'Mail' => 'Illuminate\Support\Facades\Mail',
182 | 'Password' => 'Illuminate\Support\Facades\Password',
183 | 'Queue' => 'Illuminate\Support\Facades\Queue',
184 | 'Redirect' => 'Illuminate\Support\Facades\Redirect',
185 | 'Redis' => 'Illuminate\Support\Facades\Redis',
186 | 'Request' => 'Illuminate\Support\Facades\Request',
187 | 'Response' => 'Illuminate\Support\Facades\Response',
188 | 'Route' => 'Illuminate\Support\Facades\Route',
189 | 'Schema' => 'Illuminate\Support\Facades\Schema',
190 | 'Session' => 'Illuminate\Support\Facades\Session',
191 | 'Storage' => 'Illuminate\Support\Facades\Storage',
192 | 'URL' => 'Illuminate\Support\Facades\URL',
193 | 'Validator' => 'Illuminate\Support\Facades\Validator',
194 | 'View' => 'Illuminate\Support\Facades\View',
195 | 'VoltDBApi' => 'Ytake\LaravelVoltDB\VoltDBFacade',
196 | ],
197 |
198 | ];
199 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | 'eloquent',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Authentication Model
23 | |--------------------------------------------------------------------------
24 | |
25 | | When using the "Eloquent" authentication driver, we need to know which
26 | | Eloquent model should be used to retrieve your users. Of course, it
27 | | is often just the "User" model but you may use whatever you like.
28 | |
29 | */
30 |
31 | 'model' => 'App\User',
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Authentication Table
36 | |--------------------------------------------------------------------------
37 | |
38 | | When using the "Database" authentication driver, we need to know which
39 | | table should be used to retrieve your users. We have chosen a basic
40 | | default value but you may easily change it to any table you like.
41 | |
42 | */
43 |
44 | 'table' => 'users',
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Password Reset Settings
49 | |--------------------------------------------------------------------------
50 | |
51 | | Here you may set the options for resetting passwords including the view
52 | | that is your password reset e-mail. You can also set the name of the
53 | | table that maintains all of the reset tokens for your application.
54 | |
55 | | The expire time is the number of minutes that the reset token should be
56 | | considered valid. This security feature keeps tokens short-lived so
57 | | they have less time to be guessed. You may change this as needed.
58 | |
59 | */
60 |
61 | 'password' => [
62 | 'email' => 'emails.password',
63 | 'table' => 'password_resets',
64 | 'expire' => 60,
65 | ],
66 |
67 | ];
68 |
--------------------------------------------------------------------------------
/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Cache Stores
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the cache "stores" for your application as
24 | | well as their drivers. You may even define multiple stores for the
25 | | same cache driver to group types of items stored in your caches.
26 | |
27 | */
28 |
29 | 'stores' => [
30 |
31 | 'apc' => [
32 | 'driver' => 'apc'
33 | ],
34 |
35 | 'array' => [
36 | 'driver' => 'array'
37 | ],
38 |
39 | 'voltdb' => [
40 | 'driver' => 'voltdb'
41 | ],
42 |
43 | 'database' => [
44 | 'driver' => 'database',
45 | 'table' => 'cache',
46 | 'connection' => null,
47 | ],
48 |
49 | 'file' => [
50 | 'driver' => 'file',
51 | 'path' => storage_path().'/framework/cache',
52 | ],
53 |
54 | 'memcached' => [
55 | 'driver' => 'memcached',
56 | 'servers' => [
57 | [
58 | 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100
59 | ],
60 | ],
61 | ],
62 |
63 | 'redis' => [
64 | 'driver' => 'redis',
65 | 'connection' => 'default',
66 | ],
67 |
68 | ],
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Cache Key Prefix
73 | |--------------------------------------------------------------------------
74 | |
75 | | When utilizing a RAM based store such as APC or Memcached, there might
76 | | be other applications utilizing the same cache. So, we'll specify a
77 | | value to get prefixed to all our keys so we can avoid collisions.
78 | |
79 | */
80 |
81 | 'prefix' => 'laravel',
82 |
83 | ];
84 |
--------------------------------------------------------------------------------
/config/compile.php:
--------------------------------------------------------------------------------
1 | [
17 |
18 | realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'),
19 | realpath(__DIR__.'/../app/Providers/BusServiceProvider.php'),
20 | realpath(__DIR__.'/../app/Providers/ConfigServiceProvider.php'),
21 | realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'),
22 | realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'),
23 |
24 | ],
25 |
26 | /*
27 | |--------------------------------------------------------------------------
28 | | Compiled File Providers
29 | |--------------------------------------------------------------------------
30 | |
31 | | Here you may list service providers which define a "compiles" function
32 | | that returns additional files that should be compiled, providing an
33 | | easy way to get common files from any packages you are utilizing.
34 | |
35 | */
36 |
37 | 'providers' => [
38 | //
39 | ],
40 |
41 | ];
42 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | PDO::FETCH_CLASS,
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Default Database Connection Name
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may specify which of the database connections below you wish
24 | | to use as your default connection for all database work. Of course
25 | | you may use many connections at once using the Database library.
26 | |
27 | */
28 |
29 | 'default' => 'mysql',
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Database Connections
34 | |--------------------------------------------------------------------------
35 | |
36 | | Here are each of the database connections setup for your application.
37 | | Of course, examples of configuring each database platform that is
38 | | supported by Laravel is shown below to make development simple.
39 | |
40 | |
41 | | All database work in Laravel is done through the PHP PDO facilities
42 | | so make sure you have the driver for your particular database of
43 | | choice installed on your machine before you begin development.
44 | |
45 | */
46 |
47 | 'connections' => [
48 |
49 | 'sqlite' => [
50 | 'driver' => 'sqlite',
51 | 'database' => storage_path().'/database.sqlite',
52 | 'prefix' => '',
53 | ],
54 |
55 | 'mysql' => [
56 | 'driver' => 'mysql',
57 | 'host' => env('DB_HOST', 'localhost'),
58 | 'database' => env('DB_DATABASE', 'forge'),
59 | 'username' => env('DB_USERNAME', 'forge'),
60 | 'password' => env('DB_PASSWORD', ''),
61 | 'charset' => 'utf8',
62 | 'collation' => 'utf8_unicode_ci',
63 | 'prefix' => '',
64 | 'strict' => false,
65 | ],
66 |
67 | 'pgsql' => [
68 | 'driver' => 'pgsql',
69 | 'host' => env('DB_HOST', 'localhost'),
70 | 'database' => env('DB_DATABASE', 'forge'),
71 | 'username' => env('DB_USERNAME', 'forge'),
72 | 'password' => env('DB_PASSWORD', ''),
73 | 'charset' => 'utf8',
74 | 'prefix' => '',
75 | 'schema' => 'public',
76 | ],
77 |
78 | 'sqlsrv' => [
79 | 'driver' => 'sqlsrv',
80 | 'host' => env('DB_HOST', 'localhost'),
81 | 'database' => env('DB_DATABASE', 'forge'),
82 | 'username' => env('DB_USERNAME', 'forge'),
83 | 'password' => env('DB_PASSWORD', ''),
84 | 'prefix' => '',
85 | ],
86 | 'voltdb' => [
87 | 'driver' => 'voltdb',
88 | 'host' => 'localhost',
89 | 'username' => '',
90 | 'password' => '',
91 | 'port' => 21212
92 | ],
93 | ],
94 |
95 | /*
96 | |--------------------------------------------------------------------------
97 | | Migration Repository Table
98 | |--------------------------------------------------------------------------
99 | |
100 | | This table keeps track of all the migrations that have already run for
101 | | your application. Using this information, we can determine which of
102 | | the migrations on disk haven't actually been run in the database.
103 | |
104 | */
105 |
106 | 'migrations' => 'migrations',
107 |
108 | /*
109 | |--------------------------------------------------------------------------
110 | | Redis Databases
111 | |--------------------------------------------------------------------------
112 | |
113 | | Redis is an open source, fast, and advanced key-value store that also
114 | | provides a richer set of commands than a typical key-value systems
115 | | such as APC or Memcached. Laravel makes it easy to dig right in.
116 | |
117 | */
118 |
119 | 'redis' => [
120 |
121 | 'cluster' => false,
122 |
123 | 'default' => [
124 | 'host' => '127.0.0.1',
125 | 'port' => 6379,
126 | 'database' => 0,
127 | ],
128 |
129 | ],
130 |
131 | ];
132 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | 'local',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Default Cloud Filesystem Disk
23 | |--------------------------------------------------------------------------
24 | |
25 | | Many applications store files both locally and in the cloud. For this
26 | | reason, you may specify a default "cloud" driver here. This driver
27 | | will be bound as the Cloud disk implementation in the container.
28 | |
29 | */
30 |
31 | 'cloud' => 's3',
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Filesystem Disks
36 | |--------------------------------------------------------------------------
37 | |
38 | | Here you may configure as many filesystem "disks" as you wish, and you
39 | | may even configure multiple disks of the same driver. Defaults have
40 | | been setup for each driver as an example of the required options.
41 | |
42 | */
43 |
44 | 'disks' => [
45 |
46 | 'local' => [
47 | 'driver' => 'local',
48 | 'root' => storage_path().'/app',
49 | ],
50 |
51 | 's3' => [
52 | 'driver' => 's3',
53 | 'key' => 'your-key',
54 | 'secret' => 'your-secret',
55 | 'region' => 'your-region',
56 | 'bucket' => 'your-bucket',
57 | ],
58 |
59 | 'rackspace' => [
60 | 'driver' => 'rackspace',
61 | 'username' => 'your-username',
62 | 'key' => 'your-key',
63 | 'container' => 'your-container',
64 | 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
65 | 'region' => 'IAD',
66 | ],
67 |
68 | ],
69 |
70 | ];
71 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | 'smtp',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | SMTP Host Address
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may provide the host address of the SMTP server used by your
26 | | applications. A default option is provided that is compatible with
27 | | the Mailgun mail service which will provide reliable deliveries.
28 | |
29 | */
30 |
31 | 'host' => 'smtp.mailgun.org',
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | SMTP Host Port
36 | |--------------------------------------------------------------------------
37 | |
38 | | This is the SMTP port used by your application to deliver e-mails to
39 | | users of the application. Like the host we have set this value to
40 | | stay compatible with the Mailgun e-mail application by default.
41 | |
42 | */
43 |
44 | 'port' => 587,
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Global "From" Address
49 | |--------------------------------------------------------------------------
50 | |
51 | | You may wish for all e-mails sent by your application to be sent from
52 | | the same address. Here, you may specify a name and address that is
53 | | used globally for all e-mails that are sent by your application.
54 | |
55 | */
56 |
57 | 'from' => ['address' => null, 'name' => null],
58 |
59 | /*
60 | |--------------------------------------------------------------------------
61 | | E-Mail Encryption Protocol
62 | |--------------------------------------------------------------------------
63 | |
64 | | Here you may specify the encryption protocol that should be used when
65 | | the application send e-mail messages. A sensible default using the
66 | | transport layer security protocol should provide great security.
67 | |
68 | */
69 |
70 | 'encryption' => 'tls',
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | SMTP Server Username
75 | |--------------------------------------------------------------------------
76 | |
77 | | If your SMTP server requires a username for authentication, you should
78 | | set it here. This will get used to authenticate with your server on
79 | | connection. You may also set the "password" value below this one.
80 | |
81 | */
82 |
83 | 'username' => null,
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | SMTP Server Password
88 | |--------------------------------------------------------------------------
89 | |
90 | | Here you may set the password required by your SMTP server to send out
91 | | messages from your application. This will be given to the server on
92 | | connection so that the application will be able to send messages.
93 | |
94 | */
95 |
96 | 'password' => null,
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Sendmail System Path
101 | |--------------------------------------------------------------------------
102 | |
103 | | When using the "sendmail" driver to send e-mails, we will need to know
104 | | the path to where Sendmail lives on this server. A default path has
105 | | been provided here, which will work well on most of your systems.
106 | |
107 | */
108 |
109 | 'sendmail' => '/usr/sbin/sendmail -bs',
110 |
111 | /*
112 | |--------------------------------------------------------------------------
113 | | Mail "Pretend"
114 | |--------------------------------------------------------------------------
115 | |
116 | | When this option is enabled, e-mail will not actually be sent over the
117 | | web and will instead be written to your application's logs files so
118 | | you may inspect the message. This is great for local development.
119 | |
120 | */
121 |
122 | 'pretend' => false,
123 |
124 | ];
125 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_DRIVER', 'sync'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Queue Connections
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may configure the connection information for each server that
27 | | is used by your application. A default configuration has been added
28 | | for each back-end shipped with Laravel. You are free to add more.
29 | |
30 | */
31 |
32 | 'connections' => [
33 |
34 | 'sync' => [
35 | 'driver' => 'sync',
36 | ],
37 |
38 | 'database' => [
39 | 'driver' => 'database',
40 | 'table' => 'jobs',
41 | 'queue' => 'default',
42 | 'expire' => 60,
43 | ],
44 |
45 | 'beanstalkd' => [
46 | 'driver' => 'beanstalkd',
47 | 'host' => 'localhost',
48 | 'queue' => 'default',
49 | 'ttr' => 60,
50 | ],
51 |
52 | 'sqs' => [
53 | 'driver' => 'sqs',
54 | 'key' => 'your-public-key',
55 | 'secret' => 'your-secret-key',
56 | 'queue' => 'your-queue-url',
57 | 'region' => 'us-east-1',
58 | ],
59 |
60 | 'iron' => [
61 | 'driver' => 'iron',
62 | 'host' => 'mq-aws-us-east-1.iron.io',
63 | 'token' => 'your-token',
64 | 'project' => 'your-project-id',
65 | 'queue' => 'your-queue-name',
66 | 'encrypt' => true,
67 | ],
68 |
69 | 'redis' => [
70 | 'driver' => 'redis',
71 | 'queue' => 'default',
72 | 'expire' => 60,
73 | ],
74 |
75 | ],
76 |
77 | /*
78 | |--------------------------------------------------------------------------
79 | | Failed Queue Jobs
80 | |--------------------------------------------------------------------------
81 | |
82 | | These options configure the behavior of failed queue job logging so you
83 | | can control which database and table are used to store the jobs that
84 | | have failed. You may change them to any database / table you wish.
85 | |
86 | */
87 |
88 | 'failed' => [
89 | 'database' => 'mysql', 'table' => 'failed_jobs',
90 | ],
91 |
92 | ];
93 |
--------------------------------------------------------------------------------
/config/sample.php:
--------------------------------------------------------------------------------
1 | storage_path('app/markdown/markdown.md'),
5 | ];
6 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => '',
19 | 'secret' => '',
20 | ],
21 |
22 | 'mandrill' => [
23 | 'secret' => '',
24 | ],
25 |
26 | 'ses' => [
27 | 'key' => '',
28 | 'secret' => '',
29 | 'region' => 'us-east-1',
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => 'User',
34 | 'secret' => '',
35 | ],
36 |
37 | ];
38 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Session Lifetime
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may specify the number of minutes that you wish the session
27 | | to be allowed to remain idle before it expires. If you want them
28 | | to immediately expire on the browser closing, set that option.
29 | |
30 | */
31 |
32 | 'lifetime' => 120,
33 |
34 | 'expire_on_close' => false,
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Session Encryption
39 | |--------------------------------------------------------------------------
40 | |
41 | | This option allows you to easily specify that all of your session data
42 | | should be encrypted before it is stored. All encryption will be run
43 | | automatically by Laravel and you can use the Session like normal.
44 | |
45 | */
46 |
47 | 'encrypt' => false,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Session File Location
52 | |--------------------------------------------------------------------------
53 | |
54 | | When using the native session driver, we need a location where session
55 | | files may be stored. A default has been set for you but a different
56 | | location may be specified. This is only needed for file sessions.
57 | |
58 | */
59 |
60 | 'files' => storage_path().'/framework/sessions',
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Session Database Connection
65 | |--------------------------------------------------------------------------
66 | |
67 | | When using the "database" or "redis" session drivers, you may specify a
68 | | connection that should be used to manage these sessions. This should
69 | | correspond to a connection in your database configuration options.
70 | |
71 | */
72 |
73 | 'connection' => null,
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Session Database Table
78 | |--------------------------------------------------------------------------
79 | |
80 | | When using the "database" session driver, you may specify the table we
81 | | should use to manage the sessions. Of course, a sensible default is
82 | | provided for you; however, you are free to change this as needed.
83 | |
84 | */
85 |
86 | 'table' => 'sessions',
87 |
88 | /*
89 | |--------------------------------------------------------------------------
90 | | Session Sweeping Lottery
91 | |--------------------------------------------------------------------------
92 | |
93 | | Some session drivers must manually sweep their storage location to get
94 | | rid of old sessions from storage. Here are the chances that it will
95 | | happen on a given request. By default, the odds are 2 out of 100.
96 | |
97 | */
98 |
99 | 'lottery' => [2, 100],
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Session Cookie Name
104 | |--------------------------------------------------------------------------
105 | |
106 | | Here you may change the name of the cookie used to identify a session
107 | | instance by ID. The name specified here will get used every time a
108 | | new session cookie is created by the framework for every driver.
109 | |
110 | */
111 |
112 | 'cookie' => 'laravel_session',
113 |
114 | /*
115 | |--------------------------------------------------------------------------
116 | | Session Cookie Path
117 | |--------------------------------------------------------------------------
118 | |
119 | | The session cookie path determines the path for which the cookie will
120 | | be regarded as available. Typically, this will be the root path of
121 | | your application but you are free to change this when necessary.
122 | |
123 | */
124 |
125 | 'path' => '/',
126 |
127 | /*
128 | |--------------------------------------------------------------------------
129 | | Session Cookie Domain
130 | |--------------------------------------------------------------------------
131 | |
132 | | Here you may change the domain of the cookie used to identify a session
133 | | in your application. This will determine which domains the cookie is
134 | | available to in your application. A sensible default has been set.
135 | |
136 | */
137 |
138 | 'domain' => null,
139 |
140 | /*
141 | |--------------------------------------------------------------------------
142 | | HTTPS Only Cookies
143 | |--------------------------------------------------------------------------
144 | |
145 | | By setting this option to true, session cookies will only be sent back
146 | | to the server if the browser has a HTTPS connection. This will keep
147 | | the cookie from being sent to you if it can not be done securely.
148 | |
149 | */
150 |
151 | 'secure' => false,
152 |
153 | ];
154 |
--------------------------------------------------------------------------------
/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | realpath(base_path('resources/views'))
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => realpath(storage_path().'/framework/views'),
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 |
--------------------------------------------------------------------------------
/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ytake/Laravel5.BasicArchitecture/be0fe708dee0a7c6b3e0667f604b9ceacafae978/database/migrations/.gitkeep
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name');
19 | $table->string('email')->unique();
20 | $table->string('password', 60);
21 | $table->rememberToken();
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::drop('users');
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
18 | $table->string('token')->index();
19 | $table->timestamp('created_at');
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::drop('password_resets');
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ytake/Laravel5.BasicArchitecture/be0fe708dee0a7c6b3e0667f604b9ceacafae978/database/seeds/.gitkeep
--------------------------------------------------------------------------------
/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 |
2 |
"+d+"\n
",A(d)+e}),a=a.replace(/~0/,"")},z=function(a){return a+="~0",a=a.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(a,b,c){var d=b,e=c;return e=C(e),e=M(e),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),e=""+e+"\n
",A(e)}),a=a.replace(/~0/,"")},A=function(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(d.push(a)-1)+"K\n\n"},B=function(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d){var e=d;return e=e.replace(/^([ \t]*)/g,""),e=e.replace(/[ \t]*$/g,""),e=C(e),b+""+e+"
"})},C=function(a){return a=a.replace(/&/g,"&"),a=a.replace(//g,">"),a=N(a,"*_{}[]\\",!1)},D=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2")},E=function(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=p(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /gm,"~0"),c=c.replace(/~0/g,"")}),A("\n"+c+"\n")})},F=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");for(var b=a.split(/\n{2,}/g),c=[],e=b.length,f=0;e>f;f++){var g=b[f];g.search(/~K(\d+)K/g)>=0?c.push(g):g.search(/\S/)>=0&&(g=q(g),g=g.replace(/^([ \t]*)/g,""),g+="
",c.push(g))}e=c.length;for(var f=0;e>f;f++)for(;c[f].search(/~K(\d+)K/)>=0;){var h=d[RegExp.$1];h=h.replace(/\$/g,"$$$$"),c[f]=c[f].replace(/~K\d+K/,h)}return c.join("\n\n")},G=function(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),a=a.replace(/<(?![a-z\/?\$!])/gi,"<")},H=function(a){return a=a.replace(/\\(\\)/g,O),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,O)},I=function(a){return a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'$1'),a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(a,b){return J(K(b))})},J=function(a){var b=[function(a){return""+a.charCodeAt(0)+";"},function(a){return""+a.charCodeAt(0).toString(16)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if("@"==a)a=b[Math.floor(2*Math.random())](a);else if(":"!=a){var c=Math.random();a=c>.9?b[2](a):c>.45?b[1](a):b[0](a)}return a}),a=''+a+"",a=a.replace(/">.+:/g,'">')},K=function(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)})},L=function(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,"")},M=function(a){return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b){for(var c=b,d=4-c.length%4,e=0;d>e;e++)c+=" ";return c}),a=a.replace(/~A/g," "),a=a.replace(/~B/g,"")},N=function(a,b,c){var d="(["+b.replace(/([\[\]\\])/g,"\\$1")+"])";c&&(d="\\\\"+d);var e=new RegExp(d,"g");return a=a.replace(e,O)},O=function(a,b){var c=b.charCodeAt(0);return"~E"+c+"E"}},"undefined"!=typeof module&&(module.exports=Showdown),"function"==typeof define&&define.amd&&define("showdown",function(){return Showdown}),"undefined"!=typeof angular&&"undefined"!=typeof Showdown&&!function(a,b){function c(){function a(){var a=new b.converter(c);this.makeHtml=function(b){return a.makeHtml(b)},this.stripHtml=function(a){return String(a).replace(/<[^>]+>/gm,"")}}var c={extensions:[],stripHtml:!0};this.setOption=function(a,b){return c.key=b,this},this.getOption=function(a){return c.hasOwnProperty(a)?c.key:null},this.loadExtension=function(a){return c.extensions.push(a),this},this.$get=function(){return new a}}function d(a){var b=function(b,c){b.$watch("model",function(b){var d;d="string"==typeof b?a.makeHtml(b):typeof b,c.html(d)})};return{restrict:"A",link:b,scope:{model:"=sdModelToHtml"}}}function e(){return function(a){return String(a).replace(/<[^>]+>/gm,"")}}a.provider("$Showdown",c).directive("sdModelToHtml",["$Showdown",d]).filter("sdStripHtml",e)}(angular.module("Showdown",[]),Showdown); -------------------------------------------------------------------------------- /public/assets/js/github.min.js: -------------------------------------------------------------------------------- 1 | /*! showdown 06-01-2015 */ 2 | !function(){var a=function(){return[{type:"lang",regex:"(~T){2}([^~]+)(~T){2}",replace:function(a,b,c){return""+c+""}}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.github=a),"undefined"!=typeof module&&(module.exports=a)}(); -------------------------------------------------------------------------------- /public/assets/js/material.min.js: -------------------------------------------------------------------------------- 1 | !function(a){function b(a){return"undefined"==typeof a.which?!0:"number"==typeof a.which&&a.which>0?!a.ctrlKey&&!a.metaKey&&!a.altKey&&8!=a.which:!1}a.expr[":"].notmdproc=function(b){return a(b).data("mdproc")?!1:!0},a.material={options:{input:!0,ripples:!0,checkbox:!0,togglebutton:!0,radio:!0,arrive:!0,autofill:!1,withRipples:[".btn:not(.btn-link)",".card-image",".navbar a:not(.withoutripple)",".dropdown-menu a",".nav-tabs a:not(.withoutripple)",".withripple"].join(","),inputElements:"input.form-control, textarea.form-control, select.form-control",checkboxElements:".checkbox > label > input[type=checkbox]",togglebuttonElements:".togglebutton > label > input[type=checkbox]",radioElements:".radio > label > input[type=radio]"},checkbox:function(b){a(b?b:this.options.checkboxElements).filter(":notmdproc").data("mdproc",!0).after("")},togglebutton:function(b){a(b?b:this.options.togglebuttonElements).filter(":notmdproc").data("mdproc",!0).after("")},radio:function(b){a(b?b:this.options.radioElements).filter(":notmdproc").data("mdproc",!0).after("")},input:function(c){a(c?c:this.options.inputElements).filter(":notmdproc").data("mdproc",!0).each(function(){var b=a(this);if(b.wrap(""),b.after(""),b.hasClass("floating-label")){var c=b.attr("placeholder");b.attr("placeholder",null).removeClass("floating-label"),b.after(""+c+"")}if(b.attr("data-hint")&&b.after(""+b.attr("data-hint")+""),(null===b.val()||"undefined"==b.val()||""===b.val())&&b.addClass("empty"),b.parent().next().is("[type=file]")){b.parent().addClass("fileinput");var d=b.parent().next().detach();b.after(d)}}),a(document).on("change",".checkbox input[type=checkbox]",function(){a(this).blur()}).on("keydown paste",".form-control",function(c){b(c)&&a(this).removeClass("empty")}).on("keyup change",".form-control",function(){var b=a(this);""===b.val()&&b[0].checkValidity()?b.addClass("empty"):b.removeClass("empty")}).on("focus",".form-control-wrapper.fileinput",function(){a(this).find("input").addClass("focus")}).on("blur",".form-control-wrapper.fileinput",function(){a(this).find("input").removeClass("focus")}).on("change",".form-control-wrapper.fileinput [type=file]",function(){var b="";a.each(a(this)[0].files,function(a,c){b+=c.name+", "}),b=b.substring(0,b.length-2),b?a(this).prev().removeClass("empty"):a(this).prev().addClass("empty"),a(this).prev().val(b)})},ripples:function(b){a(b?b:this.options.withRipples).ripples()},autofill:function(){var b=setInterval(function(){a("input[type!=checkbox]").each(function(){a(this).val()&&a(this).val()!==a(this).attr("value")&&a(this).trigger("change")})},100);setTimeout(function(){clearInterval(b)},1e4);var c;a(document).on("focus","input",function(){var b=a(this).parents("form").find("input").not("[type=file]");c=setInterval(function(){b.each(function(){a(this).val()!==a(this).attr("value")&&a(this).trigger("change")})},100)}).on("blur","input",function(){clearInterval(c)})},init:function(){a.fn.ripples&&this.options.ripples&&this.ripples(),this.options.input&&this.input(),this.options.checkbox&&this.checkbox(),this.options.togglebutton&&this.togglebutton(),this.options.radio&&this.radio(),this.options.autofill&&this.autofill(),document.arrive&&this.options.arrive&&(a.fn.ripples&&this.options.ripples&&a(document).arrive(this.options.withRipples,function(){a.material.ripples(a(this))}),this.options.input&&a(document).arrive(this.options.inputElements,function(){a.material.input(a(this))}),this.options.checkbox&&a(document).arrive(this.options.checkboxElements,function(){a.material.checkbox(a(this))}),this.options.radio&&a(document).arrive(this.options.radioElements,function(){a.material.radio(a(this))}),this.options.togglebutton&&a(document).arrive(this.options.togglebuttonElements,function(){a.material.togglebutton(a(this))}))}}}(jQuery); 2 | //# sourceMappingURL=material.min.js.map -------------------------------------------------------------------------------- /public/assets/js/prettify.min.js: -------------------------------------------------------------------------------- 1 | /*! showdown 06-01-2015 */ 2 | !function(){var a=function(){return[{type:"output",filter:function(a){return a.replace(/()?/gi,function(a,b){return b?'
':'
'})}}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.prettify=a),"undefined"!=typeof module&&(module.exports=a)}(); -------------------------------------------------------------------------------- /public/assets/js/ripples.min.js: -------------------------------------------------------------------------------- 1 | !function(a,b,c,d){"use strict";function e(b,c){g=this,this.element=a(b),this.options=a.extend({},h,c),this._defaults=h,this._name=f,this.init()}var f="ripples",g=null,h={};e.prototype.init=function(){var c=this.element;c.on("mousedown touchstart",function(d){if(g.isTouch()&&"mousedown"===d.type)return!1;c.find(".ripple-wrapper").length||c.append('');var e=c.children(".ripple-wrapper"),f=g.getRelY(e,d),h=g.getRelX(e,d);if(f||h){var i=g.getRipplesColor(c),j=a("");j.addClass("ripple").css({left:h,top:f,"background-color":i}),e.append(j),function(){return b.getComputedStyle(j[0]).opacity}(),g.rippleOn(c,j),setTimeout(function(){g.rippleEnd(j)},500),c.on("mouseup mouseleave touchend",function(){j.data("mousedown","off"),"off"===j.data("animating")&&g.rippleOut(j)})}})},e.prototype.getNewSize=function(a,b){return Math.max(a.outerWidth(),a.outerHeight())/b.outerWidth()*2.5},e.prototype.getRelX=function(a,b){var c=a.offset();return g.isTouch()?(b=b.originalEvent,1!==b.touches.length?b.touches[0].pageX-c.left:!1):b.pageX-c.left},e.prototype.getRelY=function(a,b){var c=a.offset();return g.isTouch()?(b=b.originalEvent,1!==b.touches.length?b.touches[0].pageY-c.top:!1):b.pageY-c.top},e.prototype.getRipplesColor=function(a){var c=a.data("ripple-color")?a.data("ripple-color"):b.getComputedStyle(a[0]).color;return c},e.prototype.hasTransitionSupport=function(){var a=c.body||c.documentElement,b=a.style,e=b.transition!==d||b.WebkitTransition!==d||b.MozTransition!==d||b.MsTransition!==d||b.OTransition!==d;return e},e.prototype.isTouch=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},e.prototype.rippleEnd=function(a){a.data("animating","off"),"off"===a.data("mousedown")&&g.rippleOut(a)},e.prototype.rippleOut=function(a){a.off(),g.hasTransitionSupport()?a.addClass("ripple-out"):a.animate({opacity:0},100,function(){a.trigger("transitionend")}),a.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){a.remove()})},e.prototype.rippleOn=function(a,b){var c=g.getNewSize(a,b);g.hasTransitionSupport()?b.css({"-ms-transform":"scale("+c+")","-moz-transform":"scale("+c+")","-webkit-transform":"scale("+c+")",transform:"scale("+c+")"}).addClass("ripple-on").data("animating","on").data("mousedown","on"):b.animate({width:2*Math.max(a.outerWidth(),a.outerHeight()),height:2*Math.max(a.outerWidth(),a.outerHeight()),"margin-left":-1*Math.max(a.outerWidth(),a.outerHeight()),"margin-top":-1*Math.max(a.outerWidth(),a.outerHeight()),opacity:.2},500,function(){b.trigger("transitionend")})},a.fn.ripples=function(b){return this.each(function(){a.data(this,"plugin_"+f)||a.data(this,"plugin_"+f,new e(this,b))})}}(jQuery,window,document); 2 | //# sourceMappingURL=ripples.min.js.map -------------------------------------------------------------------------------- /public/assets/js/sizzle.min.js: -------------------------------------------------------------------------------- 1 | /*! Sizzle v2.2.0-pre | (c) 2008, 2014 jQuery Foundation, Inc. | jquery.org/license */ 2 | !function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),"function"==typeof define&&define.amd?define(function(){return gb}):"undefined"!=typeof module&&module.exports?module.exports=gb:a.Sizzle=gb}(window); 3 | //# sourceMappingURL=sizzle.min.map -------------------------------------------------------------------------------- /public/assets/js/table.min.js: -------------------------------------------------------------------------------- 1 | /*! showdown 06-01-2015 */ 2 | !function(){var a=function(a){var b,c={},d="text-align:left;";return c.th=function(a){if(""===a.trim())return"";var b=a.trim().replace(/ /g,"_").toLowerCase();return'
'+a+" "},c.td=function(b){return''+a.makeHtml(b)+" "},c.ths=function(){var a="",b=0,d=[].slice.apply(arguments);for(b;b\n",a+=c.ths.apply(this,b),a+="\n",a+="\n"},c.tr=function(){var a,b=[].slice.apply(arguments);return a=" \n",a+=c.tds.apply(this,b),a+=" \n"},b=function(a){var b,d,e=0,f=a.split("\n"),g=[];for(e;e"),d=b.substring(1,b.length-1).split("|"),h.push(c.thead.apply(this,d)),b=f[++e],b.trim().match(/^[|]{1}[-=| ]+[|]{1}$/)){for(b=f[++e],h.push("");b.trim().match(/^[|]{1}.*[|]{1}$/);)b=b.trim(),h.push(c.tr.apply(this,b.substring(1,b.length-1).split("|"))),b=f[++e];h.push(""),h.push(""),g.push(h.join("\n"));continue}b=f[--e]}g.push(b)}return g.join("\n")},[{type:"lang",filter:b}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.table=a),"undefined"!=typeof module&&(module.exports=a)}(); -------------------------------------------------------------------------------- /public/assets/js/twitter.min.js: -------------------------------------------------------------------------------- 1 | /*! showdown 06-01-2015 */ 2 | !function(){var a=function(){return[{type:"lang",regex:"\\B(\\\\)?@([\\S]+)\\b",replace:function(a,b,c){return"\\"===b?a:'@'+c+""}},{type:"lang",regex:"\\B(\\\\)?#([\\S]+)\\b",replace:function(a,b,c){return"\\"===b?a:'#'+c+""}},{type:"lang",regex:"\\\\@",replace:"@"}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.twitter=a),"undefined"!=typeof module&&(module.exports=a)}(); -------------------------------------------------------------------------------- /public/css/app.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 70px; 3 | margin-bottom: 60px; } 4 | 5 | html { 6 | position: relative; 7 | min-height: 100%; } 8 | 9 | .footer { 10 | position: absolute; 11 | bottom: 0; 12 | width: 100%; 13 | /* Set the fixed height of the footer here */ 14 | height: 60px; 15 | background-color: #f5f5f5; } 16 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ytake/Laravel5.BasicArchitecture/be0fe708dee0a7c6b3e0667f604b9ceacafae978/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | 9 | /* 10 | |-------------------------------------------------------------------------- 11 | | Register The Auto Loader 12 | |-------------------------------------------------------------------------- 13 | | 14 | | Composer provides a convenient, automatically generated class loader for 15 | | our application. We just need to utilize it! We'll simply require it 16 | | into the script here so that we don't have to worry about manual 17 | | loading any of our classes later on. It feels nice to relax. 18 | | 19 | */ 20 | 21 | require __DIR__.'/../bootstrap/autoload.php'; 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Turn On The Lights 26 | |-------------------------------------------------------------------------- 27 | | 28 | | We need to illuminate PHP development, so let us turn on the lights. 29 | | This bootstraps the framework and gets it ready for use, then it 30 | | will load up this application so that we can run it and send 31 | | the responses back to the browser and delight our users. 32 | | 33 | */ 34 | 35 | $app = require_once __DIR__.'/../bootstrap/app.php'; 36 | 37 | /* 38 | |-------------------------------------------------------------------------- 39 | | Run The Application 40 | |-------------------------------------------------------------------------- 41 | | 42 | | Once we have the application, we can simply call the run method, 43 | | which will execute the request and send the response back to 44 | | the client's browser allowing them to enjoy the creative 45 | | and wonderful application we have prepared for them. 46 | | 47 | */ 48 | 49 | $kernel = $app->make('Illuminate\Contracts\Http\Kernel'); 50 | 51 | $response = $kernel->handle( 52 | $request = Illuminate\Http\Request::capture() 53 | ); 54 | 55 | $response->send(); 56 | 57 | $kernel->terminate($request, $response); 58 | -------------------------------------------------------------------------------- /public/js/markdown.js: -------------------------------------------------------------------------------- 1 | var converter=new Showdown.converter({extensions:["github"]}),MarkdownEditor=React.createClass({displayName:"MarkdownEditor",getInitialState:function(){return{value:""}},readMarkdown:function(){$.ajax({url:this.props.callUri,dataType:"json",type:"GET",success:function(e){this.setState({value:e.markdown})}.bind(this),error:function(){}.bind(this)})},componentDidMount:function(){this.readMarkdown()},handleChange:function(){var e=this.refs.textarea.getDOMNode().value;this.setState({value:e}),$.ajax({url:this.props.callUri,dataType:"json",type:"POST",headers:{"X-XSRF-TOKEN":$('meta[name="_token"]').attr("content")},data:{markdown:this.state.value},success:function(){}.bind(this),error:function(){}.bind(this)})},render:function(){return React.createElement("div",{className:"MarkdownEditor"},React.createElement("div",{className:"col-lg-6"},React.createElement("h3",null,"Markdown Editor"),React.createElement("textarea",{rows:"20",className:"form-control",onChange:this.handleChange,ref:"textarea",value:this.state.value})),React.createElement("div",{className:"col-lg-6"},React.createElement("h3",null,"Preview"),React.createElement("div",{className:"preview",dangerouslySetInnerHTML:{__html:converter.makeHtml(this.state.value)}})))}});React.renderComponent(React.createElement(MarkdownEditor,{callUri:"/api/v1/markdown"}),document.querySelector(".markdown")); -------------------------------------------------------------------------------- /public/js/todo.js: -------------------------------------------------------------------------------- 1 | var TodoList=React.createClass({displayName:"TodoList",propTypes:{items:React.PropTypes.array},createItem:function(e){return React.createElement("li",null,e.title,1!==e.id&&2!==e.id?React.createElement("a",{href:"#",onClick:this.props.handleDelete.bind(this,e)},React.createElement("i",{className:"mdi-toggle-check-box"})):null)},render:function(){return React.createElement("ul",null,this.props.items.map(this.createItem))}}),ToDoErrors=React.createClass({displayName:"ToDoErrors",render:function(){return React.createElement("div",{className:"alert alert-dismissable alert-warning"},React.createElement("h4",null,"error!"),React.createElement("p",null,this.props.items))}}),TodoApp=React.createClass({displayName:"TodoApp",getInitialState:function(){return{items:[],title:""}},onChange:function(e){this.setState({title:e.target.value})},loadTodoTasks:function(){this.ajaxRequest("GET",this.props.callUri,[])},componentDidMount:function(){this.loadTodoTasks()},handleSubmit:function(e){e.preventDefault(),this.ajaxRequest("POST",this.props.callUri,{title:this.state.title})},ajaxRequest:function(e,t,a){$.ajax({url:t,dataType:"json",type:e,headers:{"X-XSRF-TOKEN":$('meta[name="_token"]').attr("content")},data:a,success:function(e){this.setState({items:e,error:!1,title:""})}.bind(this),error:function(e){this.setState({error:e.responseJSON.title,title:""})}.bind(this)})},handleDelete:function(e,t){t.preventDefault(),this.ajaxRequest("DELETE",this.props.callUri+"/"+e.id,[])},render:function(){return React.createElement("div",null,React.createElement("h3",null,"TODO"),React.createElement(TodoList,{items:this.state.items,handleDelete:this.handleDelete}),this.state.error?React.createElement(ToDoErrors,{items:this.state.error}):null,React.createElement("form",{onSubmit:this.handleSubmit},React.createElement("div",{className:"form-control-wrapper"},React.createElement("input",{onChange:this.onChange,value:this.state.title,className:"form-control empty"})),React.createElement("button",{className:"btn btn-primary"},"Add #"+(this.state.items.length+1))))}});React.renderComponent(React.createElement(TodoApp,{callUri:"/api/v1/todo"}),document.getElementById("todo")); -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/js/react/markdown.jsx: -------------------------------------------------------------------------------- 1 | var converter = new Showdown.converter({ extensions: ['github'] }); 2 | var MarkdownEditor = React.createClass({ 3 | getInitialState: function () { 4 | return { 5 | value: '' 6 | }; 7 | }, 8 | readMarkdown: function() { 9 | $.ajax({ 10 | url: this.props.callUri, 11 | dataType: 'json', 12 | type: 'GET', 13 | success: function(data) { 14 | this.setState( 15 | { 16 | value: data.markdown 17 | } 18 | ); 19 | }.bind(this), 20 | error: function(xhr, status, err) { 21 | 22 | }.bind(this) 23 | }); 24 | }, 25 | componentDidMount: function() { 26 | this.readMarkdown(); 27 | }, 28 | handleChange: function () { 29 | var markdownValue = this.refs.textarea.getDOMNode().value; 30 | this.setState({ 31 | value: markdownValue 32 | }); 33 | $.ajax({ 34 | url: this.props.callUri, 35 | dataType: 'json', 36 | type: 'POST', 37 | headers: { 38 | 'X-XSRF-TOKEN': $('meta[name="_token"]').attr('content') 39 | }, 40 | data: { 41 | markdown: this.state.value 42 | }, 43 | success: function(data) { 44 | 45 | }.bind(this), 46 | error: function(xhr, status, err) { 47 | 48 | }.bind(this) 49 | }); 50 | }, 51 | render: function () { 52 | return ( 53 | 54 |72 | ); 73 | } 74 | }); 75 | 76 | React.renderComponent( 77 |55 |63 |Markdown Editor
56 | 62 |64 |71 |Preview
65 | 70 |, 78 | document.querySelector(".markdown") 79 | ); 80 | -------------------------------------------------------------------------------- /resources/js/react/todo.jsx: -------------------------------------------------------------------------------- 1 | /** @jsx React.DOM */ 2 | var TodoList = React.createClass({ 3 | propTypes: { 4 | items: React.PropTypes.array 5 | }, 6 | createItem: function(itemText) { 7 | return 8 | {itemText.title} 9 | {(itemText.id !== 1 && itemText.id !== 2) ? 10 | 11 | : null} 12 | ; 13 | }, 14 | render: function() { 15 | return{this.props.items.map(this.createItem)}
; 16 | } 17 | }); 18 | 19 | var ToDoErrors = React.createClass({ 20 | render: function() { 21 | return ( 22 |23 |26 | ); 27 | } 28 | }); 29 | 30 | var TodoApp = React.createClass({ 31 | getInitialState: function() { 32 | return { 33 | items: [], 34 | title: '' 35 | }; 36 | }, 37 | onChange: function(e) { 38 | this.setState({ 39 | title: e.target.value 40 | }); 41 | }, 42 | loadTodoTasks: function() { 43 | this.ajaxRequest('GET', this.props.callUri, []); 44 | }, 45 | componentDidMount: function() { 46 | this.loadTodoTasks(); 47 | }, 48 | handleSubmit: function(e) { 49 | e.preventDefault(); 50 | this.ajaxRequest("POST", this.props.callUri, {title: this.state.title}); 51 | }, 52 | 53 | ajaxRequest: function(method, url, data) { 54 | $.ajax({ 55 | url: url, 56 | dataType: 'json', 57 | type: method, 58 | headers: { 59 | 'X-XSRF-TOKEN': $('meta[name="_token"]').attr('content') 60 | }, 61 | data: data, 62 | success: function (data) { 63 | this.setState( 64 | { 65 | items: data, 66 | error: false, 67 | title: '' 68 | } 69 | ); 70 | }.bind(this), 71 | error: function (xhr, status, err) { 72 | this.setState( 73 | { 74 | error: xhr.responseJSON.title, 75 | title: '' 76 | } 77 | ); 78 | }.bind(this) 79 | }); 80 | }, 81 | handleDelete: function(itemToDelete, e) { 82 | e.preventDefault(); 83 | this.ajaxRequest("DELETE", this.props.callUri + '/' + itemToDelete.id, []); 84 | }, 85 | render: function() { 86 | return ( 87 |error!
24 |{this.props.items}
25 |88 |98 | ); 99 | } 100 | }); 101 | 102 | React.renderComponent( 103 |TODO
89 |90 | {this.state.error ? : null } 91 | 97 | , 104 | document.getElementById("todo") 105 | ); 106 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | "Passwords must be at least six characters and match the confirmation.", 17 | "user" => "We can't find a user with that e-mail address.", 18 | "token" => "This password reset token is invalid.", 19 | "sent" => "We have e-mailed your password reset link!", 20 | "reset" => "Your password has been reset!", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | "The :attribute must be accepted.", 17 | "active_url" => "The :attribute is not a valid URL.", 18 | "after" => "The :attribute must be a date after :date.", 19 | "alpha" => "The :attribute may only contain letters.", 20 | "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", 21 | "alpha_num" => "The :attribute may only contain letters and numbers.", 22 | "array" => "The :attribute must be an array.", 23 | "before" => "The :attribute must be a date before :date.", 24 | "between" => [ 25 | "numeric" => "The :attribute must be between :min and :max.", 26 | "file" => "The :attribute must be between :min and :max kilobytes.", 27 | "string" => "The :attribute must be between :min and :max characters.", 28 | "array" => "The :attribute must have between :min and :max items.", 29 | ], 30 | "boolean" => "The :attribute field must be true or false.", 31 | "confirmed" => "The :attribute confirmation does not match.", 32 | "date" => "The :attribute is not a valid date.", 33 | "date_format" => "The :attribute does not match the format :format.", 34 | "different" => "The :attribute and :other must be different.", 35 | "digits" => "The :attribute must be :digits digits.", 36 | "digits_between" => "The :attribute must be between :min and :max digits.", 37 | "email" => "The :attribute must be a valid email address.", 38 | "filled" => "The :attribute field is required.", 39 | "exists" => "The selected :attribute is invalid.", 40 | "image" => "The :attribute must be an image.", 41 | "in" => "The selected :attribute is invalid.", 42 | "integer" => "The :attribute must be an integer.", 43 | "ip" => "The :attribute must be a valid IP address.", 44 | "max" => [ 45 | "numeric" => "The :attribute may not be greater than :max.", 46 | "file" => "The :attribute may not be greater than :max kilobytes.", 47 | "string" => "The :attribute may not be greater than :max characters.", 48 | "array" => "The :attribute may not have more than :max items.", 49 | ], 50 | "mimes" => "The :attribute must be a file of type: :values.", 51 | "min" => [ 52 | "numeric" => "The :attribute must be at least :min.", 53 | "file" => "The :attribute must be at least :min kilobytes.", 54 | "string" => "The :attribute must be at least :min characters.", 55 | "array" => "The :attribute must have at least :min items.", 56 | ], 57 | "not_in" => "The selected :attribute is invalid.", 58 | "numeric" => "The :attribute must be a number.", 59 | "regex" => "The :attribute format is invalid.", 60 | "required" => "The :attribute field is required.", 61 | "required_if" => "The :attribute field is required when :other is :value.", 62 | "required_with" => "The :attribute field is required when :values is present.", 63 | "required_with_all" => "The :attribute field is required when :values is present.", 64 | "required_without" => "The :attribute field is required when :values is not present.", 65 | "required_without_all" => "The :attribute field is required when none of :values are present.", 66 | "same" => "The :attribute and :other must match.", 67 | "size" => [ 68 | "numeric" => "The :attribute must be :size.", 69 | "file" => "The :attribute must be :size kilobytes.", 70 | "string" => "The :attribute must be :size characters.", 71 | "array" => "The :attribute must contain :size items.", 72 | ], 73 | "unique" => "The :attribute has already been taken.", 74 | "url" => "The :attribute format is invalid.", 75 | "timezone" => "The :attribute must be a valid zone.", 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Custom Validation Language Lines 80 | |-------------------------------------------------------------------------- 81 | | 82 | | Here you may specify custom validation messages for attributes using the 83 | | convention "attribute.rule" to name the lines. This makes it quick to 84 | | specify a specific custom language line for a given attribute rule. 85 | | 86 | */ 87 | 88 | 'custom' => [ 89 | 'attribute-name' => [ 90 | 'rule-name' => 'custom-message', 91 | ], 92 | ], 93 | 94 | /* 95 | |-------------------------------------------------------------------------- 96 | | Custom Validation Attributes 97 | |-------------------------------------------------------------------------- 98 | | 99 | | The following language lines are used to swap attribute place-holders 100 | | with something more reader friendly such as E-Mail Address instead 101 | | of "email". This simply helps us make messages a little cleaner. 102 | | 103 | */ 104 | 105 | 'attributes' => [], 106 | 107 | ]; 108 | -------------------------------------------------------------------------------- /resources/views/elements/footer.blade.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /resources/views/elements/header.blade.php: -------------------------------------------------------------------------------- 1 | {{-- header --}} 2 | 23 | 24 | -------------------------------------------------------------------------------- /resources/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 33 | 34 | 35 | 36 |40 | 41 | 42 | -------------------------------------------------------------------------------- /resources/views/home/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.default') 2 | @section('content') 3 |37 |39 |Be right back.38 |Laravel5 Sample Application
4 |5 |
26 |- 6 |
12 |7 | Single Page Application 8 |
11 |
9 | basic json response / laravel-elixir / event 10 |- 13 |
19 |14 | RealTime Markdown Editor 15 |
18 |
16 | basic json response / command bus 17 |- 20 |
25 |21 | Simple Form
24 |
22 | no namespace / formRequest 23 |27 |34 | @stop 35 | @section('title') 36 | Laravel5 Tutorial.Application 37 | @stop 38 | @section('styles') 39 | 40 | @stop 41 | -------------------------------------------------------------------------------- /resources/views/layouts/default.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | @yield('meta') 13 |28 |30 |Gulpを動かすにはnode.jsが必要です
29 |31 | http://nodejs.org/ 32 |33 |@yield('title', null) 14 | 15 | 16 | 17 | 18 | 19 | 20 | @yield('styles') 21 | 22 | 23 | @include('elements.header') 24 |25 | @yield('content') 26 |27 | @include('elements.footer') 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | @yield('scripts') 37 | 38 | 39 | -------------------------------------------------------------------------------- /resources/views/legacy/old/apply.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.default') 2 | @section('content') 3 |4 |16 | @stop 17 | @section('scripts') 18 | 19 | @stop 20 | @section('title') 21 | Simple Form Apply 22 | @stop 23 | @section('styles') 24 | 25 | @stop 26 | -------------------------------------------------------------------------------- /resources/views/legacy/old/confirm.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.default') 2 | @section('content') 3 |5 |15 |Sample Form Apply
6 | 14 |4 |25 | @stop 26 | @section('title') 27 | Simple Form Confirm 28 | @stop 29 | -------------------------------------------------------------------------------- /resources/views/legacy/old/form.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.default') 2 | @section('content') 3 |5 |24 |Sample Form Confirm
6 | 23 |4 |45 | @stop 46 | @section('scripts') 47 | 48 | @stop 49 | @section('styles') 50 | 51 | @stop 52 | @section('title') 53 | Simple Form 54 | @stop 55 | -------------------------------------------------------------------------------- /resources/views/markdown/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.default') 2 | @section('content') 3 |5 |27 |Sample Form
6 |7 | このフォームはLaravel4デフォルトと同様にnamespaceを使わずに実装されています 8 |9 | 26 |28 |44 |composer.jsonは自由に変更ですることができます
29 |このサンプルで利用しているコントローラーは、classmapを利用しています。30 |31 |43 |32 | "autoload": { 33 | "classmap": [ 34 | "database", 35 | "app/Http/Controllers/Old" 36 | ], 37 | "psr-4": { 38 | "App\\": "app/" 39 | } 40 | }, 41 |
42 |4 |10 | @stop 11 | @section('styles') 12 | 13 | @stop 14 | @section('scripts') 15 | 16 | 17 | 18 | @stop 19 | @section('meta') 20 | 21 | @stop 22 | @section('title') 23 | Reqltime Markdown Editor 24 | @stop 25 | -------------------------------------------------------------------------------- /resources/views/todo/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.default') 2 | @section('content') 3 |5 | 8 |9 |4 |49 | ToDo Application with React.js5 |11 |6 | 9 |10 |12 |48 |13 | 46 |47 |
50 | use laravel-elixir (gulp) 51 | @stop 52 | @section('scripts') 53 | 54 | 55 | @stop 56 | @section('title') 57 | Single Page Application with React.js 58 | @stop 59 | @section('styles') 60 | 61 | @stop 62 | @section('meta') 63 | 64 | @stop 65 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | 9 | $uri = urldecode( 10 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 11 | ); 12 | 13 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 14 | // built-in PHP web server. This provides a convenient way to test a Laravel 15 | // application without having installed a "real" web server software here. 16 | if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) { 17 | return false; 18 | } 19 | 20 | require_once __DIR__ . '/public/index.php'; 21 | -------------------------------------------------------------------------------- /storage/.gitignore: -------------------------------------------------------------------------------- 1 | laravel.log 2 | -------------------------------------------------------------------------------- /storage/app/markdown/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !markdown.md 4 | -------------------------------------------------------------------------------- /storage/app/markdown/markdown.md: -------------------------------------------------------------------------------- 1 | ```php 2 | echo "Laravel5 Sample Application"; 3 | ``` 4 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | compiled.php 4 | services.json 5 | events.scanned.php 6 | routes.scanned.php 7 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/Commands/MarkdwonCommandTest.php: -------------------------------------------------------------------------------- 1 | command = new \App\Commands\MarkdownCommand("testing"); 11 | } 12 | 13 | public function tearDown() 14 | { 15 | parent::tearDown(); 16 | } 17 | 18 | public function test() 19 | { 20 | $stubFile = base_path("tests/resources/testing.md"); 21 | $repository = new \App\Repositories\MarkdownRepository; 22 | $path = $repository->file($stubFile); 23 | $this->command->handle($path); 24 | $this->assertSame("testing", $repository->read()); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /tests/ControllersTest.php: -------------------------------------------------------------------------------- 1 | factory = app('Illuminate\Contracts\View\Factory'); 14 | } 15 | 16 | public function tearDown() 17 | { 18 | parent::tearDown(); 19 | m::close(); 20 | } 21 | 22 | public function testHomeController() 23 | { 24 | $homeController = new \App\Http\Controllers\HomeController(); 25 | $this->assertInstanceOf("Illuminate\View\View", $homeController->index()); 26 | $response = new \Illuminate\Http\Response($this->factory->make('home.index')); 27 | $this->assertArrayNotHasKey('xsrf_token', $response->original->getData()); 28 | $response = $this->call("GET", ""); 29 | $this->assertSame(200, $response->getStatusCode()); 30 | $response = $this->call("POST", ""); 31 | $this->assertSame(302, $response->getStatusCode()); 32 | } 33 | 34 | public function testToDoController() 35 | { 36 | $todoController = new \App\Http\Controllers\ToDoController(); 37 | $this->assertInstanceOf("Illuminate\View\View", $todoController->index()); 38 | $response = new \Illuminate\Http\Response($this->factory->make('todo.index')); 39 | $this->assertArrayHasKey('xsrf_token', $response->original->getData()); 40 | $response = $this->call("GET", "/todo"); 41 | $this->assertSame(200, $response->getStatusCode()); 42 | $response = $this->call("POST", "/todo"); 43 | $this->assertSame(302, $response->getStatusCode()); 44 | } 45 | 46 | public function testMarkdownController() 47 | { 48 | $todoController = new \App\Http\Controllers\MarkdownController(); 49 | $this->assertInstanceOf("Illuminate\View\View", $todoController->index()); 50 | $response = new \Illuminate\Http\Response($this->factory->make('markdown.index')); 51 | $this->assertArrayHasKey('xsrf_token', $response->original->getData()); 52 | $response = $this->call("GET", "/markdown"); 53 | $this->assertSame(200, $response->getStatusCode()); 54 | $response = $this->call("POST", "/markdown"); 55 | $this->assertSame(302, $response->getStatusCode()); 56 | } 57 | 58 | public function testApiMarkdownController() 59 | { 60 | \App::bind("Illuminate\Contracts\Bus\Dispatcher", "MockCommandBus"); 61 | $stubFile = base_path("tests/resources/testing.md"); 62 | $repository = new \App\Repositories\MarkdownRepository; 63 | $path = $repository->file($stubFile); 64 | $markdownController = new \App\Http\Controllers\Api\MarkdownController($path); 65 | $this->assertInstanceOf("Illuminate\Http\Response", $response = $markdownController->index()); 66 | $this->assertInstanceOf("stdClass", json_decode($response->getContent())); 67 | $request = new \App\Http\Requests\MarkdownRequest; 68 | $request['markdown'] = "testing"; 69 | $this->assertInstanceOf("Illuminate\Http\Response", $markdownController->store($request)); 70 | 71 | $response = $this->call("GET", "/api/v1/markdown"); 72 | $this->assertSame(200, $response->getStatusCode()); 73 | $response = $this->call("POST", "/api/v1/markdown", ["_token" => \Session::token()]); 74 | $this->assertSame(403, $response->getStatusCode()); 75 | $response = $this->call("POST", "/api/v1/markdown", ["_token" => \Session::token(), 'markdown' => 'testing']); 76 | $this->assertSame(200, $response->getStatusCode()); 77 | } 78 | 79 | public function testApiToDoController() 80 | { 81 | $repository = new \App\Repositories\ToDoRepository(); 82 | $todoController = new \App\Http\Controllers\Api\ToDoController($repository); 83 | $this->assertInstanceOf("Illuminate\Http\Response", $response = $todoController->index()); 84 | $this->assertInternalType("array", json_decode($response->getContent())); 85 | $request = new \App\Http\Requests\ToDoRequest; 86 | $request['title'] = "testing"; 87 | $dispatcher = \App::make("Illuminate\Contracts\Events\Dispatcher"); 88 | 89 | $this->assertInstanceOf("Illuminate\Http\Response", 90 | $todoController->store($request, $dispatcher) 91 | ); 92 | 93 | $response = $this->call("GET", "/api/v1/todo"); 94 | $this->assertSame(200, $response->getStatusCode()); 95 | $response = $this->call("POST", "/api/v1/todo", ["_token" => \Session::token()]); 96 | $this->assertSame(302, $response->getStatusCode()); 97 | $response = $this->call("POST", "/api/v1/todo", ["_token" => \Session::token(), 'title' => 'testing']); 98 | $this->assertSame(200, $response->getStatusCode()); 99 | $response = $this->call("DELETE", "/api/v1/todo/1", ["_token" => \Session::token()]); 100 | $this->assertSame(200, $response->getStatusCode()); 101 | } 102 | 103 | public function testLegacyController() 104 | { 105 | $controller = new LegacyController(); 106 | $this->assertInstanceOf("Illuminate\View\View", $controller->getForm()); 107 | $request = new \App\Http\Requests\LegacyFormRequest(); 108 | $this->assertInstanceOf("Illuminate\View\View", $controller->postConfirm($request)); 109 | $this->assertInstanceOf("Illuminate\View\View", $controller->postApply(new \Illuminate\Http\Request())); 110 | \Illuminate\Support\Facades\Request::setSession(\Session::driver('array')); 111 | $response = $this->call("GET", "/legacy/form"); 112 | $this->assertSame(200, $response->getStatusCode()); 113 | $response = $this->call("POST", "/legacy/confirm"); 114 | $this->assertSame(302, $response->getStatusCode()); 115 | $response = $this->call("POST", "/legacy/apply"); 116 | $this->assertSame(302, $response->getStatusCode()); 117 | 118 | $request = [ 119 | 'name' => "mame", 120 | 'email' => 'yuuki.takezawa@comnect.jp.net', 121 | "_token" => \Session::token() 122 | ]; 123 | $response = $this->call("POST", "/legacy/confirm", $request); 124 | $this->assertSame(200, $response->getStatusCode()); 125 | $response = $this->call("POST", "/legacy/apply", $request); 126 | $this->assertSame(200, $response->getStatusCode()); 127 | 128 | $response = $this->call("POST", "/legacy/confirm", [], [], [], ['X-Requested-With' => 'XMLHttpRequest']); 129 | $this->assertSame(302, $response->getStatusCode()); 130 | 131 | } 132 | } 133 | 134 | 135 | class MockCommandBus implements \Illuminate\Contracts\Bus\Dispatcher 136 | { 137 | /** 138 | * Marshal a command and dispatch it to its appropriate handler. 139 | * 140 | * @param mixed $command 141 | * @param array $array 142 | * @return mixed 143 | */ 144 | public function dispatchFromArray($command, array $array) 145 | { 146 | // TODO: Implement dispatchFromArray() method. 147 | } 148 | 149 | /** 150 | * Marshal a command and dispatch it to its appropriate handler. 151 | * 152 | * @param mixed $command 153 | * @param \ArrayAccess $source 154 | * @param array $extras 155 | * @return mixed 156 | */ 157 | public function dispatchFrom($command, ArrayAccess $source, array $extras = []) 158 | { 159 | // TODO: Implement dispatchFrom() method. 160 | } 161 | 162 | /** 163 | * Dispatch a command to its appropriate handler. 164 | * 165 | * @param mixed $command 166 | * @param \Closure|null $afterResolving 167 | * @return mixed 168 | */ 169 | public function dispatch($command, Closure $afterResolving = null) 170 | { 171 | // TODO: Implement dispatch() method. 172 | } 173 | 174 | /** 175 | * Dispatch a command to its appropriate handler in the current process. 176 | * 177 | * @param mixed $command 178 | * @param \Closure|null $afterResolving 179 | * @return mixed 180 | */ 181 | public function dispatchNow($command, Closure $afterResolving = null) 182 | { 183 | // TODO: Implement dispatchNow() method. 184 | } 185 | 186 | /** 187 | * Set the pipes commands should be piped through before dispatching. 188 | * 189 | * @param array $pipes 190 | * @return $this 191 | */ 192 | public function pipeThrough(array $pipes) 193 | { 194 | // TODO: Implement pipeThrough() method. 195 | } 196 | 197 | } 198 | -------------------------------------------------------------------------------- /tests/Events/ToDoEventTest.php: -------------------------------------------------------------------------------- 1 | events = new ToDoEvent(\App::make('log')); 15 | $this->file = new \Illuminate\Filesystem\Filesystem; 16 | } 17 | 18 | public function tearDown() 19 | { 20 | parent::tearDown(); 21 | } 22 | 23 | public function testHandler() 24 | { 25 | $this->events->handle(); 26 | $this->assertTrue($this->file->exists(storage_path('logs/todo.log'))); 27 | } 28 | } -------------------------------------------------------------------------------- /tests/ExampleTest.php: -------------------------------------------------------------------------------- 1 | call('GET', '/'); 13 | 14 | $this->assertEquals(200, $response->getStatusCode()); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /tests/ExceptionHandlerTest.php: -------------------------------------------------------------------------------- 1 | exception = new \App\Exceptions\Handler(\App::make('log')); 13 | } 14 | 15 | public function testRender() 16 | { 17 | $exception = $this->exception->render( 18 | new \Illuminate\Http\Request(), 19 | new \Illuminate\Session\TokenMismatchException() 20 | ); 21 | $this->assertInstanceOf("Illuminate\Http\RedirectResponse", $exception); 22 | } 23 | } -------------------------------------------------------------------------------- /tests/Renders/XsrfTokenComposerTest.php: -------------------------------------------------------------------------------- 1 | composer = new XsrfTokenComposer( 14 | \App::make("Illuminate\Contracts\Encryption\Encrypter") 15 | ); 16 | } 17 | 18 | public function testViewComposer() 19 | { 20 | /** @var Illuminate\View\Factory $factory */ 21 | $factory = app('Illuminate\Contracts\View\Factory'); 22 | $response = new \Illuminate\Http\Response($factory->make('markdown.index')); 23 | $this->assertArrayHasKey('xsrf_token', $response->original->getData()); 24 | } 25 | } -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | make('Illuminate\Contracts\Console\Kernel')->bootstrap(); 15 | 16 | return $app; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tests/ToDoRepositoryTest.php: -------------------------------------------------------------------------------- 1 | repository = new \App\Repositories\ToDoRepository(); 11 | } 12 | 13 | public function testAll() 14 | { 15 | $this->assertInternalType("array", $this->repository->all()); 16 | $this->assertCount(2, $this->repository->all()); 17 | } 18 | 19 | public function testStore() 20 | { 21 | $this->repository->store("testing"); 22 | foreach($this->repository->all() as $row) { 23 | $this->assertContains($row['title'], ["hello", "Laravel5", "testing"]); 24 | } 25 | $this->assertCount(3, $this->repository->all()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/resources/testing.md: -------------------------------------------------------------------------------- 1 | testing --------------------------------------------------------------------------------