1. Go to this page and download the library: Download ojessecruz/simple-blog 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/ */
ojessecruz / simple-blog example snippets
// Via a specific Gate
'admin_middleware' => ['web', 'auth', 'can:manage-blog'],
// Via a separate guard
'admin_middleware' => ['web', 'auth:admin'],
// Combo of your app's own middleware
'admin_middleware' => ['web', 'auth', 'verified', 'super.admin'],
use Jessecruz\SimpleBlog\Contracts\Author;
class User extends Authenticatable implements Author
{
public function getBlogAuthorName(): string
{
return $this->name;
}
public function getBlogAuthorInitials(): string
{
$words = preg_split('/\s+/', trim($this->name)) ?: [];
$initials = array_map(
fn (string $w) => mb_strtoupper(mb_substr($w, 0, 1)),
array_slice($words, 0, 2),
);
return implode('', $initials);
}
public function getBlogAuthorAvatarUrl(): ?string
{
return $this->avatar_url; // or null if you don't have avatars
}
}