Add new route
cd routes
vi web.php ( add POST/GET routes) based upon auth level (can)
Add route to navbar
vi resources/view/bin/layout/navbar.blade.php
Create controller file using artisan, name must match
cd app/Http/Controllers/
php artisan make:controller WhateverController
cd app/Http/Controllers/
Copy contents from a template controller like Holidays.php to the new file
Edit the new file and switch out template for actual names
Create the view (DT) file by copying from an existing file like holidays.blade.php:
cd resources/views/bin
cp holidays.blade.php $newfile
vi $newfile # make changes
Set up the database table
cd $home
php artisan make:migration create_tablename_table
cd database/migrations
Edit table adding fields; add generic fields include ../db.tpl
cd $home
php artisan migrate
To migrate fresh a single database table:
php artisan migrate:refresh --path=/database/migrations/fileName.php
Create $_POST handler method for holidays by editing the HolidaysController.php file
cd app/Http/Controllers/
vi your-controller-file
For format copy some contents from the NoteController.php file.
Create javascript file
cd resource/js/dt
cp holidays.js your-new-file.js
vi your-new-file
Make necessary changes
Copy devel resources to public resources
cd $home
npm run dev
If errors execute monitor script
npm run watch
Models
Models are only required if there will be database interaction.
Create a function like $colorpicker
- php artisan make:model Webcolor (could have been colorpicker
- vi app/DTE/CustomFunctions.php
private static $webcolors = null;
public static function getWebcolors() {
if (static::$webcolors === null) {
$data = Webcolor::select('color','hex')->orderBy('color','ASC')->get()->toArray() ;
$colors = [];
foreach ( $data as $hex) {
array_push( $colors, ['label' => $hex['color'], 'value' => $hex['hex'] ]);
}
static::$webcolors = $colors;
}
return static::$webcolors;
}
- Add function to your controller file. vi your_controller.
- Under public function dashboardIndex() { add 2 lines:
- $colorpicker = CustomFunctions::getWebcolors ();
- return view('bin.webpages',compact('colorpicker'));
- Add the resource to the view file, vision/resources/views/bin/webpages.blade.php
- var colorpicker = @json ( $colorpicker );
- Set it up in the .js file.
type: 'select',
options: colorpicker,
Create a function like $font_families from a foreach loop.
The getFontFamilies is more basic in that it creates the labels/values from an ordinary string be first turning the string into an array.
push changes to github
- git status
- git add -A
- git commit -m "Write commit details"
- git pull origin master (always commit before pull)
- git push origin master
- Enter your Username and Token as Password