PHP code example of zaratedev / laravel-excludable

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

    

zaratedev / laravel-excludable example snippets



use Illuminate\Database\Eloquent\Model;
use ZarateDev\LaravelExcludable\Excludable;

class User extends Model
{
    use Excludable;
}


use App\Models\User;

class UserController extends Controller
{
    public function index()
    {
        $user = auth()->user();

        $users = User::query()->exclude($user)->get();

        return view('users.index', compact('users'));
    }
}