PHP code example of skybluesofa / laravel-microblog

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

    

skybluesofa / laravel-microblog example snippets


composer 

'providers' => [
    ...
    Skybluesofa\Microblog\ServiceProvider::class,
    ...
];

use Skybluesofa\Microblog\Model\Traits\MicroblogAuthor;
class User extends Model
{
    use MicroblogAuthor;
    ...
}

use Skybluesofa\Microblog\Model\Traits\MicroblogFriends;
class User extends Model
{
    use MicroblogFriends;
    
    ...
    public function getBlogFriends()
    {
        // Return null to get all users
        return null;
    
        // Return an array to get specific user ids
        // return [1,2,3];
    
        // Return an empty array to get no user ids (no one else)
        //return [];
    }
    ...
}

$post = new Post;
$post->content = 'This is the story of my life';
$user->savePost($post);

$post->delete();

$post->publish();

$post->unpublish();

$post->share();

$post->shareWithFriends();

$post->shareWithEveryone();

php artisan vendor:publish --provider="Skybluesofa\Microblog\ServiceProvider"

config\microblog.php

php artisan migrate