2017 © Pedro Peláez
 

project laravel-boilerplate-platform

image

dhandarbeit-tk/laravel-boilerplate-platform

  • Tuesday, June 20, 2017
  • by dhandarbeit-tk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel (5.7) Generic Boilerplate for platforms

Provides useful helper functions and class structure for core functionality of laravel/laravel., (*1)

Built to be customizable., (*2)

Installation

Create project
composer create-project dhandarbeit-tk/laravel-boilerplate-platform, (*3)

Preinstalled packages

New Defaults

  • LOG_CHANNEL=daily
  • database.migrations=laravel_migrations
  • queue.database.table=laravel_jobs
  • queue.failed.table=laravel_failed_jobs

Other defaults: - app.locale=de - app.timezone=Europe/Berlin, (*4)

Directories

  • app/Support
  • app/Eloquent/Models
  • app/Eloquent/Collections

Helper Functions

(app/Support/helpers.php), (*5)

  • array_ensured($array, $data)
    • return $array, containing all keys of data, and value if $array doesnt have the key
  • user()
    • shorthand for auth()->user()
  • decodeHashid($connection, $encoded, $default)
    • returns decoded hashid of $encoded for $connection; if not possible, return $default
  • encodeHashid($connection, $decoded)
    • returns encoded hashid of $decoded for $connection
  • isCurrentRelease()
    • determines if running release is most recent release (useful for deployment related things)

Customizable classes and methods

  • App\Eloquent\Models\Model (trait: IsModel), (*6)

    • is($model = null) (overwrite)
      • allows argument to be null (returns false)
    • isClass($class)
  • App\Eloquent\Models\Traits\HasTimestamps, (*7)

    • updateTimestamps() (overwrite)
      • only sets updated_at when updating, not when creating
  • App\Eloquent\Models\Pivots\Pivot (trait: IsPivot), (*8)

  • App\Support\Collection (trait: CollectionTrait), (*9)

    • implode($value, $glue = null, $skipNull = false) (overwrite)
      • allows to skip null
  • App\Eloquent\Collections\Collection (trait: CollectionTrait), (*10)

    • without($model = null)
      • return a new Collection without $model
    • eachDelete()
      • runs delete() on each model
    • eachAppends($attributes)
      • runs appends($attributes) on each model

Stubs

  • artisan make:model
    • (app/Console/stubs/model.stub)
    • prefills table name
    • has predefined areas for relationships

The Versions