2017 © Pedro Peláez
 

library lara-tools

Useful tools for laravel

image

omnicode/lara-tools

Useful tools for laravel

  • Wednesday, February 14, 2018
  • by omnicode
  • Repository
  • 1 Watchers
  • 1 Stars
  • 623 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 16 Versions
  • 70 % Grown

The README.md

Lara Tools - Convenient tools for Laravel

Contents

  1. LaraUtil
  2. ModelExtrasTrait

LaraUtil

LaraUtil contains the following utility methods, (*1)

hasTable

Checks if the given table exists - caching the result, returns true or false, (*2)

LaraUtil::hasTable('users')

hasColumn

Checks if the given table has the given column - caching the query, returns true or false, (*3)

LaraUtil::hasColumn('users', 'first_name')

getFullColumns

Accepts the columns list and the table name and adds the table name into columns if does not exist e.g., (*4)

$columns = ['id', 'first_name', 'users.last_name'];
$columns = LaraUtil::getFullColumns($columns, 'users');

// the final array will look like
['users.id', 'users.first_name', 'users.last_name']

hashPassword

Hashes the given string by bcrypt, however afterwards encrypting the password's hash by application-side key. It also applies sha256 method (before hashing) to remove bcrypt's length restriction - more, (*5)

$hashedAndEcryptedPassword = LaraUtil::hashPassword('some password');

will be string like this eyJpdiI6IlU4amxZaVNCc2xjemlkZUNWRFVhb3c9PSIsInZhbHVlIjoidWs0bmRcL1JFMHk1dUE4Yk9kWFo3b2VSZEJuYXk5NngwUXMxMDBieTdvOVZ6d1JWQ3RObVE3RGZmcHlqYnV1Ymw5OFVKelRlb2JsSllcL21FVlk4WklVNHkzcnl5Ym90T0tJVzNZalRyUmI2dz0iLCJtYWMiOiI2MDE3ZTQ1NGE0NDcwNTY2Yjc3NzAyZmZlOWU4ZDBkMTE4ODNhNTY0YTE2ZmYzNDNkNDA0ZGI2ZWRhZjhjMTA3In0=, (*6)

verifyPassword

Verifies the password hashed by hashPassword method above - returns true or false, (*7)

$passwordMatch = verifyPassword('plan text password', $hashedAndEcryptedPassword);

ModelExtrasTrait

ModelExtrasTrait is a trait to be used in Models - provides the following methods, (*8)

saveAssociated

saveAssociated method is a wrapper method, that allows to save BelongsToMany and HasMany related models in a single transaction, e.g. suppose we need to save a product with its related categories, we would use, (*9)

Product::saveAssociated($data, ['associated' => 'categories']);

the $data should be an array like this, (*10)

$data = ['name', 'price', 'categories_ids' => [1, 3, 7]]

The Versions

14/02 2018

dev-master

9999999-dev

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

14/02 2018

0.0.14

0.0.14.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

02/02 2018

0.0.13

0.0.13.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

30/01 2018

0.0.12

0.0.12.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

30/01 2018

0.1.0

0.1.0.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

26/01 2018

0.0.11

0.0.11.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

14/11 2017

0.0.10

0.0.10.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

14/11 2017

0.0.9

0.0.9.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

14/11 2017

0.0.8

0.0.8.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

14/11 2017

0.0.7

0.0.7.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

14/11 2017

0.0.6

0.0.6.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

31/10 2017

0.0.5

0.0.5.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

21/08 2017

0.0.3

0.0.3.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

21/08 2017

0.0.4

0.0.4.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

19/08 2017

0.0.2

0.0.2.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation

02/07 2017

0.0.1

0.0.1.0

Useful tools for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar omnicode

laravel validator validation