2017 © Pedro PelĂĄez
 

library laravel-postgres-extended-schema

Eloquent Extended, added some PostgreSQL features

image

emiliopedrollo/laravel-postgres-extended-schema

Eloquent Extended, added some PostgreSQL features

  • Sunday, October 22, 2017
  • by emiliopedrollo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 94 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 28 Forks
  • 0 Open issues
  • 21 Versions
  • 13 % Grown

The README.md

Laravel Postgres Extended

Build Status Maintainability Latest Stable Version Total Downloads Monthly Downloads License License, (*1)

Introduction

An extended PostgreSQL driver for Laravel 9+ with support for some aditional PostgreSQL data types: hstore, uuid, geometric types (point, path, circle, line, polygon...) and support for WITH [RECURSIVE] clause, (*2)

Installation

Simple run composer require emiliopedrollo/laravel-postgres-extended-schema in your project root directory., (*3)

Then you are done., (*4)

Usage

SELECT Queries

Use withExpression() and provide a query builder instance, an SQL string or a closure:, (*5)

$posts = DB::table('p')
    ->select('p.*', 'u.name')
    ->withExpression('p', DB::table('posts'))
    ->withExpression('u', function ($query) {
        $query->from('users');
    })
    ->join('u', 'u.id', '=', 'p.user_id')
    ->get();

Use withRecursiveExpression() for recursive expressions:, (*6)

$query = DB::table('users')
    ->whereNull('parent_id')
    ->unionAll(
        DB::table('users')
            ->select('users.*')
            ->join('tree', 'tree.id', '=', 'users.parent_id')
    );

$tree = DB::table('tree')
    ->withRecursiveExpression('tree', $query)
    ->get();

You can provide the expression's columns as the third argument:, (*7)

$query = 'select 1 union all select number + 1 from numbers where number < 10';

$numbers = DB::table('numbers')
    ->withRecursiveExpression('numbers', $query, ['number'])
    ->get();

INSERT/UPDATE/DELETE Queries

You can use common table expressions in INSERT, UPDATE and DELETE queries:, (*8)

DB::table('profiles')
    ->withExpression('u', DB::table('users')->select('id', 'name'))
    ->insertUsing(['user_id', 'name'], DB::table('u'));
DB::table('profiles')
    ->withExpression('u', DB::table('users'))
    ->join('u', 'u.id', '=', 'profiles.user_id')
    ->update(['profiles.name' => DB::raw('u.name')]);
DB::table('profiles')
    ->withExpression('u', DB::table('users')->where('active', false))
    ->whereIn('user_id', DB::table('u')->select('id'))
    ->delete();

Eloquent

You can use common table expressions in Eloquent queries., (*9)

$query = User::whereNull('parent_id')
    ->unionAll(
        User::select('users.*')
            ->join('tree', 'tree.id', '=', 'users.parent_id')
    );

$tree = User::from('tree')
    ->withRecursiveExpression('tree', $query)
    ->get();

Recursive Relationships

If you want to implement recursive relationships, you can use this package: staudenmeir/laravel-adjacency-list, (*10)

The Versions

22/10 2017

dev-master

9999999-dev

Eloquent Extended, added some PostgreSQL features

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza
by EmĂ­lio B. Pedrollo

database laravel postgresql eloquent

02/08 2017

0.19

0.19.0.0

Eloquent Extended, added some PostgreSQL features

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza
by EmĂ­lio B. Pedrollo

database laravel postgresql eloquent

22/08 2016

dev-develop

dev-develop https://bosnadev.com

Eloquent Extended, added some PostgreSQL features

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent

19/08 2016

0.18

0.18.0.0 https://bosnadev.com

Eloquent Extended, added some PostgreSQL features

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent

13/07 2016

0.17

0.17.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent mysql

27/04 2016

0.16

0.16.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent mysql

27/04 2016

0.15

0.15.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent mysql

03/04 2016

0.14

0.14.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent mysql

24/03 2016

0.13

0.13.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent mysql

17/09 2015

0.12

0.12.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent mysql

05/05 2015

0.11

0.11.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

The Development Requires

by Mirza Pasic
by Peter Haza

database laravel postgresql eloquent mysql

16/02 2015

0.10

0.10.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

by Mirza Pasic

database laravel postgresql eloquent mysql

16/02 2015

0.9

0.9.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

by Mirza Pasic

database laravel postgresql eloquent mysql

15/02 2015

0.8

0.8.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

by Mirza Pasic

database laravel postgresql eloquent mysql

15/02 2015

0.7

0.7.0.0

Eloquent Extended, added some PostgreSql features

  Sources   Download

The Requires

 

by Mirza Pasic

database laravel postgresql eloquent mysql

14/02 2015

0.6

0.6.0.0

  Sources   Download

The Requires

 

by Mirza Pasic

14/02 2015

0.5

0.5.0.0

  Sources   Download

The Requires

 

by Mirza Pasic

14/02 2015

0.4

0.4.0.0

  Sources   Download

The Requires

 

by Mirza Pasic

14/02 2015

0.3

0.3.0.0

  Sources   Download

The Requires

 

by Mirza Pasic

14/02 2015

0.2

0.2.0.0

  Sources   Download

The Requires

 

by Mirza Pasic

14/02 2015

0.1

0.1.0.0

  Sources   Download

The Requires

 

by Mirza Pasic