├── .env.example
├── .gitattributes
├── .gitignore
├── .htaccess
├── app
├── Console
│ ├── Commands
│ │ └── Inspire.php
│ └── Kernel.php
├── Events
│ └── Event.php
├── Exceptions
│ └── Handler.php
├── Http
│ ├── Controllers
│ │ ├── Auth
│ │ │ ├── AuthController.php
│ │ │ └── PasswordController.php
│ │ ├── AuthenticateController.php
│ │ ├── Controller.php
│ │ ├── HomeController.php
│ │ └── PostController.php
│ ├── Kernel.php
│ ├── Middleware
│ │ ├── Authenticate.php
│ │ ├── Cors.php
│ │ ├── EncryptCookies.php
│ │ ├── RedirectIfAuthenticated.php
│ │ └── VerifyCsrfToken.php
│ ├── Requests
│ │ └── Request.php
│ └── routes.php
├── Jobs
│ └── Job.php
├── Listeners
│ └── .gitkeep
├── Policies
│ └── .gitkeep
├── Post.php
├── Providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
└── User.php
├── artisan
├── artisan.bat
├── bootstrap
├── app.php
├── autoload.php
└── cache
│ └── .gitignore
├── client-app
├── .babelrc
├── .gitignore
├── index.html
├── package.json
├── src
│ ├── actions
│ │ ├── index.js
│ │ └── types.js
│ ├── components
│ │ ├── app.js
│ │ ├── auth
│ │ │ ├── #login.js#
│ │ │ ├── auth_check.js
│ │ │ ├── login.js
│ │ │ ├── logout.js
│ │ │ └── register.js
│ │ ├── header.js
│ │ ├── posts
│ │ │ ├── add_post.js
│ │ │ ├── edit_post.js
│ │ │ ├── posts.js
│ │ │ └── posts_show.js
│ │ └── welcome.js
│ ├── index.js
│ └── reducers
│ │ ├── auth_reducer.js
│ │ ├── index.js
│ │ └── post_reducer.js
├── style
│ └── style.css
├── test
│ ├── components
│ │ └── app_test.js
│ └── test_helper.js
└── webpack.config.js
├── composer.json
├── composer.lock
├── config
├── app.php
├── auth.php
├── broadcasting.php
├── cache.php
├── compile.php
├── database.php
├── filesystems.php
├── jwt.php
├── mail.php
├── queue.php
├── services.php
├── session.php
└── view.php
├── database
├── .gitignore
├── factories
│ └── ModelFactory.php
├── migrations
│ ├── .gitkeep
│ ├── 2014_10_12_000000_create_users_table.php
│ ├── 2014_10_12_100000_create_password_resets_table.php
│ └── 2016_04_24_210614_create_posts_table.php
└── seeds
│ ├── .gitkeep
│ └── DatabaseSeeder.php
├── gulpfile.js
├── npm-debug.log
├── package.json
├── phpunit.xml
├── public
├── .htaccess
├── favicon.ico
├── img.png
├── index.php
├── npm-debug.log
├── robots.txt
└── web.config
├── readme.md
├── resources
├── assets
│ └── sass
│ │ └── app.scss
├── lang
│ └── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
└── views
│ ├── auth
│ ├── emails
│ │ └── password.blade.php
│ ├── login.blade.php
│ ├── passwords
│ │ ├── email.blade.php
│ │ └── reset.blade.php
│ └── register.blade.php
│ ├── errors
│ └── 503.blade.php
│ ├── home.blade.php
│ ├── layouts
│ └── app.blade.php
│ ├── vendor
│ └── .gitkeep
│ └── welcome.blade.php
├── server.php
├── storage
├── app
│ ├── .gitignore
│ └── public
│ │ └── .gitignore
├── framework
│ ├── .gitignore
│ ├── cache
│ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
├── tags
└── tests
├── ExampleTest.php
├── PostTest.php
└── TestCase.php
/.env.example:
--------------------------------------------------------------------------------
1 | APP_ENV=local
2 | APP_DEBUG=true
3 | APP_KEY=SomeRandomString
4 | APP_URL=http://localhost
5 |
6 | DB_CONNECTION=mysql
7 | DB_HOST=127.0.0.1
8 | DB_PORT=3306
9 | DB_DATABASE=homestead
10 | DB_USERNAME=homestead
11 | DB_PASSWORD=secret
12 |
13 | CACHE_DRIVER=file
14 | SESSION_DRIVER=file
15 | QUEUE_DRIVER=sync
16 |
17 | REDIS_HOST=127.0.0.1
18 | REDIS_PASSWORD=null
19 | REDIS_PORT=6379
20 |
21 | MAIL_DRIVER=smtp
22 | MAIL_HOST=mailtrap.io
23 | MAIL_PORT=2525
24 | MAIL_USERNAME=null
25 | MAIL_PASSWORD=null
26 | MAIL_ENCRYPTION=null
27 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.less linguist-vendored
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /node_modules
3 | /public/storage
4 | Homestead.yaml
5 | Homestead.json
6 | .env
7 | .idea
--------------------------------------------------------------------------------
/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews
4 |
5 |
6 | RewriteEngine On
7 |
8 |
9 |
10 |
11 | # Handle Front Controller...
12 | RewriteCond %{REQUEST_FILENAME} !-d
13 | RewriteCond %{REQUEST_FILENAME} !-f
14 | RewriteRule ^ index.php [L]
15 |
16 | RewriteEngine On
17 | RewriteCond %{HTTP:Authorization} ^(.*)
18 | RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
19 |
20 | # Handle Authorization Header
21 |
22 |
--------------------------------------------------------------------------------
/app/Console/Commands/Inspire.php:
--------------------------------------------------------------------------------
1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | // ->hourly();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Events/Event.php:
--------------------------------------------------------------------------------
1 | middleware($this->guestMiddleware(), ['except' => 'logout']);
41 | }
42 |
43 | /**
44 | * Get a validator for an incoming registration request.
45 | *
46 | * @param array $data
47 | * @return \Illuminate\Contracts\Validation\Validator
48 | */
49 | protected function validator(array $data)
50 | {
51 | return Validator::make($data, [
52 | 'name' => 'required|max:255',
53 | 'email' => 'required|email|max:255|unique:users',
54 | 'password' => 'required|min:6|confirmed',
55 | ]);
56 | }
57 |
58 | /**
59 | * Create a new user instance after a valid registration.
60 | *
61 | * @param array $data
62 | * @return User
63 | */
64 | protected function create(array $data)
65 | {
66 | return User::create([
67 | 'name' => $data['name'],
68 | 'email' => $data['email'],
69 | 'password' => bcrypt($data['password']),
70 | ]);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/PasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Http/Controllers/AuthenticateController.php:
--------------------------------------------------------------------------------
1 | only('email', 'password');
24 |
25 | $validator = \Validator::make($credentials, [
26 | 'email' => 'required|email|unique:users',
27 | 'password' => 'required'
28 | ]);
29 |
30 | if ($validator->fails()) {
31 | return response()->json(['error' => 'This user such a already exist'], 422);
32 | }
33 |
34 | $user = User::create($credentials);
35 | $token = JWTAuth::fromUser($user);
36 |
37 | return response()->json(compact('token'));
38 | }
39 |
40 | public function authenticate(Request $request)
41 | {
42 | // grab credentials from the request
43 | $credentials = $request->only('email', 'password');
44 |
45 | try {
46 | // attempt to verify the credentials and create a token for the user
47 | if (! $token = JWTAuth::attempt($credentials)) {
48 | return response()->json(['error' => 'invalid_credentials'], 401);
49 | }
50 | } catch (JWTException $e) {
51 | // something went wrong whilst attempting to encode the token
52 | return response()->json(['error' => 'could_not_create_token'], 500);
53 | }
54 |
55 | // all good so return the token
56 | return response()->json(compact('token'));
57 | }
58 |
59 | protected function create(array $data)
60 | {
61 | return User::create([
62 | 'email' => $data['email'],
63 | 'password' => bcrypt($data['password']),
64 | ]);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
18 | }
19 |
20 | /**
21 | * Show the application dashboard.
22 | *
23 | * @return \Illuminate\Http\Response
24 | */
25 | public function index()
26 | {
27 | return view('home');
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/Http/Controllers/PostController.php:
--------------------------------------------------------------------------------
1 | json($posts,200);
17 | }
18 |
19 | public function store(Request $request)
20 | {
21 | $post = Post::create([
22 | 'title' => $request->input("title"),
23 | 'body' => $request->input('body'),
24 | 'user_id' => 1
25 | ]);
26 | }
27 |
28 | public function show ($id){
29 | $post = Post::find($id);
30 |
31 | return response()->json($post,200);
32 | }
33 |
34 | public function edit ($id){
35 | $post = Post::find($id);
36 |
37 | return response()->json($post,200);
38 | }
39 |
40 | public function update($id,Request $request)
41 | {
42 | $post = Post::find($id);
43 | $post->update([
44 | 'title' => $request->input("title"),
45 | 'body' => $request->input('body'),
46 | 'user_id' => 1
47 | ]);
48 |
49 | return response()->json("UPDATED",200);
50 | }
51 |
52 | public function destroy($id)
53 | {
54 | $post = Post::find($id);
55 | $post->delete();
56 |
57 | return response()->json("DELETED",200);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 | [
27 | \App\Http\Middleware\EncryptCookies::class,
28 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
29 | \Illuminate\Session\Middleware\StartSession::class,
30 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
31 | //\App\Http\Middleware\VerifyCsrfToken::class,
32 | ],
33 |
34 | 'api' => [
35 | 'throttle:60,1',
36 | ],
37 | ];
38 |
39 | /**
40 | * The application's route middleware.
41 | *
42 | * These middleware may be assigned to groups or used individually.
43 | *
44 | * @var array
45 | */
46 | protected $routeMiddleware = [
47 | 'auth' => \App\Http\Middleware\Authenticate::class,
48 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
49 | 'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
50 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
51 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
52 | 'jwt.auth' => 'Tymon\JWTAuth\Middleware\GetUserFromToken',
53 | 'jwt.refresh' => 'Tymon\JWTAuth\Middleware\RefreshToken',
54 | 'cors' => \App\Http\Middleware\Cors::class,
55 | ];
56 | }
57 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | guest()) {
21 | if ($request->ajax() || $request->wantsJson()) {
22 | return response('Unauthorized.', 401);
23 | } else {
24 | return redirect()->guest('login');
25 | }
26 | }
27 |
28 | return $next($request);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Cors.php:
--------------------------------------------------------------------------------
1 | isMethod('options')) {
21 | return response('', 200)
22 | ->header('Access-Control-Allow-Origin:','http://localhost:8080')
23 | ->header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT, DELETE')
24 | ->header('Access-Control-Allow-Headers', 'accept, content-type, x-xsrf-token, x-csrf-token'); // Add any required headers here
25 | }
26 | return $next($request);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
21 | return redirect('/');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 | 'api', 'middleware' => 'cors'], function () {
23 | Route::post("login", "AuthenticateController@authenticate");
24 | Route::post('/register', 'AuthenticateController@register');
25 |
26 | Route::group(['middleware' => 'jwt.auth'], function () {
27 | Route::resource('posts', 'PostController');
28 | Route::get('userinfo', function () {
29 | return JWTAuth::parseToken()->authenticate();
30 | });
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/app/Jobs/Job.php:
--------------------------------------------------------------------------------
1 | orderBy('id','DESC')->get();
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
17 | ];
18 |
19 | /**
20 | * Register any application authentication / authorization services.
21 | *
22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate
23 | * @return void
24 | */
25 | public function boot(GateContract $gate)
26 | {
27 | $this->registerPolicies($gate);
28 |
29 | //
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
17 | 'App\Listeners\EventListener',
18 | ],
19 | ];
20 |
21 | /**
22 | * Register any other events for your application.
23 | *
24 | * @param \Illuminate\Contracts\Events\Dispatcher $events
25 | * @return void
26 | */
27 | public function boot(DispatcherContract $events)
28 | {
29 | parent::boot($events);
30 |
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | mapWebRoutes($router);
41 |
42 | //
43 | }
44 |
45 | /**
46 | * Define the "web" routes for the application.
47 | *
48 | * These routes all receive session state, CSRF protection, etc.
49 | *
50 | * @param \Illuminate\Routing\Router $router
51 | * @return void
52 | */
53 | protected function mapWebRoutes(Router $router)
54 | {
55 | $router->group([
56 | 'namespace' => $this->namespace, 'middleware' => 'web',
57 | ], function ($router) {
58 | require app_path('Http/routes.php');
59 | });
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/User.php:
--------------------------------------------------------------------------------
1 | make(Illuminate\Contracts\Console\Kernel::class);
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 |
--------------------------------------------------------------------------------
/artisan.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 | php artisan %*
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | singleton(
30 | Illuminate\Contracts\Http\Kernel::class,
31 | App\Http\Kernel::class
32 | );
33 |
34 | $app->singleton(
35 | Illuminate\Contracts\Console\Kernel::class,
36 | App\Console\Kernel::class
37 | );
38 |
39 | $app->singleton(
40 | Illuminate\Contracts\Debug\ExceptionHandler::class,
41 | App\Exceptions\Handler::class
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 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/client-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-redux-starter-tool",
3 | "version": "1.0.0",
4 | "description": "Simple starter package for Redux with React and Babel support",
5 | "main": "index.js",
6 | "repository": "git@github.com:onerciller/react-redux-starter-tool.git",
7 | "scripts": {
8 | "start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
9 | "test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
10 | "test:watch": "npm run test -- --watch"
11 | },
12 | "author": "",
13 | "license": "ISC",
14 | "devDependencies": {
15 | "babel-core": "^6.2.1",
16 | "babel-loader": "^6.2.0",
17 | "babel-preset-es2015": "^6.1.18",
18 | "babel-preset-react": "^6.1.18",
19 | "chai": "^3.5.0",
20 | "chai-jquery": "^2.0.0",
21 | "jquery": "^2.2.1",
22 | "jsdom": "^8.1.0",
23 | "mocha": "^2.4.5",
24 | "react-addons-test-utils": "^0.14.7",
25 | "webpack": "^1.12.9",
26 | "webpack-dev-server": "^1.14.0"
27 | },
28 | "dependencies": {
29 | "axios": "^0.9.1",
30 | "babel-preset-stage-1": "^6.1.18",
31 | "jwt-decode": "^2.0.1",
32 | "lodash": "^3.10.1",
33 | "react": "^0.14.3",
34 | "react-bootstrap": "^0.29.4",
35 | "react-dom": "^0.14.3",
36 | "react-loader": "^2.4.0",
37 | "react-redux": "^4.0.0",
38 | "react-router": "^2.0.1",
39 | "redux": "^3.0.4",
40 | "redux-form": "^5.1.3",
41 | "redux-promise": "^0.5.3",
42 | "redux-thunk": "^2.0.1",
43 | "spinkit": "^1.2.5"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/client-app/src/actions/index.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios';
2 | import jwtdecode from 'jwt-decode';
3 | import {browserHistory} from 'react-router';
4 | import {AUTH_USER,AUTH_ERROR,LOGOUT_USER,FETCH_POST,ADD_POST,POST_SHOW,DELETE_POST,EDIT_POST,
5 | UPDATE_POST,FETCH_POST_SUCCESS,EDIT_POST_SUCCESS,POST_SHOW_SUCCESS,UPDATE_POST_SUCCESS,
6 | USER_INFO_SUCCESS,USER_INFO} from './types';
7 | const ROOT_URL = 'http://localhost:8000';
8 | export function loginUser({email,password}){
9 | return function(dispatch){
10 | axios.post(`${ROOT_URL}/api/login`,{email,password})
11 | .then(response => {
12 | dispatch({type: AUTH_USER,
13 | payload:response.data.token
14 | });
15 | localStorage.setItem('token',response.data.token);
16 | browserHistory.push("/posts");
17 | })
18 |
19 | .catch(()=>{
20 | dispatch(authError("Empty Required Field"));
21 | });
22 | }
23 |
24 | }
25 |
26 |
27 | export function userInfo(){
28 | return dispatch => {
29 | axios.get(`${ROOT_URL}/api/userinfo`,{
30 | headers:{authorization:`Bearer`+localStorage.getItem('token')}
31 | })
32 | .then(response =>{
33 | dispatch({
34 | type:USER_INFO_SUCCESS,
35 | payload:response
36 | })
37 | })
38 | }
39 | }
40 |
41 |
42 | export function registerUser({email,password}){
43 | return function(dispatch){
44 | axios.post(`${ROOT_URL}/api/register`,{email,password})
45 | .then(response =>{
46 | dispatch({type:AUTH_USER});
47 | localStorage.setItem('token',response.data.token);
48 | browserHistory.push('/posts');
49 | })
50 | .catch(response => dispatch(authError(response.data.error)));
51 |
52 | }
53 | }
54 |
55 | export function addPost({title,body}){
56 | return function(dispatch){
57 | axios.post(`${ROOT_URL}/api/posts`,{title,body},
58 | {
59 | headers:{authorization:localStorage.getItem('token')}
60 | })
61 | .then(response => {
62 | dispatch({
63 | type:ADD_POST,
64 | payload:response
65 | })
66 | })
67 | }
68 | }
69 |
70 | export function fetchPost(){
71 | return dispatch => {
72 | dispatch({type:FETCH_POST});
73 | axios.get(`${ROOT_URL}/api/posts`,{
74 | headers: { authorization: localStorage.getItem('token') }
75 | })
76 | .then(response =>{
77 | dispatch(fetchPostSuccess(response));
78 | })
79 | }
80 | }
81 |
82 | export function fetchPostSuccess(posts){
83 | return {
84 | type:FETCH_POST_SUCCESS,
85 | payload:posts
86 | };
87 | }
88 |
89 |
90 | export function PostShow(id){
91 | return dispatch =>{
92 | dispatch({type:POST_SHOW});
93 | axios.get(`${ROOT_URL}/api/posts/${id}`,{
94 | headers: { authorization: localStorage.getItem('token') }
95 | })
96 | .then(response =>{
97 | dispatch(postShowSuccess(response));
98 | })
99 |
100 | }
101 | }
102 |
103 | export function postShowSuccess(post){
104 | return {
105 | type:POST_SHOW_SUCCESS,
106 | payload:post
107 | };
108 | }
109 |
110 | export function EditPost(id){
111 | return dispatch =>{
112 | dispatch({type:EDIT_POST});
113 | axios.get(`${ROOT_URL}/api/posts/${id}/edit`,{
114 | headers: { authorization: localStorage.getItem('token') }
115 | })
116 | .then(response =>{
117 | dispatch(editPostSuccess(response))
118 | })
119 | }
120 | }
121 | export function editPostSuccess(posts){
122 | return {
123 | type:EDIT_POST_SUCCESS,
124 | payload:posts
125 | };
126 | }
127 |
128 | export function updatePost(id,{title,body}){
129 | return dispatch =>{
130 | dispatch({type:UPDATE_POST});
131 | axios.put(`${ROOT_URL}/api/posts/${id}`,{title,body},
132 | {
133 | headers:{authorization:localStorage.getItem('token')}
134 | })
135 | .then(response => {
136 | dispatch(updatePostSuccess(response));
137 | });
138 | }
139 | }
140 | export function updatePostSuccess(post){
141 | return {
142 | type:UPDATE_POST_SUCCESS,
143 | response:post
144 | }
145 | }
146 |
147 |
148 |
149 |
150 | export function deletePost(id){
151 | return function(dispatch){
152 | axios.delete(`${ROOT_URL}/api/posts/${id}`,{
153 | headers: { authorization: localStorage.getItem('token') }
154 | })
155 | .then(response =>{
156 | dispatch({
157 | type:DELETE_POST,
158 | payload:response
159 | });
160 | })
161 |
162 | }
163 | }
164 |
165 | export function authError(error){
166 | return {
167 | type:AUTH_ERROR,
168 | payload:error
169 | }
170 | }
171 |
172 | export function logoutUser() {
173 | localStorage.removeItem('token');
174 | return { type: LOGOUT_USER };
175 | }
176 |
--------------------------------------------------------------------------------
/client-app/src/actions/types.js:
--------------------------------------------------------------------------------
1 | export const AUTH_USER = "AUTH_USER";
2 | export const LOGOUT_USER = "LOGOUT_USER";
3 | export const AUTH_ERROR = "AUTH_ERROR";
4 | export const FETCH_POST = "FETCH_POST";
5 | export const ADD_POST = "ADD_POST";
6 | export const POST_SHOW = "POST_SHOW";
7 | export const DELETE_POST = "DELETE_POST";
8 | export const EDIT_POST = "EDIT_POST";
9 | export const UPDATE_POST = "UPDATE_POST";
10 | export const FETCH_POST_SUCCESS = "FETCH_POST_SUCCESS";
11 | export const EDIT_POST_SUCCESS = "EDIT_POST_SUCCESS";
12 | export const POST_SHOW_SUCCESS= "POST_SHOW_SUCCESS";
13 | export const AUTH_USER_INFO = "AUTH_USER_INFO";
14 | export const UPDATE_POST_SUCCESS = "UPDATE_POST_SUCCESS";
15 | export const USER_INFO = "USER_INFO";
16 | export const USER_INFO_SUCCESS = "USER_INFO_SUCCESS";
17 |
--------------------------------------------------------------------------------
/client-app/src/components/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Component } from 'react';
3 | import Header from './header';
4 | export default class App extends Component {
5 | render() {
6 | return (
7 |
8 |
9 |
10 | {this.props.children}
11 |
12 |
13 | );
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/client-app/src/components/auth/#login.js#:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import {reduxForm} from 'redux-form';
3 | import * as actions from '../../actions';
4 |
5 | class Login extends Component{
6 | handleFormSubmit({email,password}){
7 |
8 | this.props.loginUser({email,password});
9 |
10 | }
11 |
12 |
13 | componentWillMount(){
14 | ;
15 | }
16 |
17 |
18 | renderAlert(){
19 | if(this.props.errorMessage){
20 | return (
21 |
22 | {this.props.errorMessage }
23 |
24 | );
25 | }
26 | }
27 |
28 | render(){
29 | const {handleSubmit,fields:{email,password}} = this.props;
30 | return (
31 |
47 | );
48 | }
49 |
50 | }
51 |
52 |
53 | function mapStateToProps(state) {
54 | return { errorMessage: state.auth.error }
55 | }
56 |
57 | export default reduxForm({
58 | form:'login',
59 | fields:['email','password']
60 | },mapStateToProps,actions)(Login);
61 |
--------------------------------------------------------------------------------
/client-app/src/components/auth/auth_check.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { connect } from 'react-redux';
3 |
4 | export default function(ComposedComponent) {
5 | class Authentication extends Component {
6 | static contextTypes = {
7 | router: React.PropTypes.object
8 | }
9 |
10 | componentWillMount() {
11 | if (!this.props.authenticated) {
12 | this.context.router.push('/');
13 | }
14 | }
15 |
16 | componentWillUpdate(nextProps) {
17 | if (!nextProps.authenticated) {
18 | this.context.router.push('/');
19 | }
20 | }
21 |
22 | render() {
23 | return
24 | }
25 | }
26 |
27 | function mapStateToProps(state) {
28 | return { authenticated: state.auth.authenticated };
29 | }
30 |
31 | return connect(mapStateToProps)(Authentication);
32 | }
33 |
--------------------------------------------------------------------------------
/client-app/src/components/auth/login.js:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import {reduxForm} from 'redux-form';
3 | import * as actions from '../../actions';
4 | import {browserHistory} from 'react-router';
5 |
6 | class Login extends Component{
7 | handleFormSubmit({email,password}){
8 |
9 | this.props.loginUser({email,password});
10 | }
11 |
12 | componentWillMount(){
13 | if(this.props.authenticated === true){
14 | browserHistory.push('/');
15 | }
16 | }
17 |
18 | renderAlert(){
19 | if(this.props.errorMessage){
20 | return (
21 |
22 | {this.props.errorMessage }
23 |
24 | );
25 | }
26 | }
27 |
28 | render(){
29 | const {handleSubmit,fields:{email,password}} = this.props;
30 | return (
31 |
47 | );
48 | }
49 |
50 | }
51 |
52 |
53 | function mapStateToProps(state) {
54 | return { errorMessage: state.auth.error,
55 | authenticated:state.auth.authenticated
56 | }
57 | }
58 |
59 | export default reduxForm({
60 | form:'login',
61 | fields:['email','password']
62 | },mapStateToProps,actions)(Login);
63 |
--------------------------------------------------------------------------------
/client-app/src/components/auth/logout.js:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import {connect} from 'react-redux';
3 | import * as actions from '../../actions';
4 | import {browserHistory} from 'react-router';
5 | class Logout extends Component{
6 |
7 | componentWillMount(){
8 | this.props.logoutUser();
9 | browserHistory.push("/");
10 | }
11 |
12 | render(){
13 |
14 | return (
15 |
16 |
17 |
18 |
19 | );
20 | }
21 |
22 | }
23 |
24 | export default connect(null,actions)(Logout);
25 |
--------------------------------------------------------------------------------
/client-app/src/components/auth/register.js:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import {reduxForm} from 'redux-form';
3 | import * as actions from '../../actions';
4 | import {browserHistory} from 'react-router';
5 | class Register extends Component{
6 |
7 | renderAlert(){
8 | if(this.props.errorMessage){
9 | return (
10 |
11 | Ooops !
12 | {this.props.errorMessage}
13 |
14 | )
15 | }
16 | }
17 |
18 | componentWillMount(){
19 | if(this.props.authenticated === true){
20 | browserHistory.push("/");
21 | }
22 | }
23 |
24 | handleFormSubmit(formProps){
25 | this.props.registerUser(formProps);
26 | }
27 |
28 |
29 | render(){
30 | const {handleSubmit,fields:{email,password,passwordConfirmation}} = this.props;
31 | return (
32 |
52 |
53 | );
54 |
55 | }
56 |
57 | }
58 |
59 | function validate(formProps){
60 | const errors = {};
61 |
62 | if(! formProps.email){
63 | errors.email = "Please enter an email!";
64 | }
65 |
66 | if(formProps.password !== formProps.passwordConfirmation){
67 | errors.password = "Password must match";
68 | }
69 |
70 | if(! formProps.passwordConfirmation){
71 | errors.passwordConfirmation = "Please Enter a password confirmation";
72 | }
73 |
74 | return errors;
75 |
76 | }
77 |
78 | function mapStateToProps(state){
79 | return {
80 | errorMessage:state.auth.error,
81 | authenticated:state.auth.authenticated
82 | };
83 | }
84 |
85 | export default reduxForm({
86 | form :'register',
87 | fields:['email','password','passwordConfirmation'],
88 | validate:validate
89 |
90 | },mapStateToProps,actions)(Register);
91 |
--------------------------------------------------------------------------------
/client-app/src/components/header.js:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import {connect} from 'react-redux';
3 | import * as actions from '../actions/index';
4 |
5 | import {Link} from 'react-router';
6 | class Header extends Component {
7 |
8 | userInfo(){
9 | if(this.props.userinfo){
10 | return (
11 |
12 | {this.props.userinfo.name}
13 |
14 | );
15 | }
16 | }
17 |
18 | renderLinks(){
19 | if(this.props.authenticated){
20 | return[
21 |
22 | New Post
23 | ,
24 |
25 | Logout
26 | ,
27 |
28 | ];
29 | }else{
30 | return [
31 |
32 | Register
33 | ,
34 |
35 | Login
36 |
37 | ];
38 | }
39 | }
40 |
41 | render (){
42 | console.log(this.props.userinfo);
43 | return (
44 |
52 | )
53 |
54 | }
55 |
56 |
57 | }
58 | function mapStateToProps(state){
59 | return {
60 | authenticated:state.auth.authenticated,
61 | userinfo:state.auth.userinfo
62 | };
63 | }
64 |
65 | export default connect(mapStateToProps)(Header)
66 |
--------------------------------------------------------------------------------
/client-app/src/components/posts/add_post.js:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import {connect} from 'react-redux';
3 | import {addPost} from '../../actions/index';
4 | import {reduxForm} from 'redux-form';
5 | import {browserHistory} from 'react-router';
6 |
7 | class AddPost extends Component {
8 | static contextTypes = {
9 | router:React.PropTypes.object
10 | };
11 |
12 | handleFormSubmit(formProps){
13 | this.props.addPost(formProps);
14 | this.context.router.push('/posts');
15 | }
16 | render(){
17 | const {handleSubmit,fields:{title,body}} = this.props;
18 | return (
19 |
36 | );
37 |
38 | }
39 |
40 | }
41 |
42 | function validate(formProps){
43 | const errors = {};
44 | if(! formProps.title){
45 | errors.title = "Title is required";
46 | }
47 | if(! formProps.body){
48 | errors.body = "Body is required";
49 | }
50 | return errors;
51 | }
52 |
53 | function mapStateToProps(state){
54 | return {
55 | posts:state.post
56 | }
57 | }
58 |
59 | export default reduxForm({
60 | form:'post',
61 | fields:['title','body'],
62 | validate:validate,
63 | },mapStateToProps,{addPost})(AddPost);
64 |
--------------------------------------------------------------------------------
/client-app/src/components/posts/edit_post.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react';
2 | import * as actions from '../../actions/index';
3 | import { connect } from 'react-redux';
4 | import {reduxForm} from 'redux-form';
5 | import {initialize} from 'redux-form';
6 |
7 | class EditPost extends Component {
8 | static contextTypes = {
9 | router:PropTypes.object
10 | }
11 |
12 | componentWillMount(){
13 | this.props.EditPost(this.props.params.id);
14 | }
15 |
16 |
17 | handleFormSubmit(formProps){
18 | this.props.updatePost(this.props.params.id,formProps);
19 | if(this.props.updatePostStatus.post == true){
20 | this.context.router.push('/posts');
21 | }
22 | }
23 |
24 | render(){
25 | const {handleSubmit,fields:{title,body}} = this.props;
26 | if(!this.props.edit){
27 | return ;
28 | }
29 | return (
30 |
31 |
32 |
33 |
46 |
47 |
48 |
49 | );
50 | }
51 |
52 | }
53 |
54 | function mapStateToProps(state) {
55 | return {
56 | edit:state.posts.editPost,
57 | initialValues: state.posts.editPost.post,
58 | updatePostStatus: state.posts.updatePost
59 | }
60 | }
61 | export default reduxForm({
62 | form:'edit',
63 | fields:['title','body'],
64 | },mapStateToProps,actions)(EditPost);
65 |
--------------------------------------------------------------------------------
/client-app/src/components/posts/posts.js:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import {connect} from 'react-redux';
3 | import * as actions from '../../actions/index';
4 | import {Link} from 'react-router';
5 | import spinner from 'react-loader';
6 | class Posts extends Component {
7 |
8 | componentWillMount(){
9 | this.props.fetchPost();
10 | this.props.userInfo();
11 | }
12 | handleEditButton(post) {
13 | if(this.props.authenticated){
14 | return (
15 | Edit
16 | );
17 | }
18 | }
19 |
20 | renderPosts(posts) {
21 | return posts.map((post) => {
22 | return (
23 |
24 |
25 | {post.title}
26 |
27 | {this.handleEditButton(post)}
28 |
29 | );
30 | });
31 | }
32 |
33 | render(){
34 | const {posts,loading,error} = this.props.postsList;
35 | if(loading === true){
36 | return ;
37 | }
38 | return (
39 |
40 |
41 |
42 |
43 | {this.renderPosts(posts)}
44 |
45 |
46 | );
47 |
48 | }
49 | }
50 |
51 | function mapStateToProps(state) {
52 | return {
53 | postsList:state.posts.postsList,
54 | authenticated:state.auth.authenticated,
55 | userinfo : state.auth.userinfo
56 | }
57 | }
58 | export default connect(mapStateToProps,actions)(Posts);
59 |
--------------------------------------------------------------------------------
/client-app/src/components/posts/posts_show.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react';
2 | import * as thunkMiddleware from 'redux-thunk';
3 | import {connect} from 'react-redux';
4 | import * as actions from '../../actions';
5 | class PostsShow extends Component{
6 | static contextTypes= {
7 | router:PropTypes.object
8 | }
9 | componentWillMount(){
10 | this.props.PostShow(this.props.params.id);
11 | }
12 | handleDeleteClick(){
13 | this.props.deletePost(this.props.params.id);
14 | this.context.router.push('/posts');
15 | }
16 | handleDeletePost() {
17 | if(this.props.authenticated){
18 | return (
19 |
20 | );
21 | }
22 | }
23 | renderPost(post){
24 | if(post){
25 | return (
26 |
27 |
{post.title}
28 | {this.handleDeletePost()}
29 |
{post.body}
30 |
31 | );
32 | }
33 | }
34 | render(){
35 | const {post,loading,error} = this.props.activePost;
36 | if(loading == true){
37 | return ;
38 | }
39 | return (
40 |
41 | {this.renderPost(post)}
42 |
43 | );
44 | }
45 | }
46 | function mapStateToProps(state){
47 | return {
48 | activePost:state.posts.activePost,
49 | authenticated:state.auth.authenticated
50 | }
51 | }
52 |
53 | export default connect(mapStateToProps,actions)(PostsShow);
54 |
--------------------------------------------------------------------------------
/client-app/src/components/welcome.js:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import Posts from './posts/posts';
3 | export default () =>
6 |
--------------------------------------------------------------------------------
/client-app/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Provider } from 'react-redux';
4 | import { createStore, applyMiddleware } from 'redux';
5 | import {Router,Route,IndexRoute,browserHistory} from 'react-router';
6 | import thunk from 'redux-thunk';
7 | import {AUTH_USER} from './actions/types';
8 |
9 | import App from './components/app';
10 | import Welcome from './components/welcome';
11 | import reducers from './reducers';
12 | import Login from './components/auth/login';
13 | import Logout from './components/auth/logout';
14 | import Register from './components/auth/register';
15 | import Posts from './components/posts/posts';
16 | import AuthCheck from './components/auth/auth_check';
17 | import AddPost from './components/posts/add_post';
18 | import PostsShow from './components/posts/posts_show';
19 | import EditPost from './components/posts/edit_post';
20 |
21 | const createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
22 | const store = createStoreWithMiddleware(reducers);
23 | const token = localStorage.getItem('token');
24 |
25 | if(token){
26 | store.dispatch({type:AUTH_USER});
27 | }
28 |
29 | ReactDOM.render(
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | , document.querySelector('.container'));
45 |
--------------------------------------------------------------------------------
/client-app/src/reducers/auth_reducer.js:
--------------------------------------------------------------------------------
1 | import {AUTH_USER,UNAUTH_USER,AUTH_ERROR,LOGOUT_USER,USER_INFO_SUCCESS} from '../actions/types';
2 | import jwtDecode from 'jwt-decode';
3 | const token = localStorage.getItem('token');
4 | export default function(state ={},action){
5 | switch (action.type) {
6 | case USER_INFO_SUCCESS:
7 | return {...state,userinfo:action.payload.data}
8 | case AUTH_USER:
9 | return {...state,authenticated:true};
10 | case LOGOUT_USER:
11 | return {...state,authenticated:false};
12 | case AUTH_ERROR:
13 | return {...state,error:action.payload};
14 | default:
15 | return state;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/client-app/src/reducers/index.js:
--------------------------------------------------------------------------------
1 | import { combineReducers } from 'redux';
2 | import {reducer as form} from 'redux-form';
3 | import authReducer from './auth_reducer';
4 | import postReducer from './post_reducer';
5 | const rootReducer = combineReducers({
6 | form,
7 | auth:authReducer,
8 | posts:postReducer
9 | });
10 | export default rootReducer;
11 |
--------------------------------------------------------------------------------
/client-app/src/reducers/post_reducer.js:
--------------------------------------------------------------------------------
1 | import {FETCH_POST,ADD_POST,POST_SHOW,EDIT_POST,UPDATE_POST,FETCH_POST_SUCCESS,EDIT_POST_SUCCESS,
2 | POST_SHOW_SUCCESS,UPDATE_POST_SUCCESS,USER_INFO,USER_INFO_SUCCESS} from '../actions/types';
3 |
4 | const INITIAL_STATE = {
5 | postsList:{posts:[],error:null,loading:false},
6 | newPost:{post:null,error:null,loading:false},
7 | deletedPost:{post:null,error:null,loading:false},
8 | editPost:{post:null,error:null,loading:false},
9 | activePost:{post:null,error:null,loading:false},
10 | updatePost:{post:null,error:null,loading:false},
11 | };
12 |
13 |
14 | export default function (state = INITIAL_STATE,action){
15 | switch (action.type) {
16 | case FETCH_POST:
17 | return { ...state, postsList:{posts:[],error:null,loading:true}};
18 | case FETCH_POST_SUCCESS:
19 | return { ...state, postsList:{posts:action.payload.data,error:null,loading:false}};
20 | case POST_SHOW:
21 | return {...state,activePost:{post:null,error:null,loading:true}};
22 | case POST_SHOW_SUCCESS:
23 | return {...state,activePost:{post:action.payload.data,error:null,loading:false}};
24 | case EDIT_POST:
25 | return { ...state, editPost:{post:null,error:null,loading:true} };
26 | case EDIT_POST_SUCCESS:
27 | return {...state,editPost:{post:action.payload.data,error:null,loading:false}}
28 | case UPDATE_POST:
29 | return { ...state, updatePost:{post:null,error:null,loading:true} };
30 | case UPDATE_POST_SUCCESS:
31 | return { ...state, updatePost:{post:true,error:null,loading:false}};
32 | default:
33 | return state;
34 | }
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/client-app/style/style.css:
--------------------------------------------------------------------------------
1 | .loader:before,
2 | .loader:after,
3 | .loader {
4 | border-radius: 50%;
5 | width: 2.5em;
6 | height: 2.5em;
7 | -webkit-animation-fill-mode: both;
8 | animation-fill-mode: both;
9 | -webkit-animation: load7 1.8s infinite ease-in-out;
10 | animation: load7 1.8s infinite ease-in-out;
11 | }
12 | .loader {
13 | color: #18a8f5;
14 | font-size: 10px;
15 | margin: 80px auto;
16 | position: relative;
17 | text-indent: -9999em;
18 | -webkit-transform: translateZ(0);
19 | -ms-transform: translateZ(0);
20 | transform: translateZ(0);
21 | -webkit-animation-delay: -0.16s;
22 | animation-delay: -0.16s;
23 | }
24 | .loader:before {
25 | left: -3.5em;
26 | -webkit-animation-delay: -0.32s;
27 | animation-delay: -0.32s;
28 | }
29 | .loader:after {
30 | left: 3.5em;
31 | }
32 | .loader:before,
33 | .loader:after {
34 | content: '';
35 | position: absolute;
36 | top: 0;
37 | }
38 | @-webkit-keyframes load7 {
39 | 0%,
40 | 80%,
41 | 100% {
42 | box-shadow: 0 2.5em 0 -1.3em;
43 | }
44 | 40% {
45 | box-shadow: 0 2.5em 0 0;
46 | }
47 | }
48 | @keyframes load7 {
49 | 0%,
50 | 80%,
51 | 100% {
52 | box-shadow: 0 2.5em 0 -1.3em;
53 | }
54 | 40% {
55 | box-shadow: 0 2.5em 0 0;
56 | }
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/client-app/test/components/app_test.js:
--------------------------------------------------------------------------------
1 | import { renderComponent , expect } from '../test_helper';
2 | import App from '../../src/components/app';
3 |
4 | describe('App' , () => {
5 | let component;
6 |
7 | beforeEach(() => {
8 | component = renderComponent(App);
9 | });
10 |
11 | it('renders something', () => {
12 | expect(component).to.exist;
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/client-app/test/test_helper.js:
--------------------------------------------------------------------------------
1 | import _$ from 'jquery';
2 | import React from 'react';
3 | import ReactDOM from 'react-dom';
4 | import TestUtils from 'react-addons-test-utils';
5 | import jsdom from 'jsdom';
6 | import chai, { expect } from 'chai';
7 | import chaiJquery from 'chai-jquery';
8 | import { Provider } from 'react-redux';
9 | import { createStore } from 'redux';
10 | import reducers from '../src/reducers';
11 |
12 | global.document = jsdom.jsdom('');
13 | global.window = global.document.defaultView;
14 | const $ = _$(window);
15 |
16 | chaiJquery(chai, chai.util, $);
17 |
18 | function renderComponent(ComponentClass, props = {}, state = {}) {
19 | const componentInstance = TestUtils.renderIntoDocument(
20 |
21 |
22 |
23 | );
24 |
25 | return $(ReactDOM.findDOMNode(componentInstance));
26 | }
27 |
28 | $.fn.simulate = function(eventName, value) {
29 | if (value) {
30 | this.val(value);
31 | }
32 | TestUtils.Simulate[eventName](this[0]);
33 | };
34 |
35 | export {renderComponent, expect};
36 |
--------------------------------------------------------------------------------
/client-app/webpack.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | entry: [
3 | './src/index.js'
4 | ],
5 | output: {
6 | path: __dirname,
7 | publicPath: '/',
8 | filename: 'bundle.js'
9 | },
10 | module: {
11 | loaders: [{
12 | exclude: /node_modules/,
13 | loader: 'babel'
14 | }]
15 | },
16 | resolve: {
17 | extensions: ['', '.js', '.jsx']
18 | },
19 | devServer: {
20 | historyApiFallback: true,
21 | contentBase: './'
22 | }
23 | };
24 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "laravel/laravel",
3 | "description": "The Laravel Framework.",
4 | "keywords": ["framework", "laravel"],
5 | "license": "MIT",
6 | "type": "project",
7 | "require": {
8 | "php": ">=5.5.9",
9 | "laravel/framework": "5.2.*",
10 | "tymon/jwt-auth": "0.5.*",
11 | "barryvdh/laravel-cors": "^0.8.0"
12 | },
13 | "require-dev": {
14 | "fzaninotto/faker": "~1.4",
15 | "mockery/mockery": "0.9.*",
16 | "phpunit/phpunit": "~4.0",
17 | "symfony/css-selector": "2.8.*|3.0.*",
18 | "symfony/dom-crawler": "2.8.*|3.0.*"
19 | },
20 | "autoload": {
21 | "classmap": [
22 | "database"
23 | ],
24 | "psr-4": {
25 | "App\\": "app/"
26 | }
27 | },
28 | "autoload-dev": {
29 | "classmap": [
30 | "tests/TestCase.php"
31 | ]
32 | },
33 | "scripts": {
34 | "post-root-package-install": [
35 | "php -r \"copy('.env.example', '.env');\""
36 | ],
37 | "post-create-project-cmd": [
38 | "php artisan key:generate"
39 | ],
40 | "post-install-cmd": [
41 | "Illuminate\\Foundation\\ComposerScripts::postInstall",
42 | "php artisan optimize"
43 | ],
44 | "post-update-cmd": [
45 | "Illuminate\\Foundation\\ComposerScripts::postUpdate",
46 | "php artisan optimize"
47 | ]
48 | },
49 | "config": {
50 | "preferred-install": "dist"
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_ENV', 'production'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application Debug Mode
21 | |--------------------------------------------------------------------------
22 | |
23 | | When your application is in debug mode, detailed error messages with
24 | | stack traces will be shown on every error that occurs within your
25 | | application. If disabled, a simple generic error page is shown.
26 | |
27 | */
28 |
29 | 'debug' => env('APP_DEBUG', false),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application URL
34 | |--------------------------------------------------------------------------
35 | |
36 | | This URL is used by the console to properly generate URLs when using
37 | | the Artisan command line tool. You should set this to the root of
38 | | your application so that it is used when running Artisan tasks.
39 | |
40 | */
41 |
42 | 'url' => env('APP_URL', 'http://localhost'),
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application Timezone
47 | |--------------------------------------------------------------------------
48 | |
49 | | Here you may specify the default timezone for your application, which
50 | | will be used by the PHP date and date-time functions. We have gone
51 | | ahead and set this to a sensible default for you out of the box.
52 | |
53 | */
54 |
55 | 'timezone' => 'UTC',
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Application Locale Configuration
60 | |--------------------------------------------------------------------------
61 | |
62 | | The application locale determines the default locale that will be used
63 | | by the translation service provider. You are free to set this value
64 | | to any of the locales which will be supported by the application.
65 | |
66 | */
67 |
68 | 'locale' => 'en',
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Application Fallback Locale
73 | |--------------------------------------------------------------------------
74 | |
75 | | The fallback locale determines the locale to use when the current one
76 | | is not available. You may change the value to correspond to any of
77 | | the language folders that are provided through your application.
78 | |
79 | */
80 |
81 | 'fallback_locale' => 'en',
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Encryption Key
86 | |--------------------------------------------------------------------------
87 | |
88 | | This key is used by the Illuminate encrypter service and should be set
89 | | to a random, 32 character string, otherwise these encrypted strings
90 | | will not be safe. Please do this before deploying an application!
91 | |
92 | */
93 |
94 | 'key' => env('APP_KEY'),
95 |
96 | 'cipher' => 'AES-256-CBC',
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Logging Configuration
101 | |--------------------------------------------------------------------------
102 | |
103 | | Here you may configure the log settings for your application. Out of
104 | | the box, Laravel uses the Monolog PHP logging library. This gives
105 | | you a variety of powerful log handlers / formatters to utilize.
106 | |
107 | | Available Settings: "single", "daily", "syslog", "errorlog"
108 | |
109 | */
110 |
111 |
112 | 'log' => env('APP_LOG', 'single'),
113 | /*
114 | |--------------------------------------------------------------------------
115 | | Autoloaded Service Providers
116 | |--------------------------------------------------------------------------
117 | |
118 | | The service providers listed here will be automatically loaded on the
119 | | request to your application. Feel free to add your own services to
120 | | this array to grant expanded functionality to your applications.
121 | |
122 | */
123 |
124 | 'providers' => [
125 |
126 | /*
127 | * Laravel Framework Service Providers...
128 | */
129 | Illuminate\Auth\AuthServiceProvider::class,
130 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
131 | Illuminate\Bus\BusServiceProvider::class,
132 | Illuminate\Cache\CacheServiceProvider::class,
133 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
134 | Illuminate\Cookie\CookieServiceProvider::class,
135 | Illuminate\Database\DatabaseServiceProvider::class,
136 | Illuminate\Encryption\EncryptionServiceProvider::class,
137 | Illuminate\Filesystem\FilesystemServiceProvider::class,
138 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
139 | Illuminate\Hashing\HashServiceProvider::class,
140 | Illuminate\Mail\MailServiceProvider::class,
141 | Illuminate\Pagination\PaginationServiceProvider::class,
142 | Illuminate\Pipeline\PipelineServiceProvider::class,
143 | Illuminate\Queue\QueueServiceProvider::class,
144 | Illuminate\Redis\RedisServiceProvider::class,
145 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
146 | Illuminate\Session\SessionServiceProvider::class,
147 | Illuminate\Translation\TranslationServiceProvider::class,
148 | Illuminate\Validation\ValidationServiceProvider::class,
149 | Illuminate\View\ViewServiceProvider::class,
150 |
151 | /*
152 | * Application Service Providers...
153 | */
154 | App\Providers\AppServiceProvider::class,
155 | App\Providers\AuthServiceProvider::class,
156 | App\Providers\EventServiceProvider::class,
157 | App\Providers\RouteServiceProvider::class,
158 | 'Tymon\JWTAuth\Providers\JWTAuthServiceProvider'
159 |
160 |
161 | ],
162 |
163 | /*
164 | |--------------------------------------------------------------------------
165 | | Class Aliases
166 | |--------------------------------------------------------------------------
167 | |
168 | | This array of class aliases will be registered when this application
169 | | is started. However, feel free to register as many as you wish as
170 | | the aliases are "lazy" loaded so they don't hinder performance.
171 | |
172 | */
173 |
174 | 'aliases' => [
175 |
176 | 'App' => Illuminate\Support\Facades\App::class,
177 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
178 | 'Auth' => Illuminate\Support\Facades\Auth::class,
179 | 'Blade' => Illuminate\Support\Facades\Blade::class,
180 | 'Cache' => Illuminate\Support\Facades\Cache::class,
181 | 'Config' => Illuminate\Support\Facades\Config::class,
182 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
183 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
184 | 'DB' => Illuminate\Support\Facades\DB::class,
185 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
186 | 'Event' => Illuminate\Support\Facades\Event::class,
187 | 'File' => Illuminate\Support\Facades\File::class,
188 | 'Gate' => Illuminate\Support\Facades\Gate::class,
189 | 'Hash' => Illuminate\Support\Facades\Hash::class,
190 | 'Lang' => Illuminate\Support\Facades\Lang::class,
191 | 'Log' => Illuminate\Support\Facades\Log::class,
192 | 'Mail' => Illuminate\Support\Facades\Mail::class,
193 | 'Password' => Illuminate\Support\Facades\Password::class,
194 | 'Queue' => Illuminate\Support\Facades\Queue::class,
195 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
196 | 'Redis' => Illuminate\Support\Facades\Redis::class,
197 | 'Request' => Illuminate\Support\Facades\Request::class,
198 | 'Response' => Illuminate\Support\Facades\Response::class,
199 | 'Route' => Illuminate\Support\Facades\Route::class,
200 | 'Schema' => Illuminate\Support\Facades\Schema::class,
201 | 'Session' => Illuminate\Support\Facades\Session::class,
202 | 'Storage' => Illuminate\Support\Facades\Storage::class,
203 | 'URL' => Illuminate\Support\Facades\URL::class,
204 | 'Validator' => Illuminate\Support\Facades\Validator::class,
205 | 'View' => Illuminate\Support\Facades\View::class,
206 | 'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth',
207 | 'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory',
208 | 'Barryvdh\Cors\ServiceProvider',
209 |
210 |
211 | ],
212 |
213 | ];
214 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | [
17 | 'guard' => 'web',
18 | 'passwords' => 'users',
19 | ],
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Authentication Guards
24 | |--------------------------------------------------------------------------
25 | |
26 | | Next, you may define every authentication guard for your application.
27 | | Of course, a great default configuration has been defined for you
28 | | here which uses session storage and the Eloquent user provider.
29 | |
30 | | All authentication drivers have a user provider. This defines how the
31 | | users are actually retrieved out of your database or other storage
32 | | mechanisms used by this application to persist your user's data.
33 | |
34 | | Supported: "session", "token"
35 | |
36 | */
37 |
38 | 'guards' => [
39 | 'web' => [
40 | 'driver' => 'session',
41 | 'provider' => 'users',
42 | ],
43 |
44 | 'api' => [
45 | 'driver' => 'token',
46 | 'provider' => 'users',
47 | ],
48 | ],
49 |
50 | /*
51 | |--------------------------------------------------------------------------
52 | | User Providers
53 | |--------------------------------------------------------------------------
54 | |
55 | | All authentication drivers have a user provider. This defines how the
56 | | users are actually retrieved out of your database or other storage
57 | | mechanisms used by this application to persist your user's data.
58 | |
59 | | If you have multiple user tables or models you may configure multiple
60 | | sources which represent each model / table. These sources may then
61 | | be assigned to any extra authentication guards you have defined.
62 | |
63 | | Supported: "database", "eloquent"
64 | |
65 | */
66 |
67 | 'providers' => [
68 | 'users' => [
69 | 'driver' => 'eloquent',
70 | 'model' => App\User::class,
71 | ],
72 |
73 | // 'users' => [
74 | // 'driver' => 'database',
75 | // 'table' => 'users',
76 | // ],
77 | ],
78 |
79 | /*
80 | |--------------------------------------------------------------------------
81 | | Resetting Passwords
82 | |--------------------------------------------------------------------------
83 | |
84 | | Here you may set the options for resetting passwords including the view
85 | | that is your password reset e-mail. You may also set the name of the
86 | | table that maintains all of the reset tokens for your application.
87 | |
88 | | You may specify multiple password reset configurations if you have more
89 | | than one user table or model in the application and you want to have
90 | | separate password reset settings based on the specific user types.
91 | |
92 | | The expire time is the number of minutes that the reset token should be
93 | | considered valid. This security feature keeps tokens short-lived so
94 | | they have less time to be guessed. You may change this as needed.
95 | |
96 | */
97 |
98 | 'passwords' => [
99 | 'users' => [
100 | 'provider' => 'users',
101 | 'email' => 'auth.emails.password',
102 | 'table' => 'password_resets',
103 | 'expire' => 60,
104 | ],
105 | ],
106 |
107 | ];
108 |
--------------------------------------------------------------------------------
/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'pusher'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Broadcast Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the broadcast connections that will be used
24 | | to broadcast events to other systems or over websockets. Samples of
25 | | each available type of connection are provided inside this array.
26 | |
27 | */
28 |
29 | 'connections' => [
30 |
31 | 'pusher' => [
32 | 'driver' => 'pusher',
33 | 'key' => env('PUSHER_KEY'),
34 | 'secret' => env('PUSHER_SECRET'),
35 | 'app_id' => env('PUSHER_APP_ID'),
36 | 'options' => [
37 | //
38 | ],
39 | ],
40 |
41 | 'redis' => [
42 | 'driver' => 'redis',
43 | 'connection' => 'default',
44 | ],
45 |
46 | 'log' => [
47 | 'driver' => 'log',
48 | ],
49 |
50 | ],
51 |
52 | ];
53 |
--------------------------------------------------------------------------------
/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 | 'database' => [
40 | 'driver' => 'database',
41 | 'table' => 'cache',
42 | 'connection' => null,
43 | ],
44 |
45 | 'file' => [
46 | 'driver' => 'file',
47 | 'path' => storage_path('framework/cache'),
48 | ],
49 |
50 | 'memcached' => [
51 | 'driver' => 'memcached',
52 | 'servers' => [
53 | [
54 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
55 | 'port' => env('MEMCACHED_PORT', 11211),
56 | 'weight' => 100,
57 | ],
58 | ],
59 | ],
60 |
61 | 'redis' => [
62 | 'driver' => 'redis',
63 | 'connection' => 'default',
64 | ],
65 |
66 | ],
67 |
68 | /*
69 | |--------------------------------------------------------------------------
70 | | Cache Key Prefix
71 | |--------------------------------------------------------------------------
72 | |
73 | | When utilizing a RAM based store such as APC or Memcached, there might
74 | | be other applications utilizing the same cache. So, we'll specify a
75 | | value to get prefixed to all our keys so we can avoid collisions.
76 | |
77 | */
78 |
79 | 'prefix' => 'laravel',
80 |
81 | ];
82 |
--------------------------------------------------------------------------------
/config/compile.php:
--------------------------------------------------------------------------------
1 | [
17 | //
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled File Providers
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may list service providers which define a "compiles" function
26 | | that returns additional files that should be compiled, providing an
27 | | easy way to get common files from any packages you are utilizing.
28 | |
29 | */
30 |
31 | 'providers' => [
32 | //
33 | ],
34 |
35 | ];
36 |
--------------------------------------------------------------------------------
/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' => env('DB_CONNECTION', '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' => env('DB_DATABASE', database_path('database.sqlite')),
52 | 'prefix' => '',
53 | ],
54 |
55 | 'mysql' => [
56 | 'driver' => 'mysql',
57 | 'host' => env('DB_HOST', 'localhost'),
58 | 'port' => env('DB_PORT', '3306'),
59 | 'database' => env('DB_DATABASE', 'forge'),
60 | 'username' => env('DB_USERNAME', 'forge'),
61 | 'password' => env('DB_PASSWORD', ''),
62 | 'charset' => 'utf8',
63 | 'collation' => 'utf8_unicode_ci',
64 | 'prefix' => '',
65 | 'strict' => false,
66 | 'engine' => null,
67 | ],
68 |
69 | 'pgsql' => [
70 | 'driver' => 'pgsql',
71 | 'host' => env('DB_HOST', 'localhost'),
72 | 'port' => env('DB_PORT', '5432'),
73 | 'database' => env('DB_DATABASE', 'forge'),
74 | 'username' => env('DB_USERNAME', 'forge'),
75 | 'password' => env('DB_PASSWORD', ''),
76 | 'charset' => 'utf8',
77 | 'prefix' => '',
78 | 'schema' => 'public',
79 | ],
80 |
81 | ],
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Migration Repository Table
86 | |--------------------------------------------------------------------------
87 | |
88 | | This table keeps track of all the migrations that have already run for
89 | | your application. Using this information, we can determine which of
90 | | the migrations on disk haven't actually been run in the database.
91 | |
92 | */
93 |
94 | 'migrations' => 'migrations',
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Redis Databases
99 | |--------------------------------------------------------------------------
100 | |
101 | | Redis is an open source, fast, and advanced key-value store that also
102 | | provides a richer set of commands than a typical key-value systems
103 | | such as APC or Memcached. Laravel makes it easy to dig right in.
104 | |
105 | */
106 |
107 | 'redis' => [
108 |
109 | 'cluster' => false,
110 |
111 | 'default' => [
112 | 'host' => env('REDIS_HOST', 'localhost'),
113 | 'password' => env('REDIS_PASSWORD', null),
114 | 'port' => env('REDIS_PORT', 6379),
115 | 'database' => 0,
116 | ],
117 |
118 | ],
119 |
120 | ];
121 |
--------------------------------------------------------------------------------
/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 | 'public' => [
52 | 'driver' => 'local',
53 | 'root' => storage_path('app/public'),
54 | 'visibility' => 'public',
55 | ],
56 |
57 | 's3' => [
58 | 'driver' => 's3',
59 | 'key' => 'your-key',
60 | 'secret' => 'your-secret',
61 | 'region' => 'your-region',
62 | 'bucket' => 'your-bucket',
63 | ],
64 |
65 | ],
66 |
67 | ];
68 |
--------------------------------------------------------------------------------
/config/jwt.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | return [
13 |
14 | /*
15 | |--------------------------------------------------------------------------
16 | | JWT Authentication Secret
17 | |--------------------------------------------------------------------------
18 | |
19 | | Don't forget to set this, as it will be used to sign your tokens.
20 | | A helper command is provided for this: `php artisan jwt:generate`
21 | |
22 | */
23 |
24 | 'secret' => env('JWT_SECRET', 'b2fyUlXUPK2RfQCEwVkB77pm2bFawZBc'),
25 |
26 | /*
27 | |--------------------------------------------------------------------------
28 | | JWT time to live
29 | |--------------------------------------------------------------------------
30 | |
31 | | Specify the length of time (in minutes) that the token will be valid for.
32 | | Defaults to 1 hour
33 | |
34 | */
35 |
36 | 'ttl' => 60,
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Refresh time to live
41 | |--------------------------------------------------------------------------
42 | |
43 | | Specify the length of time (in minutes) that the token can be refreshed
44 | | within. I.E. The user can refresh their token within a 2 week window of
45 | | the original token being created until they must re-authenticate.
46 | | Defaults to 2 weeks
47 | |
48 | */
49 |
50 | 'refresh_ttl' => 20160,
51 |
52 | /*
53 | |--------------------------------------------------------------------------
54 | | JWT hashing algorithm
55 | |--------------------------------------------------------------------------
56 | |
57 | | Specify the hashing algorithm that will be used to sign the token.
58 | |
59 | | See here: https://github.com/namshi/jose/tree/2.2.0/src/Namshi/JOSE/Signer
60 | | for possible values
61 | |
62 | */
63 |
64 | 'algo' => 'HS256',
65 |
66 | /*
67 | |--------------------------------------------------------------------------
68 | | User Model namespace
69 | |--------------------------------------------------------------------------
70 | |
71 | | Specify the full namespace to your User model.
72 | | e.g. 'Acme\Entities\User'
73 | |
74 | */
75 |
76 | 'user' => 'App\User',
77 |
78 | /*
79 | |--------------------------------------------------------------------------
80 | | User identifier
81 | |--------------------------------------------------------------------------
82 | |
83 | | Specify a unique property of the user that will be added as the 'sub'
84 | | claim of the token payload.
85 | |
86 | */
87 |
88 | 'identifier' => 'id',
89 |
90 | /*
91 | |--------------------------------------------------------------------------
92 | | Required Claims
93 | |--------------------------------------------------------------------------
94 | |
95 | | Specify the required claims that must exist in any token.
96 | | A TokenInvalidException will be thrown if any of these claims are not
97 | | present in the payload.
98 | |
99 | */
100 |
101 | 'required_claims' => ['iss', 'iat', 'exp', 'nbf', 'sub', 'jti'],
102 |
103 | /*
104 | |--------------------------------------------------------------------------
105 | | Blacklist Enabled
106 | |--------------------------------------------------------------------------
107 | |
108 | | In order to invalidate tokens, you must have the the blacklist enabled.
109 | | If you do not want or need this functionality, then set this to false.
110 | |
111 | */
112 |
113 | 'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
114 |
115 | /*
116 | |--------------------------------------------------------------------------
117 | | Providers
118 | |--------------------------------------------------------------------------
119 | |
120 | | Specify the various providers used throughout the package.
121 | |
122 | */
123 |
124 | 'providers' => [
125 |
126 | /*
127 | |--------------------------------------------------------------------------
128 | | User Provider
129 | |--------------------------------------------------------------------------
130 | |
131 | | Specify the provider that is used to find the user based
132 | | on the subject claim
133 | |
134 | */
135 |
136 | 'user' => 'Tymon\JWTAuth\Providers\User\EloquentUserAdapter',
137 |
138 | /*
139 | |--------------------------------------------------------------------------
140 | | JWT Provider
141 | |--------------------------------------------------------------------------
142 | |
143 | | Specify the provider that is used to create and decode the tokens.
144 | |
145 | */
146 |
147 | 'jwt' => 'Tymon\JWTAuth\Providers\JWT\NamshiAdapter',
148 |
149 | /*
150 | |--------------------------------------------------------------------------
151 | | Authentication Provider
152 | |--------------------------------------------------------------------------
153 | |
154 | | Specify the provider that is used to authenticate users.
155 | |
156 | */
157 |
158 | 'auth' => 'Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter',
159 |
160 | /*
161 | |--------------------------------------------------------------------------
162 | | Storage Provider
163 | |--------------------------------------------------------------------------
164 | |
165 | | Specify the provider that is used to store tokens in the blacklist
166 | |
167 | */
168 |
169 | 'storage' => 'Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter',
170 |
171 | ],
172 |
173 | ];
174 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_DRIVER', 'smtp'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | SMTP Host Address
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may provide the host address of the SMTP server used by your
27 | | applications. A default option is provided that is compatible with
28 | | the Mailgun mail service which will provide reliable deliveries.
29 | |
30 | */
31 |
32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
33 |
34 | /*
35 | |--------------------------------------------------------------------------
36 | | SMTP Host Port
37 | |--------------------------------------------------------------------------
38 | |
39 | | This is the SMTP port used by your application to deliver e-mails to
40 | | users of the application. Like the host we have set this value to
41 | | stay compatible with the Mailgun e-mail application by default.
42 | |
43 | */
44 |
45 | 'port' => env('MAIL_PORT', 587),
46 |
47 | /*
48 | |--------------------------------------------------------------------------
49 | | Global "From" Address
50 | |--------------------------------------------------------------------------
51 | |
52 | | You may wish for all e-mails sent by your application to be sent from
53 | | the same address. Here, you may specify a name and address that is
54 | | used globally for all e-mails that are sent by your application.
55 | |
56 | */
57 |
58 | 'from' => ['address' => null, 'name' => null],
59 |
60 | /*
61 | |--------------------------------------------------------------------------
62 | | E-Mail Encryption Protocol
63 | |--------------------------------------------------------------------------
64 | |
65 | | Here you may specify the encryption protocol that should be used when
66 | | the application send e-mail messages. A sensible default using the
67 | | transport layer security protocol should provide great security.
68 | |
69 | */
70 |
71 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
72 |
73 | /*
74 | |--------------------------------------------------------------------------
75 | | SMTP Server Username
76 | |--------------------------------------------------------------------------
77 | |
78 | | If your SMTP server requires a username for authentication, you should
79 | | set it here. This will get used to authenticate with your server on
80 | | connection. You may also set the "password" value below this one.
81 | |
82 | */
83 |
84 | 'username' => env('MAIL_USERNAME'),
85 |
86 | /*
87 | |--------------------------------------------------------------------------
88 | | SMTP Server Password
89 | |--------------------------------------------------------------------------
90 | |
91 | | Here you may set the password required by your SMTP server to send out
92 | | messages from your application. This will be given to the server on
93 | | connection so that the application will be able to send messages.
94 | |
95 | */
96 |
97 | 'password' => env('MAIL_PASSWORD'),
98 |
99 | /*
100 | |--------------------------------------------------------------------------
101 | | Sendmail System Path
102 | |--------------------------------------------------------------------------
103 | |
104 | | When using the "sendmail" driver to send e-mails, we will need to know
105 | | the path to where Sendmail lives on this server. A default path has
106 | | been provided here, which will work well on most of your systems.
107 | |
108 | */
109 |
110 | 'sendmail' => '/usr/sbin/sendmail -bs',
111 |
112 | ];
113 |
--------------------------------------------------------------------------------
/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 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
57 | 'queue' => 'your-queue-name',
58 | 'region' => 'us-east-1',
59 | ],
60 |
61 | 'redis' => [
62 | 'driver' => 'redis',
63 | 'connection' => 'default',
64 | 'queue' => 'default',
65 | 'expire' => 60,
66 | ],
67 |
68 | ],
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Failed Queue Jobs
73 | |--------------------------------------------------------------------------
74 | |
75 | | These options configure the behavior of failed queue job logging so you
76 | | can control which database and table are used to store the jobs that
77 | | have failed. You may change them to any database / table you wish.
78 | |
79 | */
80 |
81 | 'failed' => [
82 | 'database' => env('DB_CONNECTION', 'mysql'),
83 | 'table' => 'failed_jobs',
84 | ],
85 |
86 | ];
87 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'ses' => [
23 | 'key' => env('SES_KEY'),
24 | 'secret' => env('SES_SECRET'),
25 | 'region' => 'us-east-1',
26 | ],
27 |
28 | 'sparkpost' => [
29 | 'secret' => env('SPARKPOST_SECRET'),
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => App\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/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 | |--------------------------------------------------------------------------
155 | | HTTP Access Only
156 | |--------------------------------------------------------------------------
157 | |
158 | | Setting this value to true will prevent JavaScript from accessing the
159 | | value of the cookie and the cookie will only be accessible through
160 | | the HTTP protocol. You are free to modify this option if needed.
161 | |
162 | */
163 |
164 | 'http_only' => true,
165 |
166 | ];
167 |
--------------------------------------------------------------------------------
/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/factories/ModelFactory.php:
--------------------------------------------------------------------------------
1 | define(App\User::class, function (Faker\Generator $faker) {
15 | return [
16 | 'name' => $faker->name,
17 | 'email' => $faker->safeEmail,
18 | 'password' => bcrypt(str_random(10)),
19 | 'remember_token' => str_random(10),
20 | ];
21 | });
22 |
--------------------------------------------------------------------------------
/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('email')->unique();
19 | $table->string('password');
20 | $table->rememberToken();
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::drop('users');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
17 | $table->string('token')->index();
18 | $table->timestamp('created_at');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::drop('password_resets');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/database/migrations/2016_04_24_210614_create_posts_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->integer('user_id');
18 | $table->string("title");
19 | $table->text('body');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::drop('posts');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(UsersTableSeeder::class);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var elixir = require('laravel-elixir');
2 |
3 | /*
4 | |--------------------------------------------------------------------------
5 | | Elixir Asset Management
6 | |--------------------------------------------------------------------------
7 | |
8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks
9 | | for your Laravel application. By default, we are compiling the Sass
10 | | file for our application, as well as publishing vendor resources.
11 | |
12 | */
13 |
14 | elixir(function(mix) {
15 | mix.sass('app.scss');
16 | });
17 |
--------------------------------------------------------------------------------
/npm-debug.log:
--------------------------------------------------------------------------------
1 | 0 info it worked if it ends with ok
2 | 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
3 | 1 verbose cli 'C:\\Users\\oner\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
4 | 1 verbose cli 'start' ]
5 | 2 info using npm@3.8.8
6 | 3 info using node@v4.2.6
7 | 4 verbose stack Error: missing script: start
8 | 4 verbose stack at run (C:\Users\oner\AppData\Roaming\npm\node_modules\npm\lib\run-script.js:147:19)
9 | 4 verbose stack at C:\Users\oner\AppData\Roaming\npm\node_modules\npm\lib\run-script.js:57:5
10 | 4 verbose stack at C:\Users\oner\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:345:5
11 | 4 verbose stack at checkBinReferences_ (C:\Users\oner\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)
12 | 4 verbose stack at final (C:\Users\oner\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)
13 | 4 verbose stack at then (C:\Users\oner\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:113:5)
14 | 4 verbose stack at C:\Users\oner\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:232:12
15 | 4 verbose stack at C:\Users\oner\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16
16 | 4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
17 | 5 verbose cwd C:\laragon\www\laravelReactRdx
18 | 6 error Windows_NT 6.3.9600
19 | 7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\oner\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
20 | 8 error node v4.2.6
21 | 9 error npm v3.8.8
22 | 10 error missing script: start
23 | 11 error If you need help, you may report this error at:
24 | 11 error
25 | 12 verbose exit [ 1, true ]
26 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "devDependencies": {
4 | "gulp": "^3.9.1"
5 | },
6 | "dependencies": {
7 | "laravel-elixir": "^5.0.0",
8 | "bootstrap-sass": "^3.0.0"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests
14 |
15 |
16 |
17 |
18 | ./app
19 |
20 | ./app/Http/routes.php
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews
4 |
5 |
6 | RewriteEngine On
7 |
8 |
9 | # Redirect Trailing Slashes If Not A Folder...
10 | RewriteCond %{REQUEST_FILENAME} !-d
11 | RewriteRule ^(.*)/$ /$1 [L,R=301]
12 |
13 | # Handle Front Controller...
14 | RewriteCond %{REQUEST_FILENAME} !-d
15 | RewriteCond %{REQUEST_FILENAME} !-f
16 | RewriteRule ^ index.php [L]
17 |
18 |
19 | RewriteCond %{HTTP:Authorization} ^(.*)
20 | RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
21 |
22 |
23 | # Handle Authorization Header
24 |
25 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onerciller/react-redux-laravel/6417102d30bcc34576e0946a3d5a413c878a96cc/public/favicon.ico
--------------------------------------------------------------------------------
/public/img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onerciller/react-redux-laravel/6417102d30bcc34576e0946a3d5a413c878a96cc/public/img.png
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 |
16 | */
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Register The Auto Loader
21 | |--------------------------------------------------------------------------
22 | |
23 | | Composer provides a convenient, automatically generated class loader for
24 | | our application. We just need to utilize it! We'll simply require it
25 | | into the script here so that we don't have to worry about manual
26 | | loading any of our classes later on. It feels nice to relax.
27 | |
28 | */
29 |
30 | require __DIR__.'/../bootstrap/autoload.php';
31 |
32 | /*
33 | |--------------------------------------------------------------------------
34 | | Turn On The Lights
35 | |--------------------------------------------------------------------------
36 | |
37 | | We need to illuminate PHP development, so let us turn on the lights.
38 | | This bootstraps the framework and gets it ready for use, then it
39 | | will load up this application so that we can run it and send
40 | | the responses back to the browser and delight our users.
41 | |
42 | */
43 |
44 | $app = require_once __DIR__.'/../bootstrap/app.php';
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Run The Application
49 | |--------------------------------------------------------------------------
50 | |
51 | | Once we have the application, we can handle the incoming request
52 | | through the kernel, and send the associated response back to
53 | | the client's browser allowing them to enjoy the creative
54 | | and wonderful application we have prepared for them.
55 | |
56 | */
57 |
58 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
59 |
60 | $response = $kernel->handle(
61 | $request = Illuminate\Http\Request::capture()
62 | );
63 |
64 | $response->send();
65 |
66 | $kernel->terminate($request, $response);
67 |
--------------------------------------------------------------------------------
/public/npm-debug.log:
--------------------------------------------------------------------------------
1 | 0 info it worked if it ends with ok
2 | 1 verbose cli [ 'c:\\Program Files\\nodejs\\node.exe',
3 | 1 verbose cli 'c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
4 | 1 verbose cli 'start' ]
5 | 2 info using npm@2.14.12
6 | 3 info using node@v4.2.6
7 | 4 verbose stack Error: missing script: start
8 | 4 verbose stack at run (c:\Program Files\nodejs\node_modules\npm\lib\run-script.js:142:19)
9 | 4 verbose stack at c:\Program Files\nodejs\node_modules\npm\lib\run-script.js:58:5
10 | 4 verbose stack at c:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:345:5
11 | 4 verbose stack at checkBinReferences_ (c:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)
12 | 4 verbose stack at final (c:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)
13 | 4 verbose stack at then (c:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:113:5)
14 | 4 verbose stack at c:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:232:12
15 | 4 verbose stack at c:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:76:16
16 | 4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
17 | 5 verbose cwd c:\laragon\www\laravelReactRdx\public
18 | 6 error Windows_NT 6.3.9600
19 | 7 error argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
20 | 8 error node v4.2.6
21 | 9 error npm v2.14.12
22 | 10 error missing script: start
23 | 11 error If you need help, you may report this error at:
24 | 11 error
25 | 12 verbose exit [ 1, true ]
26 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/public/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # React-Redux-Laravel#
2 |
3 | Boilerplate blog application for a Laravel JWT Backend and a React/Redux Front-End with Bootstrap 4.
4 |
5 | * Laravel 5.2
6 | * React
7 | * Redux
8 | * React-Router
9 | * Babel 6
10 | * Redux-Form
11 | * Webpack
12 |
13 | 
14 |
15 | ##Installation
16 |
17 | ### Laravel
18 | ```sh
19 | $ composer update
20 | $ php artisan migrate
21 |
22 | ```
23 |
24 | ### Install Front-End Requirements
25 | ```sh
26 | $ cd client-app
27 | $ npm install
28 | ```
29 |
30 | ### Run Back-End
31 |
32 | ```sh
33 | $ php artisan serve
34 | ```
35 |
36 |
37 | ### Run Front-End
38 |
39 | ```sh
40 | $ cd client-app
41 | $ npm start
42 | ```
43 |
44 |
--------------------------------------------------------------------------------
/resources/assets/sass/app.scss:
--------------------------------------------------------------------------------
1 | @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
2 |
3 |
--------------------------------------------------------------------------------
/resources/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/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 | 'reset' => 'Your password has been reset!',
18 | 'sent' => 'We have e-mailed your password reset link!',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that e-mail address.",
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 | 'distinct' => 'The :attribute field has a duplicate value.',
38 | 'email' => 'The :attribute must be a valid email address.',
39 | 'exists' => 'The selected :attribute is invalid.',
40 | 'filled' => 'The :attribute field is required.',
41 | 'image' => 'The :attribute must be an image.',
42 | 'in' => 'The selected :attribute is invalid.',
43 | 'in_array' => 'The :attribute field does not exist in :other.',
44 | 'integer' => 'The :attribute must be an integer.',
45 | 'ip' => 'The :attribute must be a valid IP address.',
46 | 'json' => 'The :attribute must be a valid JSON string.',
47 | 'max' => [
48 | 'numeric' => 'The :attribute may not be greater than :max.',
49 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
50 | 'string' => 'The :attribute may not be greater than :max characters.',
51 | 'array' => 'The :attribute may not have more than :max items.',
52 | ],
53 | 'mimes' => 'The :attribute must be a file of type: :values.',
54 | 'min' => [
55 | 'numeric' => 'The :attribute must be at least :min.',
56 | 'file' => 'The :attribute must be at least :min kilobytes.',
57 | 'string' => 'The :attribute must be at least :min characters.',
58 | 'array' => 'The :attribute must have at least :min items.',
59 | ],
60 | 'not_in' => 'The selected :attribute is invalid.',
61 | 'numeric' => 'The :attribute must be a number.',
62 | 'present' => 'The :attribute field must be present.',
63 | 'regex' => 'The :attribute format is invalid.',
64 | 'required' => 'The :attribute field is required.',
65 | 'required_if' => 'The :attribute field is required when :other is :value.',
66 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
67 | 'required_with' => 'The :attribute field is required when :values is present.',
68 | 'required_with_all' => 'The :attribute field is required when :values is present.',
69 | 'required_without' => 'The :attribute field is required when :values is not present.',
70 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
71 | 'same' => 'The :attribute and :other must match.',
72 | 'size' => [
73 | 'numeric' => 'The :attribute must be :size.',
74 | 'file' => 'The :attribute must be :size kilobytes.',
75 | 'string' => 'The :attribute must be :size characters.',
76 | 'array' => 'The :attribute must contain :size items.',
77 | ],
78 | 'string' => 'The :attribute must be a string.',
79 | 'timezone' => 'The :attribute must be a valid zone.',
80 | 'unique' => 'The :attribute has already been taken.',
81 | 'url' => 'The :attribute format is invalid.',
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Custom Validation Language Lines
86 | |--------------------------------------------------------------------------
87 | |
88 | | Here you may specify custom validation messages for attributes using the
89 | | convention "attribute.rule" to name the lines. This makes it quick to
90 | | specify a specific custom language line for a given attribute rule.
91 | |
92 | */
93 |
94 | 'custom' => [
95 | 'attribute-name' => [
96 | 'rule-name' => 'custom-message',
97 | ],
98 | ],
99 |
100 | /*
101 | |--------------------------------------------------------------------------
102 | | Custom Validation Attributes
103 | |--------------------------------------------------------------------------
104 | |
105 | | The following language lines are used to swap attribute place-holders
106 | | with something more reader friendly such as E-Mail Address instead
107 | | of "email". This simply helps us make messages a little cleaner.
108 | |
109 | */
110 |
111 | 'attributes' => [],
112 |
113 | ];
114 |
--------------------------------------------------------------------------------
/resources/views/auth/emails/password.blade.php:
--------------------------------------------------------------------------------
1 | Click here to reset your password: {{ $link }}
2 |
--------------------------------------------------------------------------------
/resources/views/auth/login.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
7 |
8 |
Login
9 |
10 |
61 |
62 |
63 |
64 |
65 |
66 | @endsection
67 |
--------------------------------------------------------------------------------
/resources/views/auth/passwords/email.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 |
4 | @section('content')
5 |
6 |
7 |
8 |
9 |
Reset Password
10 |
11 | @if (session('status'))
12 |
13 | {{ session('status') }}
14 |
15 | @endif
16 |
17 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection
48 |
--------------------------------------------------------------------------------
/resources/views/auth/passwords/reset.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
7 |
8 |
Reset Password
9 |
10 |
11 |
65 |
66 |
67 |
68 |
69 |
70 | @endsection
71 |
--------------------------------------------------------------------------------
/resources/views/auth/register.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
7 |
8 |
Register
9 |
10 |
77 |
78 |
79 |
80 |
81 |
82 | @endsection
83 |
--------------------------------------------------------------------------------
/resources/views/errors/503.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Be right back.
5 |
6 |
7 |
8 |
39 |
40 |
41 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/resources/views/home.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
7 |
8 |
Dashboard
9 |
10 |
11 | You are logged in!
12 |
13 |
14 |
15 |
16 |
17 | @endsection
18 |
--------------------------------------------------------------------------------
/resources/views/layouts/app.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Laravel
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
25 |
26 |
27 |
72 |
73 | @yield('content')
74 |
75 |
76 |
77 |
78 | {{-- --}}
79 |
80 |
81 |
--------------------------------------------------------------------------------
/resources/views/vendor/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/resources/views/welcome.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
7 |
8 |
Welcome
9 |
10 |
11 | Your Application's Landing Page.
12 |
13 |
14 |
15 |
16 |
17 | @endsection
18 |
--------------------------------------------------------------------------------
/server.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | $uri = urldecode(
11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
12 | );
13 |
14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
15 | // built-in PHP web server. This provides a convenient way to test a Laravel
16 | // application without having installed a "real" web server software here.
17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
18 | return false;
19 | }
20 |
21 | require_once __DIR__.'/public/index.php';
22 |
--------------------------------------------------------------------------------
/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | config.php
2 | routes.php
3 | schedule-*
4 | compiled.php
5 | services.json
6 | events.scanned.php
7 | routes.scanned.php
8 | down
9 |
--------------------------------------------------------------------------------
/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/ExampleTest.php:
--------------------------------------------------------------------------------
1 | visit('/')
17 | ->see('Welcome');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tests/PostTest.php:
--------------------------------------------------------------------------------
1 |
2 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
22 |
23 | return $app;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------