PHP code example of andheiberg / readable

1. Go to this page and download the library: Download andheiberg/readable 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/ */

    

andheiberg / readable example snippets


    /**
     * Mark a resource as read
     *
     * @var void
     */
    public function markAsRead()

    /**
     * Mark a resource as unread
     *
     * @var void
     */
    public function markAsUnread()

    /**
     * Limit query to read resources
     *
     * @var void
     */
    public function scopeRead($query, $user_id = null)

    /**
     * Limit query to unread resources
     *
     * @var void
     */
    public function scopeUnread($query, $user_id = null)

    Post::find(1)->markAsRead();