Laravel Views

Blade Templates:

https://laravel.com/docs/5.4/blade

Installing bootstrap:

  • Use composer require twbs/bootstrap
  • php artisan make:provider BootstrapServiceProvider  to create a service provider
  • Add the following publishing code to the boot method
    • public function boot()
      
       {
      
       $this->publishes([__DIR__.'/../../vendor/twbs/bootstrap/dist' => public_path('vendor/bootstrap')], 'public');
      
       }
  • register bootstrap service provider in config/app.php
    • App\Providers\BootstrapServiceProvider::class in the list of service providers
  • Run php artisan vendor:publish –tag=public –force to publish bootstrap to the public folder
  • To automate this add php artisan vendor:publish –tag=public –force to post-install-cmd and post-update-cmd section of composer.json
    • "scripts": {
      
       "post-install-cmd": [
      
       "Illuminate\\Foundation\\ComposerScripts::postInstall",
      
       "php artisan optimize"
      
       "php artisan vendor:publish --tag=public --force"
      
       ],
      
       "post-update-cmd": [
      
       "Illuminate\\Foundation\\ComposerScripts::postUpdate",
      
       "php artisan optimize"
      
       "php artisan vendor:publish --tag=public --force"
      
       ]
      
       },
  • HTML Helpers
    • Run composer require “laracollective/html”
    • Add Collective\Html\HtmlServiceProvider::class  to the list of providers in config/app.php
    • Add ‘Html’ => Collective\Html\HtmlFacade::class  in the list of aliases
    • Usage:
      • Creating bootstrap file link:
        • {{ Html::style(‘vendor/bootstrap/css/bootstrap.min.css’) }}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s