├── .gitattributes ├── .laravel-7x-8x └── README.md ├── LICENSE ├── README.md └── resources └── js ├── Pages ├── Auth │ ├── Login.vue │ └── Register.vue ├── HomeExample.vue └── Welcome.vue └── app.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.laravel-7x-8x/README.md: -------------------------------------------------------------------------------- 1 | ## Laravel 7.x & 8.x 2 | 3 | To install, please follow these steps. **Note:** We assume you start with a fresh Laravel project. 4 | 5 | - `cd` to project directory 6 | - Laravel 7.x `composer require vikdiesel/admin-one-laravel-dashboard:1.3.x --dev` 7 | - Laravel 8.x `composer require vikdiesel/admin-one-laravel-dashboard:1.5.x --dev` 8 | - `composer require laravel/ui` 9 | - `php artisan ui:controllers` 10 | - `php artisan ui:auth` 11 | - `php artisan jb:admin-one-preset` 12 | - `npm install` 13 | - `npm run dev` or `npm run prod` 14 | - `php artisan migrate` 15 | - `php artisan db:seed` 16 | 17 | ## Laravel 9.x 18 | 19 | Please follow [guide for Laravel 9.x Jetstream Inertia Vue](https://github.com/vikdiesel/admin-one-laravel-dashboard). -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2022 JustBoil.me (https://justboil.me) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Free Laravel 9.x Vue.js 2.x Buefy Bulma Dashboard 2 | 3 | 4 | 5 | This guide will help you integrate your **Laravel Jetstream** application with [vikdiesel/admin-one-vue-bulma-dashboard](https://github.com/vikdiesel/admin-one-vue-bulma-dashboard) Vue Bulma Buefy dashboard. 6 | 7 | **Please note:** this document is work in progress, so [some things are missing](#work-in-progress). 8 | 9 | Simple, beautiful and free **Vue.js 2.x** **Bulma** **Buefy** admin dashboard for **Laravel 9.x Jetstream Inertia + Vue** stack 10 | 11 | * Built with **Vue.js 2.x** **Bulma** and **Buefy** 12 | * **Laravel 9.x Jetstream Inertia + Vue** stack 13 | * Laravel Mix 14 | * Classic **Options API** using `data`, `computed`, `methods`, etc. 15 | * SPA with **Vuex** & **Inertia Router** 16 | * **Styled** scrollbars 17 | * **SCSS sources** with variables 18 | * Reusable components 19 | * Responsive 20 | * Free under MIT License 21 | * [Premium versions](https://justboil.me/bulma-admin-template/) available 22 | 23 | ## Table of contents 24 | 25 | * [Install](#install) 26 | * [Copy styles, components and scripts](#copy-styles-components-and-scripts) 27 | * [Add pages](#add-pages) 28 | * [Fix router links](#fix-router-links) 29 | * [Add Inertia-related stuff](#add-inertia-related-stuff) 30 | * [Work in progress](#work-in-progress) 31 | * [Laravel 7.x & 8.x](#laravel-7x--8x) 32 | 33 | ## Install 34 | 35 | * [Install Laravel](https://laravel.com/docs/installation) application 36 | * [Install Jetstream](https://jetstream.laravel.com/2.x/installation.html) with Inertia + Vue stack 37 | * `cd` to project dir 38 | * Move `resources/js` folder to `resources-temp/js`. These js files will serve as a reference during development process (just in case, you'll ever need to extract some logic, that is missing here) 39 | * run `npm remove @inertiajs/inertia-vue3 @vue/compiler-sfc @tailwindcss/forms @tailwindcss/typography postcss postcss-import tailwindcss` 40 | * run `npm i vuex@^3 vue@^2 vue-loader@^15 @vue/composition-api @inertiajs/inertia-vue bulma buefy chart.js vue-chartjs numeral sass sass-loader -D` 41 | 42 | Replace `postCss()` with `sass()` and `app.scss` with `main.scss` in `webpack.mix.js`: 43 | 44 | ```javascript 45 | mix.js('resources/js/app.js', 'public/js').vue() 46 | .sass('resources/scss/main.scss', 'public/css') 47 | .alias({ 48 | '@': 'resources/js', 49 | }) 50 | ``` 51 | 52 | ## Copy styles, components and scripts 53 | 54 | Clone either [vikdiesel/admin-one-vue-bulma-dashboard](https://github.com/vikdiesel/admin-one-vue-bulma-dashboard) or [vikdiesel/admin-two-vue-bulma-dashboard](https://github.com/vikdiesel/admin-two-vue-bulma-dashboard) project locally into a separate folder 55 | 56 | Next, copy these files **from cloned dashboard project** directory **to laravel project** directory: 57 | 58 | * Copy `src/components` `src/store` `src/menu.js` to `resources/js/` 59 | * Copy `src/App.vue` and `src/FullPage.vue` to `resources/Layouts/` 60 | * Copy `src/css` and `src/scss` to `resources/` 61 | * Copy `src/assets/justboil-logo.svg` to `resources/js/images/` 62 | * Delete `resources/css/app.css` 63 | * Copy `resources` directory **from this repository** to **to laravel project** 64 | 65 | ##### In resources/views/app.blade.php 66 | 67 | Replace `app.css` with `main.css`: 68 | 69 | ```php 70 | 71 | 72 | ``` 73 | 74 | Add before ``: 75 | 76 | ```html 77 | 78 | ``` 79 | 80 | ##### In resources/layouts/App.vue & FullPage.vue 81 | 82 | Replace `` with `` 83 | 84 | ##### In resources/layouts/App.vue 85 | 86 | Add `this.$store.dispatch('toggleFullPage', false)` to `created()` lifecycle hook 87 | 88 | ##### In resources/layouts/FullPage.vue 89 | 90 | Add `this.$store.dispatch('toggleFullPage', true)` to `created()` lifecycle hook 91 | 92 | Remove `beforeDestroy()` lifecycle hook 93 | 94 | ##### In resources/layouts/Tiles.vue 95 | 96 | Add `import filter from 'lodash/filter'` 97 | 98 | Add `filter()` and replace `this.$slots.default` with `slots` in `render()` method, so you'll get: 99 | 100 | ```javascript 101 | render (createElement) { 102 | const renderAncestor = elements => createElement( 103 | // ... 104 | ) 105 | 106 | const slots = filter(this.$slots.default, slot => !!slot.tag) 107 | 108 | if (slots.length <= this.maxPerRow) { 109 | return renderAncestor(slots) 110 | } else { 111 | return createElement( 112 | 'div', 113 | { attrs: { class: 'is-tiles-wrapper' } }, 114 | chunk(slots, this.maxPerRow).map(group => { 115 | return renderAncestor(group) 116 | }) 117 | ) 118 | } 119 | } 120 | ``` 121 | 122 | ## Add Pages 123 | 124 | Let's just add first page. You can repeat these steps for other pages, if you wish to. If you've followed previous steps, there's already `resources/js/Pages/HomeExample.vue` for your reference. 125 | 126 | First, copy `src/views/Home.vue` (original dashboard project) to `resources/js/Pages/` (your Laravel project). 127 | 128 | Add `Head`. Then, wrap page contents into `App` Layout component: 129 | 130 | ```vue 131 | 138 | 153 | ``` 154 | 155 | Add route in `routes/web.php`. There's a `/dashboard` route already defined by default, so just replace `Inertia::render('Dashboard')` with `Inertia::render('Home')`: 156 | 157 | ```php 158 | Route::get('/dashboard', function () { 159 | return Inertia::render('Home'); 160 | })->name('dashboard'); 161 | ``` 162 | 163 | ## Fix router links 164 | 165 | Here we replace router-link with Inertia Link. 166 | 167 | ##### resources/js/menu.js 168 | 169 | Optionally, you can pass menu via Inertia shared props, so it's going to be controlled with PHP. Here we'd just use JS. 170 | 171 | `to` should be replaced with `route` which specifies route name defined in `routes/web.php`. For external links `href` should be used instead. Here's an example for `menu.js`: 172 | 173 | ```javascript 174 | export default [ 175 | 'General', 176 | [ 177 | { 178 | route: 'dashboard', 179 | icon: mdiDesktopMac, 180 | label: 'Dashboard' 181 | }, 182 | { 183 | href: 'https://example.com/', 184 | icon: mdiDesktopMac, 185 | label: 'Example.com' 186 | } 187 | ] 188 | ] 189 | ``` 190 | 191 | Route names reflect ones defined in `routes/web.php`: 192 | 193 | ```php 194 | Route::get('/dashboard', function () { 195 | return Inertia::render('Home'); 196 | })->name('dashboard'); 197 | ``` 198 | 199 | Now, let's update vue files, to make them work with route names and Inertia links. 200 | 201 | ##### resources/js/components/AsideMenuItem.vue 202 | 203 | Add `Link` import to ` 210 | ``` 211 | 212 | ##### resources/js/components/AsideMenuItem.vue 213 | 214 | Replace `componentIs` in `computed{}` with: 215 | 216 | ```vue 217 | 229 | ``` 230 | 231 | Replace `` attrs with: 232 | 233 | ```vue 234 | 245 | ``` 246 | 247 | ##### .vue files in resources/js/ containing 248 | 249 | Import and register `Link` component: 250 | 251 | ```vue 252 | 264 | ``` 265 | 266 | Replace `` with ``: 267 | 268 | ```vue 269 | 278 | ``` 279 | 280 | ##### resources/js/components/NavBar.vue 281 | 282 | Replace `this.$router` with `Inertia`: 283 | 284 | ```vue 285 | 299 | ``` 300 | 301 | ## Add Inertia-related stuff 302 | 303 | ##### resources/js/components/UserAvatar.vue 304 | 305 | Fix `newAvatar` computed property, so it fetches profile photo from backend: 306 | 307 | ```vue 308 | 318 | ``` 319 | 320 | ##### resources/js/components/NavBar.vue 321 | 322 | Update `userName` and `logout`: 323 | 324 | ```vue 325 | 348 | ``` 349 | 350 | ## Work in progress 351 | 352 | As mentioned, this guide is WIP - work in progress. Contributions open. Here's the list of what's missing right now: 353 | 354 | * Pages for resources/Pages/API 355 | * Pages for resources/Pages/Auth (except Login.vue and Register.vue) 356 | * Pages for resources/Pages/Profile 357 | * Unused default Jetstream files list 358 | 359 | ## Laravel 7.x & 8.x 360 | 361 | If you're using an older version of Laravel, please follow [Laravel 7.x & 8.x guide](https://github.com/vikdiesel/admin-one-laravel-dashboard/tree/master/.laravel-7x-8x). 362 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/Login.vue: -------------------------------------------------------------------------------- 1 | 79 | 80 | 116 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/Register.vue: -------------------------------------------------------------------------------- 1 | 85 | 86 | 115 | -------------------------------------------------------------------------------- /resources/js/Pages/HomeExample.vue: -------------------------------------------------------------------------------- 1 | 79 | 80 | 146 | -------------------------------------------------------------------------------- /resources/js/Pages/Welcome.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 75 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | // require('./bootstrap') 2 | 3 | import Vue from 'vue' 4 | import Buefy from 'buefy' 5 | import { createInertiaApp } from '@inertiajs/inertia-vue' 6 | import { InertiaProgress } from '@inertiajs/progress' 7 | import { Inertia } from '@inertiajs/inertia' 8 | import store from './store' 9 | 10 | Vue.prototype.$route = route 11 | 12 | const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel' 13 | 14 | createInertiaApp({ 15 | resolve: name => require(`./Pages/${name}`), 16 | setup({ el, App, props, plugin }) { 17 | Vue.use(plugin) 18 | Vue.use(Buefy) 19 | 20 | new Vue({ 21 | store, 22 | render: h => h(App, props), 23 | }).$mount(el) 24 | }, 25 | }) 26 | 27 | InertiaProgress.init({ color: '#4B5563' }) 28 | 29 | /* Collapse mobile aside menu on route change */ 30 | Inertia.on('navigate', (event) => { 31 | store.commit('asideMobileStateToggle', false) 32 | store.dispatch('asideDesktopOnlyToggle', false) 33 | }) 34 | --------------------------------------------------------------------------------