{{ $post->title }}
23 |{{ substr(strip_tags($post->body), 0, 300) }}{{ strlen(strip_tags($post->body)) > 300 ? "..." : "" }}
24 | Read More 25 |├── public ├── favicon.ico ├── robots.txt ├── .htaccess ├── css │ ├── parsley.css │ ├── styles.css │ └── select2.min.css ├── web.config └── index.php ├── app ├── Listeners │ └── .gitkeep ├── Policies │ └── .gitkeep ├── Events │ └── Event.php ├── Book.php ├── Http │ ├── Requests │ │ └── Request.php │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── RedirectIfAuthenticated.php │ │ └── Authenticate.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── AccessorController.php │ │ ├── BlogController.php │ │ ├── Auth │ │ │ ├── PasswordController.php │ │ │ └── AuthController.php │ │ ├── PagesController.php │ │ ├── CategoryController.php │ │ ├── TagController.php │ │ ├── CommentsController.php │ │ └── PostController.php │ ├── Kernel.php │ └── routes.php ├── Comment.php ├── Tag.php ├── Category.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ ├── RouteServiceProvider.php │ └── OpenCensusProvider.php ├── Jobs │ └── Job.php ├── Console │ ├── Commands │ │ └── Inspire.php │ └── Kernel.php ├── Post.php ├── User.php └── Exceptions │ └── Handler.php ├── database ├── seeds │ ├── .gitkeep │ ├── BookTableSeeder.php │ ├── CategoryTableSeeder.php │ ├── PostsTableSeeder.php │ ├── UsersTableSeeder.php │ └── DatabaseSeeder.php ├── migrations │ ├── .gitkeep │ ├── 2016_05_30_153615_create_tags_table.php │ ├── 2016_03_20_162017_add_slug_to_users.php │ ├── 2016_04_28_021908_create_categories_table.php │ ├── 2016_02_06_175142_create_posts_table.php │ ├── 2016_08_15_000718_add_image_col_to_posts.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2016_04_28_022255_add_category_id_to_posts.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2019_06_28_133124_create_books_table.php │ ├── 2016_05_30_155417_create_post_tag_table.php │ └── 2016_07_16_173641_create_comments_table.php ├── .gitignore └── factories │ └── ModelFactory.php ├── docker ├── opencensus │ ├── collector.yml │ └── agent.yml ├── mysql │ └── my.cnf ├── php │ └── local.ini ├── prometheus │ └── prometheus.yml └── nginx │ └── conf.d │ └── laravel.conf ├── resources ├── views │ ├── vendor │ │ └── .gitkeep │ ├── partials │ │ ├── _footer.blade.php │ │ ├── _javascript.blade.php │ │ ├── _messages.blade.php │ │ ├── _head.blade.php │ │ └── _nav.blade.php │ ├── emails │ │ └── contact.blade.php │ ├── auth │ │ ├── emails │ │ │ └── password.blade.php │ │ ├── login.blade.php │ │ ├── passwords │ │ │ ├── email.blade.php │ │ │ └── reset.blade.php │ │ └── register.blade.php │ ├── tags │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── main.blade.php │ ├── pages │ │ ├── about.blade.php │ │ ├── contact.blade.php │ │ └── welcome.blade.php │ ├── comments │ │ ├── delete.blade.php │ │ └── edit.blade.php │ ├── blog │ │ ├── index.blade.php │ │ └── single.blade.php │ ├── categories │ │ └── index.blade.php │ ├── errors │ │ └── 503.blade.php │ └── posts │ │ ├── index.blade.php │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── show.blade.php ├── assets │ └── sass │ │ └── app.scss └── lang │ └── en │ ├── pagination.php │ ├── auth.php │ ├── passwords.php │ └── validation.php ├── ansible ├── playbook.retry ├── .gitignore ├── hosts-dev ├── hosts-prod ├── requirements.yml ├── playbook.yml ├── vagrant │ ├── id_rsa.pub │ └── id_rsa ├── roles │ └── deployment │ │ ├── tasks │ │ ├── undeploy.yml │ │ ├── seeding.yml │ │ ├── main.yml │ │ ├── migration.yml │ │ └── deploy.yml │ │ ├── defaults │ │ └── main.yml │ │ └── templates │ │ └── docker-compose.yml.j2 ├── vars │ ├── dev.yml │ └── prod.yml └── Vagrantfile ├── storage ├── app │ └── .gitignore ├── logs │ └── .gitignore └── framework │ ├── cache │ └── .gitignore │ ├── views │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── bootstrap ├── cache │ └── .gitignore ├── autoload.php └── app.php ├── .gitattributes ├── docker-local.sh ├── .dockerignore ├── .gitignore ├── .htaccess ├── package.json ├── tests ├── BasicTest.php ├── TestCase.php ├── AccessorTest.php ├── BookTest.php └── UserTest.php ├── .env.local ├── gulpfile.js ├── docker-compose.yml ├── server.php ├── sonar-project.properties ├── phpunit.xml ├── config ├── compile.php ├── services.php ├── view.php ├── broadcasting.php ├── purifier.php ├── cache.php ├── queue.php ├── filesystems.php ├── auth.php ├── mail.php ├── database.php ├── session.php └── app.php ├── composer.json ├── Dockerfile ├── artisan ├── docker-compose.local.yml ├── readme.md └── Jenkinsfile /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Listeners/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Policies/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /docker/opencensus/collector.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ansible/playbook.retry: -------------------------------------------------------------------------------- 1 | 192.168.94.41 2 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /ansible/.gitignore: -------------------------------------------------------------------------------- 1 | *-console.log 2 | .vagrant -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.less linguist-vendored 4 | -------------------------------------------------------------------------------- /ansible/hosts-dev: -------------------------------------------------------------------------------- 1 | [hospice] 2 | 192.168.94.41 ansible_user=vagrant 3 | 4 | [all:vars] 5 | env=dev -------------------------------------------------------------------------------- /ansible/hosts-prod: -------------------------------------------------------------------------------- 1 | [hospice] 2 | 192.168.94.42 ansible_user=vagrant 3 | 4 | [all:vars] 5 | env=prod -------------------------------------------------------------------------------- /docker/mysql/my.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | general_log = 1 3 | general_log_file = /var/lib/mysql/general.log 4 | -------------------------------------------------------------------------------- /docker-local.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | docker-compose -f docker-compose.yml -f docker-compose.local.yml $@ -------------------------------------------------------------------------------- /docker/php/local.ini: -------------------------------------------------------------------------------- 1 | upload_max_filesize=40M 2 | post_max_size=40M 3 | extension=opencensus.so 4 | log_errors=on -------------------------------------------------------------------------------- /resources/assets/sass/app.scss: -------------------------------------------------------------------------------- 1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 2 | 3 | -------------------------------------------------------------------------------- /app/Events/Event.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
Copyright asdasdas - All Rights Reserved
-------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | compiled.php 4 | services.json 5 | events.scanned.php 6 | routes.scanned.php 7 | down 8 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | Options +FollowSymLinks 2 | RewriteEngine On 3 | 4 | RewriteCond %{REQUEST_FILENAME} !-d 5 | RewriteCond %{REQUEST_FILENAME} !-f 6 | RewriteRule ^ index.php [L] -------------------------------------------------------------------------------- /resources/views/emails/contact.blade.php: -------------------------------------------------------------------------------- 1 |Sent via {{ $email }}
-------------------------------------------------------------------------------- /app/Book.php: -------------------------------------------------------------------------------- 1 | 2 | {{ $link }} -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "gulp": "^3.8.8" 5 | }, 6 | "dependencies": { 7 | "laravel-elixir": "^4.0.0", 8 | "bootstrap-sass": "^3.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/Comment.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Post'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/Tag.php: -------------------------------------------------------------------------------- 1 | belongsToMany('App\Post'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ansible/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: yes 4 | vars_files: 5 | - "vars/{{ env }}.yml" 6 | roles: 7 | - role: mysql 8 | when: env == 'prod' 9 | - role: docker 10 | docker_install_compose: true 11 | - role: deployment 12 | -------------------------------------------------------------------------------- /app/Category.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Post'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /database/seeds/BookTableSeeder.php: -------------------------------------------------------------------------------- 1 | create(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /database/seeds/CategoryTableSeeder.php: -------------------------------------------------------------------------------- 1 | create(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /database/seeds/PostsTableSeeder.php: -------------------------------------------------------------------------------- 1 | create(); 15 | factory(App\Post::class, 10)->create(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /resources/views/partials/_javascript.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/views/tags/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('main') 2 | 3 | @section('title', "| Edit Tag") 4 | 5 | @section('content') 6 | 7 | {{ Form::model($tag, ['route' => ['tags.update', $tag->id], 'method' => "PUT"]) }} 8 | 9 | {{ Form::label('name', "Title:") }} 10 | {{ Form::text('name', null, ['class' => 'form-control']) }} 11 | 12 | {{ Form::submit('Save Changes', ['class' => 'btn btn-success', 'style' => 'margin-top:20px;']) }} 13 | {{ Form::close() }} 14 | 15 | @endsection -------------------------------------------------------------------------------- /resources/views/partials/_messages.blade.php: -------------------------------------------------------------------------------- 1 | @if (Session::has('success')) 2 | 3 |Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis aspernatur quas quibusdam veniam sunt animi, est quos optio explicabo deleniti inventore unde minus, tempore enim ratione praesentium, cumque, dolores nesciunt?
10 |
11 | Name: {{ $comment->name }}
12 | Email: {{ $comment->email }}
13 | Comment: {{ $comment->comment }}
14 |
Forgot My Password 24 | 25 | 26 | {!! Form::close() !!} 27 |
{{ substr(strip_tags($post->body), 0, 250) }}{{ strlen(strip_tags($post->body)) > 250 ? '...' : "" }}
21 | 22 | Read More 23 || # | 14 |Name | 15 |
|---|---|
| {{ $tag->id }} | 22 |{{ $tag->name }} | 23 |
| # | 14 |Name | 15 |
|---|---|
| {{ $category->id }} | 22 |{{ $category->name }} | 23 |
Thank you so much for visiting. This is my test website built with Laravel. Please read my popular post!
11 | 12 |{{ substr(strip_tags($post->body), 0, 300) }}{{ strlen(strip_tags($post->body)) > 300 ? "..." : "" }}
24 | Read More 25 || # | 25 |Title | 26 |Body | 27 |Created At | 28 |29 | 30 | 31 | 32 | 33 | @foreach ($posts as $post) 34 | 35 | |
|---|---|---|---|---|
| {{ $post->id }} | 37 |{{ $post->title }} | 38 |{{ substr(strip_tags($post->body), 0, 50) }}{{ strlen(strip_tags($post->body)) > 50 ? "..." : "" }} | 39 |{{ date('M j, Y', strtotime($post->created_at)) }} | 40 |View Edit | 41 |
| # | 27 |Title | 28 |Tags | 29 |30 | |
|---|---|---|---|
| {{ $post->id }} | 37 |{{ $post->title }} | 38 |@foreach ($post->tags as $tag) 39 | {{ $tag->name }} 40 | @endforeach 41 | | 42 |View | 43 |
title";
33 | //print($db_post[0]);
34 | $db_post_title = ucfirst($db_post[0]->title);
35 | //exit;
36 | // load post using Eloquent
37 | $model_post = Post::find(1);
38 | $model_post_title = $model_post->title;
39 |
40 | $this->assertEquals($db_post_title, $model_post_title);
41 | }*/
42 |
43 | /**
44 | * A basic test example.
45 | *
46 | * @return void
47 | */
48 | /*public function testBasicTest()
49 | {
50 | // load post manually first
51 | $db_post = DB::select('select title from posts where id = 1');
52 | $db_post_title = ucfirst($db_post[0]->title);
53 |
54 | //$response = $this->get('http://localhost/laravel_blog/public/accessor/index?id=1');
55 |
56 | $response = $this->get('/accessor/index?id=1');
57 |
58 | $response->assertStatus(200);
59 | $response->assertSeeText($db_post_title);
60 | }*/
61 | }
62 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | 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 |
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | /*
11 | |--------------------------------------------------------------------------
12 | | Register The Auto Loader
13 | |--------------------------------------------------------------------------
14 | |
15 | | Composer provides a convenient, automatically generated class loader for
16 | | our application. We just need to utilize it! We'll simply require it
17 | | into the script here so that we don't have to worry about manual
18 | | loading any of our classes later on. It feels nice to relax.
19 | |
20 | */
21 |
22 | require __DIR__.'/../bootstrap/autoload.php';
23 |
24 | /*
25 | |--------------------------------------------------------------------------
26 | | Turn On The Lights
27 | |--------------------------------------------------------------------------
28 | |
29 | | We need to illuminate PHP development, so let us turn on the lights.
30 | | This bootstraps the framework and gets it ready for use, then it
31 | | will load up this application so that we can run it and send
32 | | the responses back to the browser and delight our users.
33 | |
34 | */
35 |
36 | $app = require_once __DIR__.'/../bootstrap/app.php';
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Run The Application
41 | |--------------------------------------------------------------------------
42 | |
43 | | Once we have the application, we can handle the incoming request
44 | | through the kernel, and send the associated response back to
45 | | the client's browser allowing them to enjoy the creative
46 | | and wonderful application we have prepared for them.
47 | |
48 | */
49 |
50 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
51 |
52 | $response = $kernel->handle(
53 | $request = Illuminate\Http\Request::capture()
54 | );
55 |
56 | $response->send();
57 |
58 | $kernel->terminate($request, $response);
59 |
--------------------------------------------------------------------------------
/ansible/vars/prod.yml:
--------------------------------------------------------------------------------
1 | ---
2 | mysql_root_password: !vault |
3 | $ANSIBLE_VAULT;1.1;AES256
4 | 61313835633639326662623933393862353361653161346634363638333366353765323631343866
5 | 6232366537616336333262663236643965653266643461320a643166336261363662393037303837
6 | 31313833326439616265393066373730383439613366626462643335633966633436353436633936
7 | 3361623431323365650a326163366662316431366364366230326137336630616233613166383364
8 | 3565
9 |
10 | mysql_root_username: root
11 |
12 | deployment_mysql_hospice_name: hospice
13 | deployment_mysql_hospice_username: hospice_user
14 | deployment_mysql_hospoce_password: !vault |
15 | $ANSIBLE_VAULT;1.1;AES256
16 | 33343136386364626234333131386135353238643462643939666137386235663131663834353561
17 | 3565623930363030636334633230396639303835643034390a306130373830303332653837613835
18 | 36346233396535643433383139366564643064343037373135333934376530623932653163303266
19 | 3466653231353838350a616466356430306463353239396361363737373339383664666663653963
20 | 3664
21 |
22 | deployment_db: false
23 | deployment_app_image: varunpalekar1/php-test:latest
24 | deployment_webserver:
25 | ports:
26 | - "80"
27 | - "443"
28 | volumes:
29 | - ./:/var/www
30 | - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
31 |
32 | deployment_app:
33 | image: "{{ deployment_app_image }}"
34 | environment:
35 | APP_ENV: prod
36 | APP_DEBUG: "true"
37 | APP_KEY: base64:oPD/hrRXGvA1hydZp17JAQH2PnflMgp4P5OMWoldWTM=
38 |
39 | DB_HOST: localhost
40 | DB_DATABASE: "{{ deployment_mysql_hospice_name }}"
41 | DB_USERNAME: "{{ deployment_mysql_hospice_username }}"
42 | DB_PASSWORD: "{{ deployment_mysql_hospoce_password }}"
43 |
44 | volumes:
45 | - ./docker/php/local.ini:/usr/local/etc/php/conf.d/local.ini
46 |
47 | mysql_databases:
48 | - name: "{{ deployment_mysql_hospice_name }}"
49 | encoding: latin1
50 | collation: latin1_general_ci
51 | mysql_users:
52 | - name: "{{ deployment_mysql_hospice_username }}"
53 | host: "%"
54 | priv: "hospice.*:ALL"
55 | password: "{{ deployment_mysql_hospoce_password }}"
--------------------------------------------------------------------------------
/ansible/roles/deployment/templates/docker-compose.yml.j2:
--------------------------------------------------------------------------------
1 | version: "3"
2 |
3 | services:
4 | {% if deployment_webserver %}
5 | webserver:
6 | {% if deployment_webserver.ports is defined %}
7 | ports:
8 | {% for val in deployment_webserver.ports %}
9 | - {{ val }}
10 | {% endfor %}
11 | {% endif %}
12 |
13 | {% if deployment_webserver.volumes is defined %}
14 | volumes:
15 | {% for val in deployment_webserver.volumes %}
16 | - {{ val }}
17 | {% endfor %}
18 | {% endif %}
19 |
20 | {% if deployment_webserver.environment is defined %}
21 | environment:
22 | {% for key, val in deployment_webserver.environment.iteritems() %}
23 | {{ key }} : "{{ val }}"
24 | {% endfor %}
25 | {% endif %}
26 | {% endif %}
27 |
28 | {% if deployment_app %}
29 | # PHP-fpm server
30 | app:
31 | {% if deployment_app.ports is defined %}
32 | ports:
33 | {% for val in deployment_app.ports %}
34 | - {{ val }}
35 | {% endfor %}
36 | {% endif %}
37 |
38 | {% if deployment_app.image is defined %}
39 | image: {{ deployment_app.image }}
40 | {% endif %}
41 |
42 | {% if deployment_app.volumes is defined %}
43 | volumes:
44 | {% for val in deployment_app.volumes %}
45 | - {{ val }}
46 | {% endfor %}
47 | {% endif %}
48 |
49 | {% if deployment_app.environment is defined %}
50 | environment:
51 | {% for key, val in deployment_app.environment.iteritems() %}
52 | {{ key }} : "{{ val }}"
53 | {% endfor %}
54 | {% endif %}
55 | {% endif %}
56 |
57 | {% if deployment_db %}
58 | ## MYSQL db
59 | db:
60 | {% if deployment_db.ports is defined %}
61 | ports:
62 | {% for val in deployment_db.ports %}
63 | - {{ val }}
64 | {% endfor %}
65 | {% endif %}
66 |
67 | {% if deployment_db.volumes is defined %}
68 | volumes:
69 | {% for val in deployment_db.volumes %}
70 | - {{ val }}
71 | {% endfor %}
72 | {% endif %}
73 | image: mysql:5.7.22
74 | container_name: db
75 | restart: unless-stopped
76 | networks:
77 | - app-network
78 | {% if deployment_db.environment is defined %}
79 | environment:
80 | {% for key, val in deployment_db.environment.iteritems() %}
81 | {{ key }} : "{{ val }}"
82 | {% endfor %}
83 | {% endif %}
84 | {% endif %}
--------------------------------------------------------------------------------
/tests/BookTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
18 | }*/
19 |
20 | /* @test */
21 |
22 | public function test_book_can_deleted(){
23 | //$Category = factory(App\Category::class)->create();
24 |
25 | /* $post = $Category->posts()->create([
26 | 'title' => 'HabbitTest11',
27 | 'body' => 'HabbitTest11@gmail.com',
28 | 'slug' => str_random(10),
29 | ]);
30 |
31 | $post->delete();
32 |
33 | $this->notSeeInDatabase('posts',['id'=>26,'title'=>'HabbitTest11']);
34 |
35 | */
36 |
37 | // $found_post = Post::find(25);
38 | // $name = 'Doyle Wunsch';
39 | // $found_post = Post::where('title', '=', $name)->first();
40 | // $found_post->delete();
41 | // $this->notSeeInDatabase('posts',['title'=>'Doyle Wunsch']);
42 |
43 | $title = 'Hab_NHlit';
44 | $found_post = Post::where('title', '=', $title)->first();
45 | $this->assertEquals($found_post->title,'Hab_NHlit');
46 |
47 | }
48 |
49 | public function test_book_can_created()
50 | {
51 | $Category = factory(App\Category::class)->create();
52 |
53 | $post = $Category->posts()->create([
54 | 'title' => 'Hab_'.str_random(5),
55 | 'body' => 'This Post is related to'.str_random(20),
56 | 'slug' => str_random(10),
57 |
58 | //'title' => 'HabbitTest',
59 | //'body' => 'HabbitTest@gmail.com',
60 | //'slug' => str_random(10),
61 |
62 | ]);
63 |
64 | //$found_post = Post::find(24);
65 | //$this->assertEquals($found_post->title,'HabbitTest');
66 | //$this->seeInDatabase('posts',['id'=>24,'title'=>'HabbitTest']);
67 | }
68 |
69 |
70 |
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/AuthController.php:
--------------------------------------------------------------------------------
1 | middleware('guest', ['except' => 'getLogout']);
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|confirmed|min:6',
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 |
--------------------------------------------------------------------------------
/docker-compose.local.yml:
--------------------------------------------------------------------------------
1 | version: "3"
2 |
3 | services:
4 | # Nginx web server
5 | webserver:
6 | image: nginx:alpine
7 | container_name: webserver
8 | restart: unless-stopped
9 | tty: true
10 | ports:
11 | - "80:80"
12 | - "443:443"
13 | volumes:
14 | - ./:/var/www
15 | - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
16 | networks:
17 | - app-network
18 |
19 | # PHP-fpm server
20 | app:
21 | build:
22 | context: .
23 | dockerfile: Dockerfile
24 | image: varun/laravel-php-fpm
25 | container_name: app
26 | restart: unless-stopped
27 | tty: true
28 | environment:
29 | SERVICE_NAME: app
30 | SERVICE_TAGS: dev
31 | TERM: xterm
32 | APP_ENV: local
33 | XDEBUG_CONFIG: idekey=PHPSTORM
34 | working_dir: /var/www
35 | volumes:
36 | - ./:/var/www
37 | - ./docker/php/local.ini:/usr/local/etc/php/conf.d/local.ini
38 | networks:
39 | - app-network
40 |
41 | ## MYSQL db
42 | db:
43 | image: mysql:5.7.22
44 | container_name: db
45 | restart: unless-stopped
46 | tty: true
47 | # ports:
48 | # - "3306:3306"
49 | volumes:
50 | - ./docker-data/mysql:/var/lib/mysql
51 | - ./docker/mysql/my.cnf:/etc/mysql/my.cnf
52 | environment:
53 | MYSQL_DATABASE: laravel
54 | MYSQL_ROOT_PASSWORD: your_mysql_root_password
55 | SERVICE_TAGS: dev
56 | SERVICE_NAME: mysql
57 | networks:
58 | - app-network
59 |
60 | phpmyadmin:
61 | image: phpmyadmin/phpmyadmin
62 | restart: always
63 | environment:
64 | PMA_HOST: db
65 | ports:
66 | - 8001:80
67 | networks:
68 | - app-network
69 |
70 | # # You can enable this if don't want to host jaeger outside
71 | jaeger:
72 | # container_name: laravel_jaeger
73 | image: jaegertracing/all-in-one:1.6
74 | restart: always
75 | ports:
76 | # - 5775:5775/udp
77 | - 6831:6831/udp
78 | - 6832:6832/udp
79 | # - 5778:5778
80 | - 16686:16686
81 | # - 14268:14268
82 | # - 9411:9411
83 | environment:
84 | COLLECTOR_ZIPKIN_HTTP_PORT: 9411
85 | networks:
86 | - app-network
87 |
88 | networks:
89 | app-network:
90 | driver: bridge
91 |
--------------------------------------------------------------------------------
/resources/views/posts/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends('main')
2 |
3 | @section('title', '| Create New Post')
4 |
5 | @section('stylesheets')
6 |
7 | {!! Html::style('css/parsley.css') !!}
8 | {!! Html::style('css/select2.min.css') !!}
9 |
10 |
11 |
18 |
19 | @endsection
20 |
21 | @section('content')
22 |
23 |
24 |
25 | Create New Post
26 |
27 | {!! Form::open(array('route' => 'posts.store', 'data-parsley-validate' => '', 'files' => true)) !!}
28 | {{ Form::label('title', 'Title:') }}
29 | {{ Form::text('title', null, array('class' => 'form-control', 'required' => '', 'maxlength' => '255')) }}
30 |
31 | {{ Form::label('slug', 'Slug:') }}
32 | {{ Form::text('slug', null, array('class' => 'form-control', 'required' => '', 'minlength' => '5', 'maxlength' => '255') ) }}
33 |
34 | {{ Form::label('category_id', 'Category:') }}
35 |
41 |
42 |
43 | {{ Form::label('tags', 'Tags:') }}
44 |
50 |
51 | {{ Form::label('featured_img', 'Upload a Featured Image') }}
52 | {{ Form::file('featured_img') }}
53 |
54 | {{ Form::label('body', "Post Body:") }}
55 | {{ Form::textarea('body', null, array('class' => 'form-control')) }}
56 |
57 | {{ Form::submit('Create Post', array('class' => 'btn btn-success btn-lg btn-block', 'style' => 'margin-top: 20px;')) }}
58 | {!! Form::close() !!}
59 |
60 |
61 |
62 | @endsection
63 |
64 |
65 | @section('scripts')
66 |
67 | {!! Html::script('js/parsley.min.js') !!}
68 | {!! Html::script('js/select2.min.js') !!}
69 |
70 |
73 |
74 | @endsection
75 |
--------------------------------------------------------------------------------
/resources/views/blog/single.blade.php:
--------------------------------------------------------------------------------
1 | @extends('main')
2 | title); ?>
3 | @section('title', "| $titleTag")
4 |
5 | @section('content')
6 |
7 |
8 |
9 | @if(!empty($post->image))
10 |
11 | @endif
12 | {{ $post->title }}
13 | {!! $post->body !!}
14 |
15 | Posted In: {{ $post->category->name }}
16 |
17 |
18 |
19 |
20 |
21 | {{ $post->comments()->count() }} Comments
22 | @foreach($post->comments as $comment)
23 |
41 |
42 |
43 |
44 |
45 | {{ Form::open(['route' => ['comments.store', $post->id], 'method' => 'POST']) }}
46 |
47 |
48 |
49 | {{ Form::label('name', "Name:") }}
50 | {{ Form::text('name', null, ['class' => 'form-control']) }}
51 |
52 |
53 |
54 | {{ Form::label('email', 'Email:') }}
55 | {{ Form::text('email', null, ['class' => 'form-control']) }}
56 |
57 |
58 |
59 | {{ Form::label('comment', "Comment:") }}
60 | {{ Form::textarea('comment', null, ['class' => 'form-control', 'rows' => '5']) }}
61 |
62 | {{ Form::submit('Add Comment', ['class' => 'btn btn-success btn-block', 'style' => 'margin-top:15px;']) }}
63 |
64 |
65 |
66 | {{ Form::close() }}
67 |
68 |
69 |
70 | @endsection
71 |
--------------------------------------------------------------------------------
/resources/views/partials/_nav.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/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' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
55 | ],
56 | ],
57 | ],
58 |
59 | 'redis' => [
60 | 'driver' => 'redis',
61 | 'connection' => 'default',
62 | ],
63 |
64 | ],
65 |
66 | /*
67 | |--------------------------------------------------------------------------
68 | | Cache Key Prefix
69 | |--------------------------------------------------------------------------
70 | |
71 | | When utilizing a RAM based store such as APC or Memcached, there might
72 | | be other applications utilizing the same cache. So, we'll specify a
73 | | value to get prefixed to all our keys so we can avoid collisions.
74 | |
75 | */
76 |
77 | 'prefix' => 'laravel',
78 |
79 | ];
80 |
--------------------------------------------------------------------------------
/resources/views/posts/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('main')
2 |
3 | @section('title', '| Edit Blog Post')
4 |
5 | @section('stylesheets')
6 |
7 | {!! Html::style('css/select2.min.css') !!}
8 |
9 |
10 |
11 |
18 |
19 | @endsection
20 |
21 | @section('content')
22 |
23 |
24 | {!! Form::model($post, ['route' => ['posts.update', $post->id], 'method' => 'PUT']) !!}
25 |
26 | {{ Form::label('title', 'Title:') }}
27 | {{ Form::text('title', null, ["class" => 'form-control input-lg']) }}
28 |
29 | {{ Form::label('slug', 'Slug:', ['class' => 'form-spacing-top']) }}
30 | {{ Form::text('slug', null, ['class' => 'form-control']) }}
31 |
32 | {{ Form::label('category_id', "Category:", ['class' => 'form-spacing-top']) }}
33 | {{ Form::select('category_id', $categories, null, ['class' => 'form-control']) }}
34 |
35 | {{ Form::label('tags', 'Tags:', ['class' => 'form-spacing-top']) }}
36 | {{ Form::select('tags[]', $tags, null, ['class' => 'form-control select2-multi', 'multiple' => 'multiple']) }}
37 |
38 | {{ Form::label('body', "Body:", ['class' => 'form-spacing-top']) }}
39 | {{ Form::textarea('body', null, ['class' => 'form-control']) }}
40 |
41 |
42 |
43 |
44 |
45 | - Created At:
46 | - {{ date('M j, Y h:ia', strtotime($post->created_at)) }}
47 |
48 |
49 |
50 | - Last Updated:
51 | - {{ date('M j, Y h:ia', strtotime($post->updated_at)) }}
52 |
53 |
54 |
55 |
56 | {!! Html::linkRoute('posts.show', 'Cancel', array($post->id), array('class' => 'btn btn-danger btn-block')) !!}
57 |
58 |
59 | {{ Form::submit('Save Changes', ['class' => 'btn btn-success btn-block']) }}
60 |
61 |
62 |
63 |
64 |
65 | {!! Form::close() !!}
66 |
67 |
68 | @stop
69 |
70 | @section('scripts')
71 |
72 | {!! Html::script('js/select2.min.js') !!}
73 |
74 |
80 |
81 | @endsection
--------------------------------------------------------------------------------
/tests/UserTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
17 | }
18 |
19 | public function test_user_can_created(){
20 |
21 | $User = factory(App\User::class)->create();
22 |
23 | //$post_user = $User->create([
24 | //'title' => 'Hab_'.str_random(5),
25 | //'body' => 'This Post is related to'.str_random(20),
26 | //'slug' => str_random(10),
27 |
28 | // 'name' => 'Varun',
29 | //'email' => 'varun@nitorinfotech.com',
30 | //'password' => bcrypt('varun'),
31 | // 'remember_token' => str_random(10),
32 |
33 |
34 | //]);
35 |
36 | //$name = 'PrashantNitor';
37 | //$found_user = User::where('name', '=', $name)->first();
38 | // $this->assertEquals($found_user->name,'PrashantNitor');
39 |
40 | //$found_userId = User::find(33);
41 | //$this->assertEquals($found_userId->name,'PrashantNitor');
42 | //$this->seeInDatabase('users',['id'=>33,'name'=>'PrashantNitor']);
43 |
44 | //$found_userId = User::find(33);
45 | //$found_userId->delete();
46 | //$this->notSeeInDatabase('users',['name'=>'PrashantNitor']);
47 | }
48 |
49 | public function test_user_can_deleted(){
50 |
51 | //$User = factory(App\User::class)->create();
52 |
53 |
54 |
55 | $name = 'PrashantNitor';
56 | $found_user = User::where('name', '=', $name)->first();
57 | $this->assertEquals($found_user->name,'PrashantNitor');
58 |
59 | //$found_userId = User::find(33);
60 | //$this->assertEquals($found_userId->name,'PrashantNitor');
61 | //$this->seeInDatabase('users',['id'=>33,'name'=>'PrashantNitor']);
62 |
63 | // Search by id and delete
64 |
65 | //$found_userId = User::find(40);
66 | //$found_userId->delete();
67 | //$this->notSeeInDatabase('users',['name'=>'Varun']);
68 |
69 | // Search by name and delete
70 |
71 | //$name = 'Asha Rohan';
72 | //$found_user = User::where('name', '=', $name)->first();
73 | //$this->assertEquals($found_user->name,'Varun');
74 | //$found_user->delete();
75 | //$this->notSeeInDatabase('users',['name'=>'Asha Rohan']);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/Http/Controllers/CategoryController.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
16 | }
17 |
18 | /**
19 | * Display a listing of the resource.
20 | *
21 | * @return \Illuminate\Http\Response
22 | */
23 | public function index()
24 | {
25 | // display a view of all of our categories
26 | // it will also have a form to create a new category
27 |
28 | $categories = Category::all();
29 | return view('categories.index')->withCategories($categories);
30 |
31 | }
32 |
33 | /**
34 | * Store a newly created resource in storage.
35 | *
36 | * @param \Illuminate\Http\Request $request
37 | * @return \Illuminate\Http\Response
38 | */
39 | public function store(Request $request)
40 | {
41 | // Save a new category and then redirect back to index
42 | $this->validate($request, array(
43 | 'name' => 'required|max:255'
44 | ));
45 |
46 | $category = new Category;
47 |
48 | $category->name = $request->name;
49 | $category->save();
50 |
51 | Session::flash('success', 'New Category has been created');
52 |
53 | return redirect()->route('categories.index');
54 | }
55 |
56 | /**
57 | * Display the specified resource.
58 | *
59 | * @param int $id
60 | * @return \Illuminate\Http\Response
61 | */
62 | public function show($id)
63 | {
64 | // Display the category and all the posts in that category
65 | }
66 |
67 | /**
68 | * Show the form for editing the specified resource.
69 | *
70 | * @param int $id
71 | * @return \Illuminate\Http\Response
72 | */
73 | public function edit($id)
74 | {
75 | //
76 | }
77 |
78 | /**
79 | * Update the specified resource in storage.
80 | *
81 | * @param \Illuminate\Http\Request $request
82 | * @param int $id
83 | * @return \Illuminate\Http\Response
84 | */
85 | public function update(Request $request, $id)
86 | {
87 | //
88 | }
89 |
90 | /**
91 | * Remove the specified resource from storage.
92 | *
93 | * @param int $id
94 | * @return \Illuminate\Http\Response
95 | */
96 | public function destroy($id)
97 | {
98 | //
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/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/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 | 'ftp' => [
52 | 'driver' => 'ftp',
53 | 'host' => 'ftp.example.com',
54 | 'username' => 'your-username',
55 | 'password' => 'your-password',
56 |
57 | // Optional FTP Settings...
58 | // 'port' => 21,
59 | // 'root' => '',
60 | // 'passive' => true,
61 | // 'ssl' => true,
62 | // 'timeout' => 30,
63 | ],
64 |
65 | 's3' => [
66 | 'driver' => 's3',
67 | 'key' => 'your-key',
68 | 'secret' => 'your-secret',
69 | 'region' => 'your-region',
70 | 'bucket' => 'your-bucket',
71 | ],
72 |
73 | 'rackspace' => [
74 | 'driver' => 'rackspace',
75 | 'username' => 'your-username',
76 | 'key' => 'your-key',
77 | 'container' => 'your-container',
78 | 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
79 | 'region' => 'IAD',
80 | 'url_type' => 'publicURL',
81 | ],
82 |
83 | ],
84 |
85 | ];
86 |
--------------------------------------------------------------------------------
/app/Http/routes.php:
--------------------------------------------------------------------------------
1 | ['web']], function () {
27 | // Authentication Routes
28 | Route::get('auth/login', ['as' => 'login', 'uses' => 'Auth\AuthController@getLogin']);
29 | Route::post('auth/login', 'Auth\AuthController@postLogin');
30 | Route::get('auth/logout', ['as' => 'logout', 'uses' => 'Auth\AuthController@getLogout']);
31 |
32 | // Registration Routes
33 | Route::get('auth/register', 'Auth\AuthController@getRegister');
34 | Route::post('auth/register', 'Auth\AuthController@postRegister');
35 |
36 | // Password Reset Routes
37 | Route::get('password/reset/{token?}', 'Auth\PasswordController@showResetForm');
38 | Route::post('password/email', 'Auth\PasswordController@sendResetLinkEmail');
39 | Route::post('password/reset', 'Auth\PasswordController@reset');
40 |
41 | // Categories
42 | Route::resource('categories', 'CategoryController', ['except' => ['create']]);
43 | Route::resource('tags', 'TagController', ['except' => ['create']]);
44 |
45 | // Comments
46 | Route::post('comments/{post_id}', ['uses' => 'CommentsController@store', 'as' => 'comments.store']);
47 | Route::get('comments/{id}/edit', ['uses' => 'CommentsController@edit', 'as' => 'comments.edit']);
48 | Route::put('comments/{id}', ['uses' => 'CommentsController@update', 'as' => 'comments.update']);
49 | Route::delete('comments/{id}', ['uses' => 'CommentsController@destroy', 'as' => 'comments.destroy']);
50 | Route::get('comments/{id}/delete', ['uses' => 'CommentsController@delete', 'as' => 'comments.delete']);
51 |
52 |
53 | Route::get('blog/{slug}', ['as' => 'blog.single', 'uses' => 'BlogController@getSingle'])->where('slug', '[\w\d\-\_]+');
54 | Route::get('blog', ['uses' => 'BlogController@getIndex', 'as' => 'blog.index']);
55 | Route::get('contact', 'PagesController@getContact');
56 | Route::post('contact', 'PagesController@postContact');
57 | Route::get('about', 'PagesController@getAbout');
58 | Route::get('/', 'PagesController@getIndex');
59 | Route::resource('posts', 'PostController');
60 | Route::get('accessor/index', 'AccessorController@index');
61 | });
62 |
--------------------------------------------------------------------------------
/resources/views/posts/show.blade.php:
--------------------------------------------------------------------------------
1 | @extends('main')
2 |
3 | @section('title', '| View Post')
4 |
5 | @section('content')
6 |
7 |
8 |
9 | {{ $post->title }}
10 |
11 | {!! $post->body !!}
12 |
13 |
14 |
15 |
20 |
21 |
22 | Comments {{ $post->comments()->count() }} total
23 |
24 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | {{ $post->category->name }}
61 |
62 |
63 |
64 |
65 | {{ date('M j, Y h:ia', strtotime($post->created_at)) }}
66 |
67 |
68 |
69 |
70 | {{ date('M j, Y h:ia', strtotime($post->updated_at)) }}
71 |
72 |
73 |
74 |
75 | {!! Html::linkRoute('posts.edit', 'Edit', array($post->id), array('class' => 'btn btn-primary btn-block')) !!}
76 |
77 |
78 | {!! Form::open(['route' => ['posts.destroy', $post->id], 'method' => 'DELETE']) !!}
79 |
80 | {!! Form::submit('Delete', ['class' => 'btn btn-danger btn-block']) !!}
81 |
82 | {!! Form::close() !!}
83 |
84 |
85 |
86 |
87 |
88 | {{ Html::linkRoute('posts.index', '<< See All Posts', array(), ['class' => 'btn btn-default btn-block btn-h1-spacing']) }}
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | @endsection
--------------------------------------------------------------------------------
/app/Http/Controllers/TagController.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
16 | }
17 |
18 | /**
19 | * Display a listing of the resource.
20 | *
21 | * @return \Illuminate\Http\Response
22 | */
23 | public function index()
24 | {
25 | $tags = Tag::all();
26 | return view('tags.index')->withTags($tags);
27 | }
28 |
29 | /**
30 | * Store a newly created resource in storage.
31 | *
32 | * @param \Illuminate\Http\Request $request
33 | * @return \Illuminate\Http\Response
34 | */
35 | public function store(Request $request)
36 | {
37 | $this->validate($request, array('name' => 'required|max:255'));
38 | $tag = new Tag;
39 | $tag->name = $request->name;
40 | $tag->save();
41 |
42 | Session::flash('success', 'New Tag was successfully created!');
43 |
44 | return redirect()->route('tags.index');
45 | }
46 |
47 | /**
48 | * Display the specified resource.
49 | *
50 | * @param int $id
51 | * @return \Illuminate\Http\Response
52 | */
53 | public function show($id)
54 | {
55 | $tag = Tag::find($id);
56 | return view('tags.show')->withTag($tag);
57 | }
58 |
59 | /**
60 | * Show the form for editing the specified resource.
61 | *
62 | * @param int $id
63 | * @return \Illuminate\Http\Response
64 | */
65 | public function edit($id)
66 | {
67 | $tag = Tag::find($id);
68 | return view('tags.edit')->withTag($tag);
69 | }
70 |
71 | /**
72 | * Update the specified resource in storage.
73 | *
74 | * @param \Illuminate\Http\Request $request
75 | * @param int $id
76 | * @return \Illuminate\Http\Response
77 | */
78 | public function update(Request $request, $id)
79 | {
80 | $tag = Tag::find($id);
81 |
82 | $this->validate($request, ['name' => 'required|max:255']);
83 |
84 | $tag->name = $request->name;
85 | $tag->save();
86 |
87 | Session::flash('success', 'Successfully saved your new tag!');
88 |
89 | return redirect()->route('tags.show', $tag->id);
90 | }
91 |
92 | /**
93 | * Remove the specified resource from storage.
94 | *
95 | * @param int $id
96 | * @return \Illuminate\Http\Response
97 | */
98 | public function destroy($id)
99 | {
100 | $tag = Tag::find($id);
101 | $tag->posts()->detach();
102 |
103 | $tag->delete();
104 |
105 | Session::flash('success', 'Tag was deleted successfully');
106 |
107 | return redirect()->route('tags.index');
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/app/Http/Controllers/CommentsController.php:
--------------------------------------------------------------------------------
1 | middleware('auth', ['except' => 'store']);
17 | }
18 |
19 | /**
20 | * Store a newly created resource in storage.
21 | *
22 | * @param \Illuminate\Http\Request $request
23 | * @return \Illuminate\Http\Response
24 | */
25 | public function store(Request $request, $post_id)
26 | {
27 | $this->validate($request, array(
28 | 'name' => 'required|max:255',
29 | 'email' => 'required|email|max:255',
30 | 'comment' => 'required|min:5|max:2000'
31 | ));
32 |
33 | $post = Post::find($post_id);
34 |
35 | $comment = new Comment();
36 | $comment->name = $request->name;
37 | $comment->email = $request->email;
38 | $comment->comment = $request->comment;
39 | $comment->approved = true;
40 | $comment->post()->associate($post);
41 |
42 | $comment->save();
43 |
44 | Session::flash('success', 'Comment was added');
45 |
46 | return redirect()->route('blog.single', [$post->slug]);
47 | }
48 |
49 |
50 | /**
51 | * Show the form for editing the specified resource.
52 | *
53 | * @param int $id
54 | * @return \Illuminate\Http\Response
55 | */
56 | public function edit($id)
57 | {
58 | $comment = Comment::find($id);
59 | return view('comments.edit')->withComment($comment);
60 | }
61 |
62 | /**
63 | * Update the specified resource in storage.
64 | *
65 | * @param \Illuminate\Http\Request $request
66 | * @param int $id
67 | * @return \Illuminate\Http\Response
68 | */
69 | public function update(Request $request, $id)
70 | {
71 | $comment = Comment::find($id);
72 |
73 | $this->validate($request, array('comment' => 'required'));
74 |
75 | $comment->comment = $request->comment;
76 | $comment->save();
77 |
78 | Session::flash('success', 'Comment updated');
79 |
80 | return redirect()->route('posts.show', $comment->post->id);
81 | }
82 |
83 | public function delete($id)
84 | {
85 | $comment = Comment::find($id);
86 | return view('comments.delete')->withComment($comment);
87 | }
88 |
89 | /**
90 | * Remove the specified resource from storage.
91 | *
92 | * @param int $id
93 | * @return \Illuminate\Http\Response
94 | */
95 | public function destroy($id)
96 | {
97 | $comment = Comment::find($id);
98 | $post_id = $comment->post->id;
99 | $comment->delete();
100 |
101 | Session::flash('success', 'Deleted Comment');
102 |
103 | return redirect()->route('posts.show', $post_id);
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/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/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_DRIVER', 'smtp'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | SMTP Host Address
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may provide the host address of the SMTP server used by your
26 | | applications. A default option is provided that is compatible with
27 | | the Mailgun mail service which will provide reliable deliveries.
28 | |
29 | */
30 |
31 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | SMTP Host Port
36 | |--------------------------------------------------------------------------
37 | |
38 | | This is the SMTP port used by your application to deliver e-mails to
39 | | users of the application. Like the host we have set this value to
40 | | stay compatible with the Mailgun e-mail application by default.
41 | |
42 | */
43 |
44 | 'port' => env('MAIL_PORT', 587),
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Global "From" Address
49 | |--------------------------------------------------------------------------
50 | |
51 | | You may wish for all e-mails sent by your application to be sent from
52 | | the same address. Here, you may specify a name and address that is
53 | | used globally for all e-mails that are sent by your application.
54 | |
55 | */
56 |
57 | 'from' => ['address' => 'noreply@jacurtis.com', 'name' => 'Laravel Application'],
58 |
59 | /*
60 | |--------------------------------------------------------------------------
61 | | E-Mail Encryption Protocol
62 | |--------------------------------------------------------------------------
63 | |
64 | | Here you may specify the encryption protocol that should be used when
65 | | the application send e-mail messages. A sensible default using the
66 | | transport layer security protocol should provide great security.
67 | |
68 | */
69 |
70 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | SMTP Server Username
75 | |--------------------------------------------------------------------------
76 | |
77 | | If your SMTP server requires a username for authentication, you should
78 | | set it here. This will get used to authenticate with your server on
79 | | connection. You may also set the "password" value below this one.
80 | |
81 | */
82 |
83 | 'username' => env('MAIL_USERNAME'),
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | SMTP Server Password
88 | |--------------------------------------------------------------------------
89 | |
90 | | Here you may set the password required by your SMTP server to send out
91 | | messages from your application. This will be given to the server on
92 | | connection so that the application will be able to send messages.
93 | |
94 | */
95 |
96 | 'password' => env('MAIL_PASSWORD'),
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Sendmail System Path
101 | |--------------------------------------------------------------------------
102 | |
103 | | When using the "sendmail" driver to send e-mails, we will need to know
104 | | the path to where Sendmail lives on this server. A default path has
105 | | been provided here, which will work well on most of your systems.
106 | |
107 | */
108 |
109 | 'sendmail' => '/usr/sbin/sendmail -bs',
110 |
111 | ];
112 |
--------------------------------------------------------------------------------
/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' => database_path('database.sqlite'),
52 | 'prefix' => '',
53 | ],
54 |
55 | 'mysql' => [
56 | 'driver' => 'mysql',
57 | 'host' => env('DB_HOST', 'localhost'),
58 | 'database' => env('DB_DATABASE', 'forge'),
59 | 'username' => env('DB_USERNAME', 'forge'),
60 | 'password' => env('DB_PASSWORD', ''),
61 | 'charset' => 'utf8',
62 | 'collation' => 'utf8_unicode_ci',
63 | 'prefix' => '',
64 | 'strict' => false,
65 | ],
66 |
67 | 'pgsql' => [
68 | 'driver' => 'pgsql',
69 | 'host' => env('DB_HOST', 'localhost'),
70 | 'database' => env('DB_DATABASE', 'forge'),
71 | 'username' => env('DB_USERNAME', 'forge'),
72 | 'password' => env('DB_PASSWORD', ''),
73 | 'charset' => 'utf8',
74 | 'prefix' => '',
75 | 'schema' => 'public',
76 | ],
77 |
78 | 'sqlsrv' => [
79 | 'driver' => 'sqlsrv',
80 | 'host' => env('DB_HOST', 'localhost'),
81 | 'database' => env('DB_DATABASE', 'forge'),
82 | 'username' => env('DB_USERNAME', 'forge'),
83 | 'password' => env('DB_PASSWORD', ''),
84 | 'charset' => 'utf8',
85 | 'prefix' => '',
86 | ],
87 |
88 | ],
89 |
90 | /*
91 | |--------------------------------------------------------------------------
92 | | Migration Repository Table
93 | |--------------------------------------------------------------------------
94 | |
95 | | This table keeps track of all the migrations that have already run for
96 | | your application. Using this information, we can determine which of
97 | | the migrations on disk haven't actually been run in the database.
98 | |
99 | */
100 |
101 | 'migrations' => 'migrations',
102 |
103 | /*
104 | |--------------------------------------------------------------------------
105 | | Redis Databases
106 | |--------------------------------------------------------------------------
107 | |
108 | | Redis is an open source, fast, and advanced key-value store that also
109 | | provides a richer set of commands than a typical key-value systems
110 | | such as APC or Memcached. Laravel makes it easy to dig right in.
111 | |
112 | */
113 |
114 | 'redis' => [
115 |
116 | 'cluster' => false,
117 |
118 | 'default' => [
119 | 'host' => env('REDIS_HOST', 'localhost'),
120 | 'password' => env('REDIS_PASSWORD', null),
121 | 'port' => env('REDIS_PORT', 6379),
122 | 'database' => 0,
123 | ],
124 |
125 | ],
126 |
127 | ];
128 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'active_url' => 'The :attribute is not a valid URL.',
18 | 'after' => 'The :attribute must be a date after :date.',
19 | 'alpha' => 'The :attribute may only contain letters.',
20 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
21 | 'alpha_num' => 'The :attribute may only contain letters and numbers.',
22 | 'array' => 'The :attribute must be an array.',
23 | 'before' => 'The :attribute must be a date before :date.',
24 | 'between' => [
25 | 'numeric' => 'The :attribute must be between :min and :max.',
26 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
27 | 'string' => 'The :attribute must be between :min and :max characters.',
28 | 'array' => 'The :attribute must have between :min and :max items.',
29 | ],
30 | 'boolean' => 'The :attribute field must be true or false.',
31 | 'confirmed' => 'The :attribute confirmation does not match.',
32 | 'date' => 'The :attribute is not a valid date.',
33 | 'date_format' => 'The :attribute does not match the format :format.',
34 | 'different' => 'The :attribute and :other must be different.',
35 | 'digits' => 'The :attribute must be :digits digits.',
36 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
37 | 'email' => 'The :attribute must be a valid email address.',
38 | 'exists' => 'The selected :attribute is invalid.',
39 | 'filled' => 'The :attribute field is required.',
40 | 'image' => 'The :attribute must be an image.',
41 | 'in' => 'The selected :attribute is invalid.',
42 | 'integer' => 'The :attribute must be an integer.',
43 | 'ip' => 'The :attribute must be a valid IP address.',
44 | 'json' => 'The :attribute must be a valid JSON string.',
45 | 'max' => [
46 | 'numeric' => 'The :attribute may not be greater than :max.',
47 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
48 | 'string' => 'The :attribute may not be greater than :max characters.',
49 | 'array' => 'The :attribute may not have more than :max items.',
50 | ],
51 | 'mimes' => 'The :attribute must be a file of type: :values.',
52 | 'min' => [
53 | 'numeric' => 'The :attribute must be at least :min.',
54 | 'file' => 'The :attribute must be at least :min kilobytes.',
55 | 'string' => 'The :attribute must be at least :min characters.',
56 | 'array' => 'The :attribute must have at least :min items.',
57 | ],
58 | 'not_in' => 'The selected :attribute is invalid.',
59 | 'numeric' => 'The :attribute must be a number.',
60 | 'regex' => 'The :attribute format is invalid.',
61 | 'required' => 'The :attribute field is required.',
62 | 'required_if' => 'The :attribute field is required when :other is :value.',
63 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
64 | 'required_with' => 'The :attribute field is required when :values is present.',
65 | 'required_with_all' => 'The :attribute field is required when :values is present.',
66 | 'required_without' => 'The :attribute field is required when :values is not present.',
67 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
68 | 'same' => 'The :attribute and :other must match.',
69 | 'size' => [
70 | 'numeric' => 'The :attribute must be :size.',
71 | 'file' => 'The :attribute must be :size kilobytes.',
72 | 'string' => 'The :attribute must be :size characters.',
73 | 'array' => 'The :attribute must contain :size items.',
74 | ],
75 | 'string' => 'The :attribute must be a string.',
76 | 'timezone' => 'The :attribute must be a valid zone.',
77 | 'unique' => 'The :attribute has already been taken.',
78 | 'url' => 'The :attribute format is invalid.',
79 |
80 | /*
81 | |--------------------------------------------------------------------------
82 | | Custom Validation Language Lines
83 | |--------------------------------------------------------------------------
84 | |
85 | | Here you may specify custom validation messages for attributes using the
86 | | convention "attribute.rule" to name the lines. This makes it quick to
87 | | specify a specific custom language line for a given attribute rule.
88 | |
89 | */
90 |
91 | 'custom' => [
92 | 'attribute-name' => [
93 | 'rule-name' => 'custom-message',
94 | ],
95 | ],
96 |
97 | /*
98 | |--------------------------------------------------------------------------
99 | | Custom Validation Attributes
100 | |--------------------------------------------------------------------------
101 | |
102 | | The following language lines are used to swap attribute place-holders
103 | | with something more reader friendly such as E-Mail Address instead
104 | | of "email". This simply helps us make messages a little cleaner.
105 | |
106 | */
107 |
108 | 'attributes' => [],
109 |
110 | ];
111 |
--------------------------------------------------------------------------------
/app/Http/Controllers/PostController.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
21 | }
22 | /**
23 | * Display a listing of the resource.
24 | *
25 | * @return \Illuminate\Http\Response
26 | */
27 | public function index()
28 | {
29 | $posts = Post::orderBy('id', 'desc')->paginate(10);
30 | return view('posts.index')->withPosts($posts);
31 | }
32 |
33 | /**
34 | * Show the form for creating a new resource.
35 | *
36 | * @return \Illuminate\Http\Response
37 | */
38 | public function create()
39 | {
40 | $categories = Category::all();
41 | $tags = Tag::all();
42 | return view('posts.create')->withCategories($categories)->withTags($tags);
43 | }
44 |
45 | /**
46 | * Store a newly created resource in storage.
47 | *
48 | * @param \Illuminate\Http\Request $request
49 | * @return \Illuminate\Http\Response
50 | */
51 | public function store(Request $request)
52 | {
53 | // validate the data
54 | $this->validate($request, array(
55 | 'title' => 'required|max:255',
56 | 'slug' => 'required|alpha_dash|min:5|max:255|unique:posts,slug',
57 | 'category_id' => 'required|integer',
58 | 'body' => 'required'
59 | ));
60 |
61 | // store in the database
62 | $post = new Post;
63 |
64 | $post->title = $request->title;
65 | $post->slug = $request->slug;
66 | $post->category_id = $request->category_id;
67 | $post->body = Purifier::clean($request->body);
68 |
69 | if ($request->hasFile('featured_img')) {
70 | $image = $request->file('featured_img');
71 | $filename = time() . '.' . $image->getClientOriginalExtension();
72 | $location = public_path('images/' . $filename);
73 | Image::make($image)->resize(800, 400)->save($location);
74 |
75 | $post->image = $filename;
76 | }
77 |
78 | $post->save();
79 |
80 | $post->tags()->sync($request->tags, false);
81 |
82 | Session::flash('success', 'The blog post was successfully save!');
83 |
84 | return redirect()->route('posts.show', $post->id);
85 | }
86 |
87 | /**
88 | * Display the specified resource.
89 | *
90 | * @param int $id
91 | * @return \Illuminate\Http\Response
92 | */
93 | public function show($id)
94 | {
95 | $post = Post::find($id);
96 | return view('posts.show')->withPost($post);
97 | }
98 |
99 | /**
100 | * Show the form for editing the specified resource.
101 | *
102 | * @param int $id
103 | * @return \Illuminate\Http\Response
104 | */
105 | public function edit($id)
106 | {
107 | // find the post in the database and save as a var
108 | $post = Post::find($id);
109 | $categories = Category::all();
110 | $cats = array();
111 | foreach ($categories as $category) {
112 | $cats[$category->id] = $category->name;
113 | }
114 |
115 | $tags = Tag::all();
116 | $tags2 = array();
117 | foreach ($tags as $tag) {
118 | $tags2[$tag->id] = $tag->name;
119 | }
120 | // return the view and pass in the var we previously created
121 | return view('posts.edit')->withPost($post)->withCategories($cats)->withTags($tags2);
122 | }
123 |
124 | /**
125 | * Update the specified resource in storage.
126 | *
127 | * @param \Illuminate\Http\Request $request
128 | * @param int $id
129 | * @return \Illuminate\Http\Response
130 | */
131 | public function update(Request $request, $id)
132 | {
133 | // Validate the data
134 | $post = Post::find($id);
135 |
136 | if ($request->input('slug') == $post->slug) {
137 | $this->validate($request, array(
138 | 'title' => 'required|max:255',
139 | 'category_id' => 'required|integer',
140 | 'body' => 'required'
141 | ));
142 | } else {
143 | $this->validate($request, array(
144 | 'title' => 'required|max:255',
145 | 'slug' => 'required|alpha_dash|min:5|max:255|unique:posts,slug',
146 | 'category_id' => 'required|integer',
147 | 'body' => 'required'
148 | ));
149 | }
150 |
151 | // Save the data to the database
152 | $post = Post::find($id);
153 |
154 | $post->title = $request->input('title');
155 | $post->slug = $request->input('slug');
156 | $post->category_id = $request->input('category_id');
157 | $post->body = Purifier::clean($request->input('body'));
158 |
159 | $post->save();
160 |
161 | if (isset($request->tags)) {
162 | $post->tags()->sync($request->tags);
163 | } else {
164 | $post->tags()->sync(array());
165 | }
166 |
167 |
168 | // set flash data with success message
169 | Session::flash('success', 'This post was successfully saved.');
170 |
171 | // redirect with flash data to posts.show
172 | return redirect()->route('posts.show', $post->id);
173 | }
174 |
175 | /**
176 | * Remove the specified resource from storage.
177 | *
178 | * @param int $id
179 | * @return \Illuminate\Http\Response
180 | */
181 | public function destroy($id)
182 | {
183 | $post = Post::find($id);
184 | $post->tags()->detach();
185 |
186 | $post->tags()->detach();
187 |
188 | $post->delete();
189 |
190 | Session::flash('success', 'The post was successfully deleted.');
191 | return redirect()->route('posts.index');
192 | }
193 | }
194 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | Introduction
2 | ===========
3 |
4 | This repository shows complete CI/CD of sample PHP project. We are going to use following tools/technologies:
5 |
6 | 1. Jenkins: For integration various tools and technologies
7 | 2. PHP project in Laravel: We are having one blog project by using PHP laravel framework
8 | 3. Ansible: For deployment on dev and prod
9 | 4. Docker with docker-compose: For using deployment on local, dev and prod env
10 | 5. Sonarqube: Using sonarqube.io server of static code analysis and code coverage report
11 | 6. Branching: Following git-flow branching strategy
12 | 7. Using opencensus for distributed tracing
13 |
14 | Folder structure
15 | ================
16 |
17 | ```
18 | ├── ansible => ansible folder
19 | │ ├── hosts-dev => ansible hosts file for dev
20 | │ ├── hosts-prod => ansible hosts file for prod
21 | │ ├── playbook.yml => ansible playbook
22 | │ ├── requirements.yml => ansible-galaxy requirement file for other role
23 | │ ├── roles => ansible role folder
24 | │ │ └── deployment => ansible main role for deployment
25 | │ ├── vagrant => vagrant file need to share if you are using vagrant
26 | │ ├── Vagrantfile => vagrantfile for creating dev and prod env if you want to create in an automated way
27 | │ └── vars => ansible folder having some extra variable
28 | │ ├── dev.yml => ansible variable file for dev env
29 | │ └── prod.yml => ansible variable file for prod env
30 | ├── app => Laravel app folder
31 | ├── artisan => Laravel artisan file
32 | ├── bootstrap => Laravel bootstrap folder
33 | ├── composer.json => PHP composer file
34 | ├── composer.lock => PHP composer lock file
35 | ├── config => Laravel config folder
36 | ├── database => Laravel database folder
37 | │ ├── factories => Laravel factories folder which used for seeding
38 | │ │ └── ModelFactory.php
39 | │ ├── migrations => Laravel migration folder used for database migration
40 | │ │ ├── 2014_10_12_000000_create_users_table.php
41 | │ │ ├── 2014_10_12_100000_create_password_resets_table.php
42 | │ │ ├── 2016_02_06_175142_create_posts_table.php
43 | │ │ ├── 2016_03_20_162017_add_slug_to_users.php
44 | │ │ ├── 2016_04_28_021908_create_categories_table.php
45 | │ │ ├── 2016_04_28_022255_add_category_id_to_posts.php
46 | │ │ ├── 2016_05_30_153615_create_tags_table.php
47 | │ │ ├── 2016_05_30_155417_create_post_tag_table.php
48 | │ │ ├── 2016_07_16_173641_create_comments_table.php
49 | │ │ ├── 2016_08_15_000718_add_image_col_to_posts.php
50 | │ │ └── 2019_06_28_133124_create_books_table.php
51 | │ └── seeds => Laravel seeds folder used for database seeding
52 | │ ├── BookTableSeeder.php
53 | │ ├── CategoryTableSeeder.php
54 | │ ├── DatabaseSeeder.php
55 | │ ├── PostsTableSeeder.php
56 | │ └── UsersTableSeeder.php
57 | ├── docker => Folder contains some configuration file used by docker container
58 | │ ├── mysql
59 | │ │ └── my.cnf => default configuration file for mysql used in local and dev env only, in prodution we prefer to use standalone managed mysql database
60 | │ ├── nginx
61 | │ │ └── conf.d
62 | │ │ └── laravel.conf => Nginx configuration used for docker container (all env)
63 | │ ├── php
64 | │ │ └── local.ini => Php configuration used for docker container (all env)
65 | ├── docker-compose.local.yml => Docker-compose override file for local deployment using docker
66 | ├── docker-compose.yml => Default docker-compose file shared by all env
67 | ├── Dockerfile => Dockerfile used to build default php application docker container
68 | ├── gulpfile.js => Laravel gulpfile
69 | ├── Jenkinsfile => Jenkinsfile in which all CI/CD defined for this project
70 | ├── package.json => Default composer package.json
71 | ├── phpunit.xml
72 | ├── public => Laravel public folder
73 | ├── resources => Laravel resources folder
74 | ├── server.php => Laravel server file
75 | ├── sonar-project.properties => sonar-scanner properties file related to project
76 | ├── storage => Laravel storage folder
77 | └── tests => Php unit test folder
78 | ```
79 |
80 | Jenkins
81 | =======
82 |
83 | You can directly use jenkinsfile for all CI/CD. I am suggesting to use jenkins ocean blue to add pipeline by git project simply. Just go to new pipeline and add by using git URL.
84 |
85 | Deployment
86 | ==========
87 |
88 | ### Local deployment
89 |
90 | 1. Requirement:
91 | 1. docker
92 | 2. docker-compose
93 | 3. php-cli with composer
94 |
95 | 2. Deployment
96 |
97 | Run following command to deploy the project on local system by using docker-compose
98 |
99 | ```
100 | docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d
101 | ```
102 |
103 | 3. Install project dependencies
104 |
105 | ```
106 | composer install
107 | ```
108 |
109 | 4. Run migration
110 |
111 | ```
112 | docker-compose -f docker-compose.yml -f docker-compose.local.yml exec app php artisan migrate
113 | ```
114 |
115 | 5. Run seeding
116 |
117 | ```
118 | docker-compose -f docker-compose.yml -f docker-compose.local.yml exec app php db:seed --class=UsersTableSeeder
119 | docker-compose -f docker-compose.yml -f docker-compose.local.yml exec app php db:seed --class=PostsTableSeeder
120 | docker-compose -f docker-compose.yml -f docker-compose.local.yml exec app php db:seed --class=PostsTableSeeder
121 |
122 | ```
123 |
124 | 6. Application access
125 |
126 | Now you can access your application by using URL `http://localhost/`
127 |
128 | 7. Distributed tracing in Jaeger UI
129 |
130 | You can access Jaeger UI to see distributed tracing of you running application `http://localhost:16686`
131 |
132 | ### Dev deployment
133 |
134 | Please use jenkins-pipeline for deployment on dev.
135 |
136 | We are using ansible for deployment on dev. Please change `ansible/hosts-dev` for changing deployment node for dev. By default it run ansible playbook on all hosts.
137 |
138 | ### Prod deployment
139 |
140 | Please use jenkins-pipeline for deployment on prod
141 |
142 | We are using ansible for deployment on dev. Please change `ansible/hosts-prod` for changing deployment node for dev. By default it run ansible playbook on all hosts.
143 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | def getdockertag(){
2 | return "${env.GIT_BRANCH}".replace("/",".") + "."+"${env.BUILD_ID}"
3 | }
4 | pipeline {
5 | agent any
6 | environment {
7 | DOCKER_REGISTRY = "varunpalekar1/php-test"
8 | DOCKER_TAG = getdockertag()
9 | }
10 | stages {
11 | stage('Build') {
12 | steps {
13 | script {
14 | echo "install compose.json"
15 | sh 'composer install --prefer-source'
16 | sh 'printenv'
17 | dir('ansible') {
18 | sh 'ansible-galaxy install -r requirements.yml'
19 | }
20 | }
21 | }
22 | }
23 | stage('UnitTest') {
24 | environment {
25 | DB_HOST = "localhost"
26 | DB_DATABASE = "laravel_test"
27 | DB_USERNAME = "laravel_test"
28 | DB_PASSWORD = "my_pass"
29 | }
30 | steps {
31 | script {
32 | try{
33 | echo "Running Test cases"
34 | sh './vendor/bin/phpunit --colors tests --log-junit reports/junit.xml'
35 | }
36 | catch(Exception e){
37 | if ( GIT_BRANCH ==~ /.*master|.*hotfix\/.*|.*release\/.*/ )
38 | error "Test case failed"
39 | else
40 | echo "Skipped test if from personal or feature branch"
41 | }
42 | try{
43 | echo "Running Test code coverage"
44 | sh './vendor/bin/phpunit --coverage-clover reports/codeCoverage.xml'
45 | }
46 | catch(Exception e){
47 | if ( GIT_BRANCH ==~ /.*master|.*hotfix\/.*|.*release\/.*/ )
48 | error "Code coverage failed"
49 | else
50 | echo "Skipped code coverage if from personal or feature branch"
51 | }
52 | }
53 | }
54 | }
55 | stage('CodeAnalysis') {
56 | when {
57 | expression {
58 | GIT_BRANCH ==~ /.*master|.*feature\/.*|.*develop|.*hotfix\/.*|.*release\/.*/
59 | }
60 | }
61 | steps {
62 | script {
63 | scannerHome = tool name: 'sonar-scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
64 | }
65 | withSonarQubeEnv('sonarqube.io') {
66 | sh "${scannerHome}/bin/sonar-scanner -Dsonar.branch.name=${GIT_BRANCH} -Dsonar.projectKey=varunpalekar_php-test -Dsonar.organization=varunpalekar-github"
67 | }
68 | }
69 | }
70 | stage('DockerPush') {
71 | when {
72 | expression {
73 | GIT_BRANCH ==~ /.*master|.*release\/.*|.*develop|.*hotfix\/.*/
74 | }
75 | }
76 | steps {
77 | script{
78 | docker.withRegistry('', 'public-docker-hub') {
79 |
80 | def customImage = docker.build("${env.DOCKER_REGISTRY}:${env.DOCKER_TAG}")
81 | customImage.push()
82 |
83 | if ( GIT_BRANCH ==~ /.*master|.*hotfix\/.*|.*release\/.*/ )
84 | customImage.push('latest')
85 | }
86 | }
87 | }
88 | }
89 | stage('Deploy_Dev') {
90 | when {
91 | expression {
92 | GIT_BRANCH ==~ /.*develop/
93 | }
94 | }
95 | steps {
96 | script{
97 | echo "Deploy application on developmment environment"
98 | dir("ansible") {
99 | ansiblePlaybook installation: 'ansible', inventory: 'hosts-dev', playbook: 'playbook.yml', extraVars: [
100 | deployment_app_image: "${env.DOCKER_REGISTRY}:${env.DOCKER_TAG}"
101 | ]
102 | }
103 | }
104 |
105 | input message: "Do you want to run migration?"
106 |
107 | script{
108 | echo "Deploy application on developmment environment"
109 | dir("ansible") {
110 | ansiblePlaybook installation: 'ansible', inventory: 'hosts-dev', playbook: 'playbook.yml', tags: 'migration'
111 | }
112 | }
113 |
114 | input message: "Do you want to run seeding?"
115 |
116 | script{
117 | echo "Deploy application on developmment environment"
118 | dir("ansible") {
119 | ansiblePlaybook installation: 'ansible', inventory: 'hosts-dev', playbook: 'playbook.yml', tags: 'seeding'
120 | }
121 | }
122 | }
123 | }
124 |
125 | stage('Undeploy_Dev'){
126 | when {
127 | expression {
128 | GIT_BRANCH ==~ /.*develop/
129 | }
130 | }
131 | // timeout(time:5, unit:'DAYS') {
132 | // input message:'Approve deployment?', submitter: 'it-ops'
133 | // }
134 | steps {
135 | input message: "Do you want to undeploy DEV?"
136 | script {
137 | echo "Undeploy application on developmment environment"
138 | dir("ansible") {
139 | ansiblePlaybook installation: 'ansible', inventory: 'hosts-dev', playbook: 'playbook.yml', tags: 'undeploy'
140 | }
141 | }
142 | }
143 | }
144 | stage('Deploy_Prod') {
145 | when {
146 | expression {
147 | GIT_BRANCH ==~ /.*master|.*release\/.*|.*hotfix\/.*/
148 | }
149 | }
150 | steps {
151 | input message: "Do you want to proceed for production deployment?"
152 | script{
153 | echo "Deploy application on stage environment"
154 | dir("ansible") {
155 | ansiblePlaybook installation: 'ansible', inventory: 'hosts-prod', playbook: 'playbook.yml', credentialsId: 'ansible-hospice-prod'
156 | }
157 | }
158 |
159 | input message: "Do you want to proceed for production migration?"
160 | script{
161 | echo "Deploy application on stage environment"
162 | dir("ansible") {
163 | ansiblePlaybook installation: 'ansible', inventory: 'hosts-prod', playbook: 'playbook.yml', tags: 'migration', credentialsId: 'ansible-hospice-prod'
164 | }
165 | }
166 | }
167 | }
168 |
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/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' => 'http://localhost/laravel_blog/public/',
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 | 'log' => env('APP_LOG', 'single'),
112 |
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 | Collective\Html\HtmlServiceProvider::class,
151 | Mews\Purifier\PurifierServiceProvider::class,
152 |
153 | /*
154 | * Application Service Providers...
155 | */
156 | App\Providers\AppServiceProvider::class,
157 | App\Providers\AuthServiceProvider::class,
158 | App\Providers\EventServiceProvider::class,
159 | App\Providers\RouteServiceProvider::class,
160 |
161 | Intervention\Image\ImageServiceProvider::class,
162 |
163 | // Opencensus
164 | App\Providers\OpenCensusProvider::class,
165 |
166 | ],
167 |
168 | /*
169 | |--------------------------------------------------------------------------
170 | | Class Aliases
171 | |--------------------------------------------------------------------------
172 | |
173 | | This array of class aliases will be registered when this application
174 | | is started. However, feel free to register as many as you wish as
175 | | the aliases are "lazy" loaded so they don't hinder performance.
176 | |
177 | */
178 |
179 | 'aliases' => [
180 |
181 | 'App' => Illuminate\Support\Facades\App::class,
182 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
183 | 'Auth' => Illuminate\Support\Facades\Auth::class,
184 | 'Blade' => Illuminate\Support\Facades\Blade::class,
185 | 'Cache' => Illuminate\Support\Facades\Cache::class,
186 | 'Config' => Illuminate\Support\Facades\Config::class,
187 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
188 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
189 | 'DB' => Illuminate\Support\Facades\DB::class,
190 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
191 | 'Event' => Illuminate\Support\Facades\Event::class,
192 | 'File' => Illuminate\Support\Facades\File::class,
193 | 'Gate' => Illuminate\Support\Facades\Gate::class,
194 | 'Hash' => Illuminate\Support\Facades\Hash::class,
195 | 'Lang' => Illuminate\Support\Facades\Lang::class,
196 | 'Log' => Illuminate\Support\Facades\Log::class,
197 | 'Mail' => Illuminate\Support\Facades\Mail::class,
198 | 'Password' => Illuminate\Support\Facades\Password::class,
199 | 'Queue' => Illuminate\Support\Facades\Queue::class,
200 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
201 | 'Redis' => Illuminate\Support\Facades\Redis::class,
202 | 'Request' => Illuminate\Support\Facades\Request::class,
203 | 'Response' => Illuminate\Support\Facades\Response::class,
204 | 'Route' => Illuminate\Support\Facades\Route::class,
205 | 'Schema' => Illuminate\Support\Facades\Schema::class,
206 | 'Session' => Illuminate\Support\Facades\Session::class,
207 | 'Storage' => Illuminate\Support\Facades\Storage::class,
208 | 'URL' => Illuminate\Support\Facades\URL::class,
209 | 'Validator' => Illuminate\Support\Facades\Validator::class,
210 | 'View' => Illuminate\Support\Facades\View::class,
211 | 'Form' => Collective\Html\FormFacade::class,
212 | 'Html' => Collective\Html\HtmlFacade::class,
213 | 'Purifier' => Mews\Purifier\Facades\Purifier::class,
214 | 'Image' => Intervention\Image\Facades\Image::class
215 | ],
216 |
217 | ];
218 |
--------------------------------------------------------------------------------
/public/css/select2.min.css:
--------------------------------------------------------------------------------
1 | .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
2 |
--------------------------------------------------------------------------------
{{ $comment->name }}
29 |{{ date('F dS, Y - g:iA' ,strtotime($comment->created_at)) }}
30 |