Skip to content

Eng3bbas/quiqi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Quiqi , A Query Builder

##Usage :

  1. just extend the model class :
    class Post extends Model
    the of table will be identified automatically you can customise it of course using:
        protected $table = "posts"
    ###CRUD operations
  2. just create a connection using PDO only and pass it to the constructor for Select :
       $post->all()
    You can specify the columns by passing their names in array
    $post->all(['title','created_at'])

for insert just use :

 $post->create(['title' => "I'm title!"])

and it will return the passed data. for update You can use :

 $post->update(
   /* new Data here*
   [
       'title' => 'id' 
   ],
   // Where conditions here
   /*
   usage of where conditions here by createing an array contains alot of array (conditions):
   1. passing the column name and value
   2. passing an operator if not the equal
   3. passing a link operator (AND,OR)
    */
   [
       'column' => 'user_id',
       'operator' => '<'
       'value' => 44,
       'link_oprator' => 'and'
   ],
   [
       'column' => 'name',
       'value' => 'abbas'
   ] 
   )

and it will return the new data has been updated. for delete: just use delete method and you can pass where conditions like the example in update php $post->delete( [ 'column' => 'id', 'value' => 22 ] ) and it will return bool value

About

Simple Query Builder

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages