1. Go to this page and download the library: Download orchid/press library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
orchid / press example snippets
// Create entity for one record
php artisan orchid:entity-single
// Create entity for many records
php artisan orchid:entity-many
// All posted posts
$posts = Post::published()->get();
$posts = Post::status('publish')->get();
// Specific entry
$post = Post::find(42);
// Post name based on the current localizationecho $post->getContent('name');
// Specific entry
$post = Post::find(42);
// All optionsecho $post->getOptions();
// Get all localization parameters from optionsecho $post->getOption('locale');
// If the option does not exist or is not specified// you can specify the second parameter that will be returned.echo $post->getOption('countPlace',10);
//All objects in the $videos collection will be Post instances
$videos = Post::type('video')->status('publish')->get();
// All categories
$category = Taxonomy::category()->slug('uncategorized')->posts()->first();
// Only all categories and entries associated with it
$category = Taxonomy::where('taxonomy', 'category')->with('posts')->get();
$category->each(function($category){
echo $category->term->getContent('name');
});
// all posts from category
$category = Category::slug('uncategorized')->posts()->first();
$category->posts->each(function($post){
echo $post->getContent('name');
});
/**
* Get the indexable data array for the model.
*
* @param $array
*
* @return mixed
*/publicfunctiontoSearchableArray($array){
// Customize array...return $array;
}
/**
* Get the indexable data array for the model.
*
* @param $array
*
* @return mixed
*/publicfunctiontoSearchableArray($array){
$array['content']['en']['id'] = $array['id'];
return $array['content']['en'];
}
useOrchid\Press\Models\Post;
// Get the entity object
$post = Post::find(1);
// Through a string
$post->tag('foo, bar, baz');
// Through an array
$post->tag([ 'foo', 'bar', 'baz']);
// Get the entity object
$post = post::find(1);
// Through a string
$post->untag('bar, baz');
// Through an array
$post->untag(['bar', 'baz']);
// Remove all the tags
$post->untag();
// Get the entity object
$post = Post::find(1);
// Through a string
$post->setTags('foo, bar, baz');
// Through an array
$post->setTags(['foo', 'bar', 'baz']);
// Using the `slug` column
$post->setTags(['foo', 'bar', 'baz'], 'slug');
// Get the entity object
$post = Post::whereTag('foo, bar')->get();
$post = Post::find(1);
$tags = $post->tags;
$tags = Post::allTags();
// Retrieve all comments for a specific Post
$comments = Comment::findByPostId(42);
$comment = Comment::find(1);
// Get in touch with Post
$post = $comment->post();
// Get parent comment
$comment = $comment->original();
// Get child comments
$comment = $comment->replies();
// Get the author of the comment
$comment = $comment->author();
$comment = Comment::find(1);
// Check if a comment has been posted
$comment->isApproved();
// Check if a comment is a response to another comment
$comment->isReply();
// Check if the comment has answers
$comment->hasReplies();