Version {{ app()->version() }}
107 |├── .gitignore ├── README.md ├── composer.json └── src ├── Bootstrap4Preset.php ├── Bootstrap4PresetServiceProvider.php └── bootstrap4-stubs ├── Controllers └── HomeController.php ├── _custom.scss ├── app.scss ├── bootstrap.js ├── views ├── auth │ ├── login.blade.php │ ├── passwords │ │ ├── email.blade.php │ │ └── reset.blade.php │ └── register.blade.php ├── home.blade.php ├── layouts │ └── app.blade.php └── welcome.blade.php └── webpack.mix.js /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.phar 3 | composer.lock 4 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel 5.5.x Front-end Preset For Bootstrap 4 2 | 3 | Preset for Bootstrap 4 scaffolding on new Laravel 5.5.x project. 4 | 5 | *Current version*: **Bootstrap 4 beta** 6 | 7 | ## Usage 8 | 1. Fresh install Laravel 5.5.x and `cd` to your app. 9 | 2. Install this preset via `composer require laravel-frontend-presets/bootstrap-4`. Laravel 5.5.x will automatically discover this package. No need to register the service provider. 10 | 3. Use `php artisan preset bootstrap4` for basic Bootstrap 4 preset. **OR** Use `php artisan preset bootstrap4-auth` for basic preset, Auth route entry and Bootstrap 4 Auth views in one go. (**NOTE**: If you run this command several times, be sure to clean up the duplicate Auth entries in `routes/web.php`) 11 | 4. `npm install` 12 | 5. `npm run dev` 13 | 6. Configure your favorite database (mysql, sqlite etc.) 14 | 7. `php artisan migrate` to create basic user tables. 15 | 8. `php artisan serve` (or equivalent) to run server and test preset. 16 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel-frontend-presets/bootstrap-4", 3 | "description": "Laravel 5.5.x Front-end preset for Bootstrap 4", 4 | "keywords": ["laravel", "preset", "bootstrap 4", "scaffolding"], 5 | "license": "MIT", 6 | "require": { 7 | "laravel/framework": "5.5.*" 8 | }, 9 | "autoload": { 10 | "psr-4": { 11 | "LaravelFrontendPresets\\Bootstrap4Preset\\": "src/" 12 | } 13 | }, 14 | "extra": { 15 | "laravel": { 16 | "providers": [ 17 | "LaravelFrontendPresets\\Bootstrap4Preset\\Bootstrap4PresetServiceProvider" 18 | ] 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/Bootstrap4Preset.php: -------------------------------------------------------------------------------- 1 | '^4.0.0-beta', 45 | 'jquery' => '^3.2.1', 46 | 'tether' => '^1.4.0', 47 | 'popper.js' => '^1.12.4', 48 | 'precss' => '^2.0.0', 49 | ] + Arr::except($packages, ['foundation-sites', 'bootstrap-sass', 'bulma', 'uikit']); 50 | } 51 | 52 | /** 53 | * Update the Sass files for the application. 54 | * 55 | * @return void 56 | */ 57 | protected static function updateSass() 58 | { 59 | // clean up orphan files 60 | $orphan_sass_files = glob(resource_path('/assets/sass/*.*')); 61 | 62 | foreach($orphan_sass_files as $sass_file) 63 | { 64 | (new Filesystem)->delete($sass_file); 65 | } 66 | 67 | copy(__DIR__.'/bootstrap4-stubs/_custom.scss', resource_path('assets/sass/_custom.scss')); 68 | copy(__DIR__.'/bootstrap4-stubs/app.scss', resource_path('assets/sass/app.scss')); 69 | } 70 | 71 | /** 72 | * Update the bootstrapping files. 73 | * 74 | * @return void 75 | */ 76 | protected static function updateBootstrapping() 77 | { 78 | (new Filesystem)->delete( 79 | resource_path('assets/js/bootstrap.js') 80 | ); 81 | 82 | copy(__DIR__.'/bootstrap4-stubs/bootstrap.js', resource_path('assets/js/bootstrap.js')); 83 | } 84 | 85 | /** 86 | * Update the mix file. 87 | * 88 | * @return void 89 | */ 90 | protected static function updateMix() 91 | { 92 | (new Filesystem)->delete( 93 | base_path('webpack.mix.js') 94 | ); 95 | 96 | copy(__DIR__.'/bootstrap4-stubs/webpack.mix.js', base_path('webpack.mix.js')); 97 | } 98 | 99 | /** 100 | * Update the default welcome page file with Foundation buttons. 101 | * 102 | * @return void 103 | */ 104 | protected static function updateWelcomePage() 105 | { 106 | // remove default welcome page 107 | (new Filesystem)->delete( 108 | resource_path('views/welcome.blade.php') 109 | ); 110 | 111 | // copy new one with Bootstrap buttons 112 | copy(__DIR__.'/bootstrap4-stubs/views/welcome.blade.php', resource_path('views/welcome.blade.php')); 113 | } 114 | 115 | /** 116 | * Copy Bootstrap Auth view templates. 117 | * 118 | * @return void 119 | */ 120 | protected static function addAuthTemplates() 121 | { 122 | // Add Home controller 123 | copy(__DIR__.'/bootstrap4-stubs/Controllers/HomeController.php', app_path('Http/Controllers/HomeController.php')); 124 | 125 | // Add Auth route in 'routes/web.php' 126 | $auth_route_entry = "Auth::routes();\n\nRoute::get('/home', 'HomeController@index')->name('home');\n\n"; 127 | file_put_contents('./routes/web.php', $auth_route_entry, FILE_APPEND); 128 | 129 | // Copy Bootstrap4 Auth view templates 130 | (new Filesystem)->copyDirectory(__DIR__.'/bootstrap4-stubs/views', resource_path('views')); 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/Bootstrap4PresetServiceProvider.php: -------------------------------------------------------------------------------- 1 | info('Bootstrap 4 scaffolding installed successfully.'); 19 | $command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); 20 | }); 21 | 22 | PresetCommand::macro('bootstrap4-auth', function ($command) { 23 | Bootstrap4Preset::install(true); 24 | $command->info('Bootstrap 4 scaffolding with Auth views installed successfully.'); 25 | $command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/bootstrap4-stubs/Controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 17 | } 18 | 19 | /** 20 | * Show the application dashboard. 21 | * 22 | * @return \Illuminate\Http\Response 23 | */ 24 | public function index() 25 | { 26 | return view('home'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/bootstrap4-stubs/_custom.scss: -------------------------------------------------------------------------------- 1 | // Custom 2 | // 3 | // Override the Bootstrap defaults without modifying key, versioned files. 4 | -------------------------------------------------------------------------------- /src/bootstrap4-stubs/app.scss: -------------------------------------------------------------------------------- 1 | 2 | // Fonts 3 | @import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600); 4 | 5 | // Variables 6 | @import "custom"; 7 | 8 | // Bootstrap 9 | @import "node_modules/bootstrap/scss/bootstrap"; 10 | -------------------------------------------------------------------------------- /src/bootstrap4-stubs/bootstrap.js: -------------------------------------------------------------------------------- 1 | window._ = require('lodash'); 2 | import Popper from 'popper.js/dist/umd/popper.js'; 3 | 4 | /** 5 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 6 | * for JavaScript based Bootstrap features such as modals and tabs. This 7 | * code may be modified to fit the specific needs of your application. 8 | */ 9 | 10 | try { 11 | window.$ = window.jQuery = require('jquery'); 12 | window.Tether = require('tether'); 13 | window.Popper = Popper; 14 | require('bootstrap'); 15 | } catch (e) {} 16 | 17 | /** 18 | * We'll load the axios HTTP library which allows us to easily issue requests 19 | * to our Laravel back-end. This library automatically handles sending the 20 | * CSRF token as a header based on the value of the "XSRF" token cookie. 21 | */ 22 | 23 | window.axios = require('axios'); 24 | 25 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 26 | 27 | /** 28 | * Next we will register the CSRF Token as a common header with Axios so that 29 | * all outgoing HTTP requests automatically have it attached. This is just 30 | * a simple convenience so we don't have to attach every token manually. 31 | */ 32 | 33 | let token = document.head.querySelector('meta[name="csrf-token"]'); 34 | 35 | if (token) { 36 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; 37 | } else { 38 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); 39 | } 40 | 41 | /** 42 | * Echo exposes an expressive API for subscribing to channels and listening 43 | * for events that are broadcast by Laravel. Echo and event broadcasting 44 | * allows your team to easily build robust real-time web applications. 45 | */ 46 | 47 | // import Echo from 'laravel-echo' 48 | 49 | // window.Pusher = require('pusher-js'); 50 | 51 | // window.Echo = new Echo({ 52 | // broadcaster: 'pusher', 53 | // key: 'your-pusher-key' 54 | // }); 55 | -------------------------------------------------------------------------------- /src/bootstrap4-stubs/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 | 5 |
10 | You are logged in! 11 |
12 |Version {{ app()->version() }}
107 |