Laravel 5.5 : include css , js and image for boostrap theme .

Put your assets in the public folder

public/css
public/images
public/fonts
public/js

And then called it using Laravel

 

{{ URL::asset('js/scrollTo.js'); }} // Generates the path to public directory public/js/scrollTo.js

{{ URL::asset('css/css.css'); }}   // Generates the  path to public directory public/css/css.css
{{ URL::asset('image/one.png'); }} //Generates the  path to public directory public/image/one.png

or
{{ HTML::script('js/scrollTo.js'); }} // Generates the  path to public directory public/js/scrollTo.js

{{ HTML::style('css/css.css'); }} // Generates the path to public directory public/css/css.css
 {{ HTML::style('image/one.png'); }} //Generates the  path to public directory public/image/one.png

Laravel – Please provide a valid cache path

In laravel sometime cache not valid problem shows . What’s the reason ? Reason is there had no cache path in the storage directory . To solve this problem , try this :

create these folders under storage/framework:

  • sessions
  • views
  • cache

Now its worked! More 

 

 

 

 

Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255

In laravel there may be shown the following error when working with bellow laravel 5.3 projects . Cause composer structure has been changed .

 

So how to solve it : Its easy way to just replace the code in composer.php (Only bold sections) :

 

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.4.*",
        "laravel/tinker": "~1.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.7"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}

 

 

How to install and fix all errors after clone laravel project from github ?

Installation

Follow the instructions below to install the project
Clone the repository using git clone

composer install
npm install
Create .env by copying the env.example file
php artisan key:generate
php artisan migrate
Set administrator info in UserTableSeeder.php // Optional
php artisan db:seed
run gulp or gulp watch (Install gulp (sudo npm install -g gulp) if needed) // optional









Print page and specific section with JavaScript

Whole Page : 

 If we want to print complete to print . we can do it with JavaScript Print() mehtod.

 

<!DOCTYPE html>
<html>
<body>

<p>Click the button to print the current page.</p>

<button onclick="myFunction()">Print this page</button>

<script>
function myFunction() {
 window.print();
}
</script>

</body>
</html>



 

 

Print Specific portion :

If we want to print specific portion then we need to implement some more works . Here’s are that .

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title></title>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

    <script type="text/javascript">

        $("#btnPrint").live("click", function () {

            var divContents = $("#dvContainer").html();

            var printWindow = window.open('', '', 'height=400,width=800');

            printWindow.document.write('<html><head><title>DIV Contents</title>');

            printWindow.document.write('</head><body >');

            printWindow.document.write(divContents);

            printWindow.document.write('</body></html>');

            printWindow.document.close();

            printWindow.print();

        });

    </script>

</head>

<body>

    <form id="form1">

    <div id="dvContainer">

        This content needs to be printed.

    </div>

    <input type="button" value="Print Div Contents" id="btnPrint" />

    </form>

</body>

</html>