{"id":8616,"date":"2021-12-05T17:31:32","date_gmt":"2021-12-05T16:31:32","guid":{"rendered":"https:\/\/via-internet.de\/blog\/?p=8616"},"modified":"2022-05-29T17:52:46","modified_gmt":"2022-05-29T15:52:46","slug":"laravel-tipps-und-tricks-bootstrap-verwenden","status":"publish","type":"post","link":"https:\/\/via-internet.de\/blog\/2021\/12\/05\/laravel-tipps-und-tricks-bootstrap-verwenden\/","title":{"rendered":"Laravel | Tipps und Tricks | Bootstrap verwenden"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Create and Prepare your Laravel Project<\/strong><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Create Laravel App<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installing a fresh Laravel project by running the following steps:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">Create a new app<\/td><td class=\"has-text-align-left\" data-align=\"left\"><code>laravel new --stack livewire --jet --teams app<\/code><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">In the file <code>.env<\/code> and change DB Connection to sqlite<\/td><td class=\"has-text-align-left\" data-align=\"left\"><code>DB_CONNECTION=sqlite<\/code><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Create an empty file <code>database\/database.sqlite<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\"><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Start DB Migration<\/td><td class=\"has-text-align-left\" data-align=\"left\"><code>php artisan migrate<\/code><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Start Laravel<\/td><td class=\"has-text-align-left\" data-align=\"left\"><code>php artisan serve<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Create Page for Bootstrap Demo<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a file <code> resources\/views\/using-bootstrap.blade.php<\/code> with the following content:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html lang=\"{{ str_replace('_', '-', app()->getLocale()) }}\">\n\n&lt;head>\n    &lt;meta charset=\"utf-8\">\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n    &lt;title>Laravel: Using Bootstrap from Local&lt;\/title>\n&lt;\/head>\n\n&lt;body class=\"antialiased\">\n   &lt;main>\n      &lt;div class=\"container py-4\">\n         &lt;header class=\"pb-3 mb-4 border-bottom\">\n            &lt;a href=\"\/\" \n               class=\"d-flex align-items-center text-dark text-decoration-none\">\n               &lt;title>Bootstrap&lt;\/title>\n               &lt;span class=\"fs-4\">Bootstrap example&lt;\/span>\n            &lt;\/a>\n         &lt;\/header>\n\n         &lt;div class=\"p-5 mb-4 bg-light rounded-3\">\n            &lt;div class=\"container-fluid py-5\">\n               &lt;h1 class=\"display-5 fw-bold\">\n                  Using Bootstrap in Laravel Projects\n               &lt;\/h1>\n               &lt;p class=\"col-md-8 fs-4\">\n                  It's very easy to add the Bootstrap Framework \n                  to your Laravel Project.\n               &lt;\/p>\n               &lt;button class=\"btn btn-primary btn-lg\" type=\"button\">\n                  See how...\n               &lt;\/button>\n            &lt;\/div>\n         &lt;\/div>\n      &lt;\/div>\n   &lt;\/main>\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the link<code> \/using-bootstrap<\/code> to your App by adding this to<code> route\/web.php<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Route::get('\/', function () {\n    return view('welcome');\n});\n\nRoute::get('\/using-bootstrap', function () {\n    return view('using-bootstrap');\n});<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you open <a href=\"http:\/\/127.0.0.1:8000\/using-bootstrap\">http:\/\/127.0.0.1:8000\/using-bootstrap<\/a> in the Browser, you the demo page but with no bootstrap styling.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"952\" height=\"227\" src=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step1-without-bootstrap.png\" alt=\"\" class=\"wp-image-8964\" srcset=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step1-without-bootstrap.png 952w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step1-without-bootstrap-300x72.png 300w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step1-without-bootstrap-768x183.png 768w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-2-adding-bootstrap-cdn\"><strong>Adding Bootstrap to your Project<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You have three possibilities to add Bootstrap into your Larval Project<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Methode 1: Adding Bootstrap by a Link to CDN<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Using CDN (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Content_delivery_network\" data-type=\"URL\" data-id=\"https:\/\/en.wikipedia.org\/wiki\/Content_delivery_network\" target=\"_blank\" rel=\"noreferrer noopener\">Content delivery network<\/a>) is quite easy and simple for beginners. CDN is a network of servers providing the source files for almost every library used in front-end development.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We need the references for <code>bootstrap.min.css<\/code>&nbsp;and <code>bootstrap.bundle.min.js<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You add <a rel=\"noreferrer noopener\" href=\"https:\/\/getbootstrap.com\/docs\/5.0\/getting-started\/introduction\/\" target=\"_blank\">Bootstrap<\/a> by inserting the following code snippets in your main Laravel Page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will use the file <code><a href=\"https:\/\/github.com\/r14r\/Laravel_Tutorial_Building-an-App-with-Bootstrap-Framework\/blob\/main\/app\/resources\/views\/using-bootstrap-step2-with-cdn.blade.php\" data-type=\"URL\" data-id=\"https:\/\/github.com\/r14r\/Laravel_Tutorial_Building-an-App-with-Bootstrap-Framework\/blob\/main\/app\/resources\/views\/using-bootstrap-step2-with-cdn.blade.php\" target=\"_blank\" rel=\"noreferrer noopener\">resources\/views\/using-bootstrap.blade.php<\/a><\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;link            \n    href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.1.3\/dist\/css\/bootstrap.min.css\"\n    rel=\"stylesheet\"\n    integrity=\"sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3\"\n    crossorigin=\"anonymous\"\n><\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;script  src=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.1.3\/dist\/js\/bootstrap.bundle.min.js\"\n    integrity=\"sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p\"\n    crossorigin=\"anonymous\">\n&lt;\/script><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The final file looks like <a href=\"https:\/\/github.com\/r14r\/Laravel_Tutorial_Building-an-App-with-Bootstrap-Framework\/blob\/main\/app\/resources\/views\/using-bootstrap-step2-with-cdn.blade.php\" data-type=\"URL\" data-id=\"https:\/\/github.com\/r14r\/Laravel_Tutorial_Building-an-App-with-Bootstrap-Framework\/blob\/main\/app\/resources\/views\/using-bootstrap-step2-with-cdn.blade.php\" target=\"_blank\" rel=\"noreferrer noopener\">this<\/a>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n    &lt;title>Boostrap 5&lt;\/title>\n    &lt;link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.0.1\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x\" crossorigin=\"anonymous\">\n&lt;\/head>\n&lt;body>\n    &lt;div class=\"container\">\n        &lt;div class=\"alert alert-success mt-5\" role=\"alert\">\n            Boostrap 5 is working!\n        &lt;\/div>    \n    &lt;\/div>\n    &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.0.1\/dist\/js\/bootstrap.bundle.min.js\" integrity=\"sha384-gtEjrD\/SeCtmISkJkNUaaKMoLD0\/\/ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4\" crossorigin=\"anonymous\">&lt;\/script>\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-2-adding-bootstrap-public-folder\">Methode 2: Adding Bootstrap Public Folder<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a rel=\"noreferrer noopener\" href=\"https:\/\/getbootstrap.com\/docs\/5.0\/getting-started\/download\/\" target=\"_blank\">Download<\/a>&nbsp;Bootstrap 5 file and put the files into the folder <code>app\/public\/assets\/vendor\/bootstrap\/5.2.0<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/folder-structure-bootstrap-dist.png\" alt=\"\" class=\"wp-image-8957\" width=\"396\" height=\"472\" srcset=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/folder-structure-bootstrap-dist.png 528w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/folder-structure-bootstrap-dist-252x300.png 252w\" sizes=\"auto, (max-width: 396px) 100vw, 396px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following code snippets to your Laravel Page:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;link href=\"{{ asset('assets\/vendor\/bootstrap\/5.2.0\/css\/bootstrap.min.css') }}\" rel=\"stylesheet\"><\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;script src=\"{{ asset('assets\/vendor\/bootstrap\/5.2.0\/js\/bootstrap.min.js') }}\">&lt;\/script><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The final files look like <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/r14r\/Laravel_Tutorial_Building-an-App-with-Bootstrap-Framework\/blob\/main\/app\/resources\/views\/using-bootstrap-step2-with-local-files.blade.php\" target=\"_blank\">this<\/a>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"8,16\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n    &lt;title>Boostrap 5&lt;\/title>\n    &lt;link rel=\"stylesheet\" href={{ asset('css\/bootstrap.min.css') }}>\n&lt;\/head>\n&lt;body>\n    &lt;div class=\"container\">\n        &lt;div class=\"alert alert-success mt-5\" role=\"alert\">\n            Boostrap 5 is working!\n        &lt;\/div>    \n    &lt;\/div>\n    &lt;script src=\"{{ asset('js\/bootstrap.min.js') }}\">&lt;\/script>\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-3-adding-bootstrap-5-using-laravel-mix\">Methode 3: Adding Bootstrap 5 using Laravel Mix<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In Laravel, all Frontend Modules are handles with <a rel=\"noreferrer noopener\" href=\"https:\/\/laravel-mix.com\/\" data-type=\"URL\" data-id=\"https:\/\/laravel-mix.com\/\" target=\"_blank\">Laravel Mix<\/a>. This is an elegant wrapper around Webpack, a Package manager for installing and managing node modules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To use Mix, you need to install NodeJS and NPM.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After this, install all required modules of your starter project<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">npm install<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you can see node_modules folder, this means npm is working.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now we need to install bootstrap  and the required modules<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">npm install bootstrap --save-dev \nnpm install @popperjs\/core --save-dev<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You will find the new packages in <code>package.json<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"2,7\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    \"devDependencies\": {\n        \"@popperjs\/core\": \"^2.11.5\",\n        \"@tailwindcss\/forms\": \"^0.4.0\",\n        \"@tailwindcss\/typography\": \"^0.5.0\",\n        \"alpinejs\": \"^3.0.6\",\n        \"axios\": \"^0.25\",\n        \"bootstrap\": \"^5.1.3\",\n        \"laravel-mix\": \"^6.0.6\",\n        \"lodash\": \"^4.17.19\",\n        \"postcss\": \"^8.1.14\",\n        \"postcss-import\": \"^14.0.1\",\n        \"tailwindcss\": \"^3.0.0\"\n    }<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, add the following line to <code>resources\/css\/app.css<\/code><strong>:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@import \"bootstrap\";<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following line to the file <code>resources\/js\/bootstrap.js<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"2\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">window._ = require(\"lodash\");\nimport \"bootstrap\";<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command to build the frontend files (css and js)<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">npm run development<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/larainfo.com\/storage\/canvas\/images\/NG65RVBVYtNoqBFuC30nmwRGrSmL0CJrE7gNvrWH.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You done. See the result here: <a href=\"http:\/\/127.0.0.1:8000\/using-bootstrap\" data-type=\"URL\" data-id=\"http:\/\/127.0.0.1:8000\/using-bootstrap\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/127.0.0.1:8000\/using-bootstrap<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"504\" src=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step3-result-1024x504.png\" alt=\"\" class=\"wp-image-8979\" srcset=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step3-result-1024x504.png 1024w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step3-result-300x148.png 300w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step3-result-768x378.png 768w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-step3-result.png 1228w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Using Bootstrap <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">With the Bootstrap Framework installed, now we can style our Pages. An overview of what you can do could be found in the <a href=\"https:\/\/getbootstrap.com\/docs\/5.2\/getting-started\/introduction\/\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Documentation <\/a>or using the <a href=\"https:\/\/github.com\/twbs\/bootstrap\/releases\/download\/v5.2.0-beta1\/bootstrap-5.2.0-beta1-examples.zip\" target=\"_blank\" aria-label=\"Examples (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Examples<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will work with the Examples, so download all examples to the folder <code>resources\/views\/bootstrap<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With the Commandline and PowerShell, you could do this: Change to the folder and download the Archive with the examples<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u276f Set-Location resources\\views\n\u276f Invoke-WebRequest https:\/\/github.com\/twbs\/bootstrap\/releases\/download\/v5.2.0-beta1\/bootstrap-5.2.0-beta1-examples.zip -O bootstrap.zip<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Extract the archive, don&#8217;t forget the trailing dot <strong> &#8216;.&#8217;<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u276f Expand-Archive .\\bootstrap.zip .<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Rename the created folder<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u276f Rename-Item .\\bootstrap-5.2.0-beta1-examples\\ bootstrap<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u276f Remove-Item bootstrap.zip<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, we have all examples in the folder <code>resources\/views\/bootstrap<\/code> and we are ready to play with them:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"495\" src=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-examples-folder-1024x495.png\" alt=\"\" class=\"wp-image-8990\" srcset=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-examples-folder-1024x495.png 1024w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-examples-folder-300x145.png 300w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-examples-folder-768x372.png 768w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/building-laravel-app-with-bootstrap-examples-folder.png 1445w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Modify the album example to use with Laravel<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Modify the <code>\/using-bootstrap<\/code> (<code>resources\/views\/using-bootstrap.blade.php<\/code>) page<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Add a sample text and a link to out Album Page<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"6-10\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;div class=\"p-5 mb-4 bg-light rounded-3\">\n    &lt;div class=\"container-fluid py-5\">\n    ... Keep the original content\n    &lt;\/div>\n\n    &lt;div class=\"container-fluid py-5\">\n        &lt;p class=\"col-md-8 fs-4\">\n            Just start with an &lt;a href=\"bootstrap\/album\">example&lt;\/a>\n        &lt;\/p>\n    &lt;\/div>\n&lt;\/div><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Modify <code>routes\/web.php<\/code> to include a link to \/bootstrap\/album<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following lines to <code>route\/web.php<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\nRoute::get('\/bootstrap\/album', function () {\n    return view('bootstrap\/album');\n});<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Modify the Album Page<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Rename and move the file <code>resources\/views\/bootstrap\/album\/index.html<\/code> to <code>resources\/views\/bootstrap\/album.blade.php<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Please note<\/strong>: We also changed the folder of the file. All examples&#8217; files will be placed directly under the folder <code>resources\/views\/bootstrap<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can do this for all files with the following PowerShell Script:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Get-ChildItem . index.html -recurse                        | `\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Addon: <a href=\"https:\/\/github.com\/r14r\/Laravel_Tutorial_Building-an-App-with-Bootstrap-Framework\/blob\/main\/app\/resources\/views\/bootstrap\/rename_examples_files.ps1\" class=\"ek-link\">Script <\/a>to modify all examples files<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Remove-Item _web.php\n\nRemove-Item _links.php\nAdd-Content _links.php \"&lt;div class='list-group w-auto'>\"\n\nfunction Add-Link($header, $link) {\n\nAdd-Content _links.php ('&lt;a href=\"' + $link + '\" class=\"list-group-item list-group-item-action d-flex gap-3 py-3\" aria-current=\"true\">')\nAdd-Content _links.php '&lt;img src=\"https:\/\/github.com\/twbs.png\" alt=\"twbs\" width=\"32\" height=\"32\" class=\"rounded-circle flex-shrink-0\">'\nAdd-Content _links.php '&lt;div class=\"d-flex gap-2 w-100 justify-content-between\">'\nAdd-Content _links.php ('&lt;div>&lt;h6 class=\"mb-0\">' + $header + '&lt;\/h6>&lt;\/div>')\nAdd-Content _links.php '&lt;p class=\"mb-0 opacity-75\">Another examples>&lt;\/p>'\nAdd-Content _links.php '&lt;\/div>'\nAdd-Content _links.php '&lt;small class=\"opacity-50 text-nowrap\">&amp;nbsp;&lt;\/small>'\nAdd-Content _links.php '&lt;\/a>'\n\n}\n\n $LINK_OLD_JS=\"..\/assets\/dist\/js\/bootstrap.bundle.min.js\"\n$LINK_OLD_CSS=\"..\/assets\/dist\/css\/bootstrap.min.css\"\n \n $LINK_NEW_JS=\"{{ asset('js\/app.js')   }}\"\n$LINK_NEW_CSS=\"{{ asset('css\/app.css') }}\"\n\n\nGet-ChildItem . index.html -recurse                        `\n| \n| \n    (Get-Content $_\\index.html)         `\n    | \n    | \n    | Set-Content  $_\".blade.php\"\n\n    Add-Content _web.php \"Route::get('\/bootstrap\/$_', function () { return view('bootstrap\/$_'); });\"\n\n    Write-Host \"Add links to example $_\"\n    Add-Link $_ \"bootstrap\/$_\"\n}\n\nAdd-Content _links.php \"&lt;\/div>\"<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Errors and Problems<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Build Modules with <code>npm run dev<\/code> shows up a warning<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"158\" src=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-1024x158.png\" alt=\"\" class=\"wp-image-8955\" srcset=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-1024x158.png 1024w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-300x46.png 300w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-768x119.png 768w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations.png 1449w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To see more information about the warning, add the following to the file webpack.mix.js after the first <code>mix.js( ...<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mix.webpackConfig({\n    stats: {\n        children: true,\n    },\n});<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then, run<code> npm run dev<\/code> again.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"441\" src=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-detailes-1024x441.png\" alt=\"\" class=\"wp-image-8956\" srcset=\"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-detailes-1024x441.png 1024w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-detailes-300x129.png 300w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-detailes-768x331.png 768w, https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/warning-child-compilations-detailes.png 1466w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Create and Prepare your Laravel Project Create Laravel App Installing a fresh Laravel project by running the following steps: Create a new app laravel new &#8211;stack livewire &#8211;jet &#8211;teams app In the file .env and change DB Connection to sqlite DB_CONNECTION=sqlite Create an empty file database\/database.sqlite Start DB Migration php artisan migrate Start Laravel php artisan serve Create Page for Bootstrap Demo Create a file resources\/views\/using-bootstrap.blade.php with the following content: Add the link \/using-bootstrap to your App by adding this to route\/web.php If you open http:\/\/127.0.0.1:8000\/using-bootstrap in the Browser, you the demo page but with no bootstrap styling. Adding Bootstrap to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7765,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[99,57],"tags":[],"class_list":["post-8616","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-php"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/8616","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/comments?post=8616"}],"version-history":[{"count":33,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/8616\/revisions"}],"predecessor-version":[{"id":9001,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/8616\/revisions\/9001"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/media?parent=8616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/categories?post=8616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/tags?post=8616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}