PHP code example of yubarajshrestha / iarticles

1. Go to this page and download the library: Download yubarajshrestha/iarticles library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yubarajshrestha / iarticles example snippets


use YubarajShrestha\IArticles\InstantArticle;
use YubarajShrestha\IArticles\Articles;
class YourModel implements InstantArticle {


    /** 
     * Instant Article
     * @return Collection of YourModel
     */
    public static function getFeedItems()
    {
        return YourModel::latest()->get()->take(25);
    }

    /** 
     * Filter Feed Data
     * @return iArticle Object
     */
    public function iArticle()
    {
        return Articles::create([
            'id' => $this->id, // .
            'author' => '' // nullable | email | string
        ]);
    }
}
shell
php artisan vendor:publish --tag=iarticles