lumenpress / nimble
There is no license information available for the latest version (v0.2.3) of this package.
v0.2.3
2017-11-10 02:04 UTC
Requires
- php: >=5.6.4
- illuminate/database: ^5.4
- intervention/image: ^2.4
- league/flysystem: ^1.0
- ralouphie/mimey: ^1.0
Requires (Dev)
- fzaninotto/faker: ^1.7
- kint-php/kint: ^2.2
- laravel/lumen-framework: ^5.4
- lumenpress/testing: ~0.2.0
- phpunit/phpunit: >=5.7
- vlucas/phpdotenv: ^2.4
README
$post = new Post; $post->title = 'Hello World'; $post->content = 'This is a post.'; // meta $post->meta->foo = 'bar'; $post->meta->arr = ['value1', 'value2']; // taxonomy $post->tax->category = 'category name'; $post->tax->post_tag = ['tag1', 'tag2']; // acf // text type $post->acf->text = 'Text1'; // group type $post->acf->hero = [ 'image' => '/path/to/image.png', 'link' => 'http://' ]; // repeater type $post->acf->slides = [ [ 'image' => '/path/to/image.png', 'description' => 'some text1', 'link' => 'http://' ], [ 'image' => '/path/to/image.png', 'description' => 'some text2', 'link' => 'http://' ], ]; $post->save();
Post/Page
Models
- Inserts
$post = new Post; $post->title = 'title'; $post->content = 'content'; $post->save();
- Updates
$post = Post::find(1); $post->title = 'title'; $post->content = 'content'; $post->save();
Buidlers
- Types
// single type Post::type('post'); // equal Post::where('post_type', 'post'); // multiple types Post::type('page', 'post'); Post::type(['page', 'post']); // equal Post::whereIn('post_type', ['page', 'post']);
- Status
// single status Post::status('publish'); // equal Post::where('post_status', 'publish'); // multiple status Post::status('publish', 'draft'); Post::status(['publish', 'draft']); // equal Post::whereIn('post_status', ['publish', 'draft']);
- Slug
Post::slug('post-name'); // equal Post::where('post_name', 'post-name');
- Url
Page::url('parent-name/post-name'); // equal $parent = Page::slug('parent-name')->first(); Page::parent($parent->id)->slug('post-name')->first();
- Where & whereIn & orWhere & orWhereIn
// query from post field Page::where('field', 'value'); // query from post meta key Page::where('meta.key', 'value'); // query from term taxonomy Page::where('term.taxonomy', 'taxonomy'); // query from term name Page::where('term.name', 'term name'); // query from term meta key Page::where('term.meta.key', 'value');
- Order By
// order by post field Page::type('page')->orderBy('date', 'asc'); // asc & desc // order by meta key value Page::type('page')->orderBy('meta.key', 'desc');
Menu
Location
Menu::location('main'); Menu::location('footer');
Slug
Menu::slug('main');
Collection
$menus = Menu::get(); $menus['main']; // location name $menus[1]; // menu id
Term
Models
$term = new Term; $term->taxonomy = 'category'; $term->name = 'Category Name'; $term->save();
Buidlers
Taxonomy
Term::taxonomy('category');
Exists
Term::exists($taxonomy, $name, $parent = 0);
Where & whereIn & orWhere & orWhereIn
// query from term field Term::where('field', 'value'); // query from term meta key Term::where('meta.key', 'value');
Taxonomy/Category/Tag
comming soon
User
comming soon
Comment
comming soon