Laravel

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

  1. php artisan make:model Webcolor (could have been colorpicker
  2. 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;
}
  1. Add function to your controller file. vi your_controller.
  2. Under public function dashboardIndex() { add 2 lines:
    • $colorpicker = CustomFunctions::getWebcolors ();
    • return view('bin.webpages',compact('colorpicker'));
  3. Add the resource to the view file, vision/resources/views/bin/webpages.blade.php
  4. var colorpicker = @json ( $colorpicker );
  5. 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

  1. git status
  2. git add -A
  3. git commit -m "Write commit details"
  4. git pull origin master (always commit before pull)
  5. git push origin master
  6. Enter your Username and Token as Password
Policies

Privacy Policy 
Terms of Use 
Cookie Policy 
Copyright © 2023 Cat Scratch Web Services

Contact

Cat Scratch Web Services

167 Montgomery Dr. 
Erie, CO, USA 80516 
Phone: +1 303-926-0167

Contact by form