976-tuna/news

NEWS

Installs: 24

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:Blade

v1.2.16 2025-04-27 19:58 UTC

README

Installation

install Laravel

Install Bootstrap

composer require laravel/ui --dev
php artisan ui bootstrap --auth

Install the bootstrap icons library.

npm install bootstrap-icons --save-dev

Install the Livewire and assets.

composer require livewire/livewire
php artisan livewire:publish --assets

Install Package

composer require 976-tuna/news
php artisan vendor:publish --provider="Tuna976\NEWS\NEWSServiceProvider" --tag="news-files"
php artisan migrate

Integration

Add the following to your user model:

// Role-based authentication methods
    public function isAdmin(): bool
    {
        return $this->role === 'admin';
    }
    
    public function isAuthor(): bool
    {
        return $this->role === 'author' || $this->isAdmin();
    }
    
    public function posts(): HasMany
    {
        return $this->hasMany(Post::class);
    }
    
    public function comments(): HasMany
    {
        return $this->hasMany(Comment::class);
    }

Inside your project, open the file resources\sass\app.scss and add :

@import 'bootstrap-icons/font/bootstrap-icons.css';

Inside your project, open the file app/Http/Controllers/Controller.php and make sure you have the following so Auth works properly

<?php

namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
abstract class Controller
{
    use AuthorizesRequests;
}