Skip to content

Commit 2577959

Browse files
committed
Add sidebar instruction to README
1 parent b08afc1 commit 2577959

File tree

1 file changed

+65
-11
lines changed

1 file changed

+65
-11
lines changed

README.md

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,76 @@ $ npm run dev
167167
## Usage
168168

169169
``` bash
170-
# start local server from laravel directory
170+
# start local server
171171
$ php artisan serve
172+
173+
# test
174+
$ php vendor/bin/phpunit
172175
```
173-
Open your browser and open adress: "localhost:8000"
174-
Choice "Notes" from top bar menu. Then login with credentials:
175176

176-
177-
* Password: password
177+
Open your browser with address: [localhost:8000](localhost:8000)
178+
Click "Notes" on topbar menu and log in with credentials:
178179

179-
This user has roles: 'user' and 'admin'
180-
* Role 'user' is required for notes management.
181-
* Role 'admin' is required for users management.
180+
* E-mail: _[email protected]_
181+
* Password: _password_
182182

183-
``` bash
184-
# testing from laravel directory
185-
$ php
183+
This user has roles: _user_ and _admin_
184+
* Role _user_ is required for **notes** management.
185+
* Role _admin_ is required for **users** management.
186+
187+
---
188+
189+
### How to add a link to the sidebar:
190+
191+
> Instructions for CoreUI Free Laravel admin template only. _Pro and Vue.js versions have separate instructions._
192+
193+
#### To add a __link__ to the sidebar - modify seeds file:
194+
`my-project/database/seeds/MenusTableSeeder.php`
195+
196+
In `run()` function - add `insertLink()`:
197+
```php
198+
$id = $this->insertLink( $rolesString, $visibleName, $href, $iconString);
199+
```
200+
* `$rolesString` - a string with list of user roles this menu element will be available, ex. `"guest,user,admin"`
201+
* `$visibleName` - a string caption visible in sidebar
202+
* `$href` - a href, ex. `/homepage` or `http://example.com`
203+
* `$iconString` - a string containing valid CoreUI Icon name (kebab-case), ex. `cui-speedometer` or `cui-star`
204+
205+
To add a __title__ to the sidebar - use function `insertTitle()`:
206+
```php
207+
$id = $this->insertTitle( $rolesString, $title );
208+
```
209+
* `$rolesString` - a string with list of user roles this menu element will be available, ex. `"guest,user,admin"`
210+
* `$title` - a string caption visible in sidebar
211+
212+
To add a __dropdown__ menu to the sidebar - use function `beginDropdown()`:
213+
```php
214+
$id = $this->beginDropdown( $rolesString, $visibleName, $href, $iconString);
215+
```
216+
* `$rolesString` - a string with list of user roles this menu element will be available, ex. `"guest,user,admin"`
217+
* `$visibleName` - a string caption visible in sidebar
218+
* `$href` - a href, ex. `/homepage` or `http://example.com`
219+
* `$iconString` - a string containing valid CoreUI icon name (kebab-case). For example: `cui-speedometer` or `cui-star`
220+
221+
To end dropdown section - use function `endDropdown()`.
222+
223+
To add __link__ to __dropdown__ call function `insertLink()` between function calls `beginDropdown()` and `endDropdown()`.
224+
Example:
225+
```php
226+
$id = $this->beginDropdown('guest,user,admin', 'Some dropdown', 'http://example.com', 'cui-puzzle');
227+
$id = $this->insertLink('guest,user,admin', 'Dropdown name', 'http://example.com');
228+
$this->endDropdown();
229+
```
230+
231+
__IMPORTANT__ - At the end of `run()` function, call `joinAllByTransaction()` function:
232+
```php
233+
$this->joinAllByTransaction();
234+
```
235+
236+
Once done with seeds file edit, __run__:
237+
``` bash
238+
$ php artisan migrate:refresh --seed
239+
# This command also rollbacks database and migrates it again.
186240
```
187241

188242
## Creators

0 commit comments

Comments
 (0)