<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Faculty extends Model
{
    use HasFactory;
    protected $fillable = [
        'faculty_name',
        'faculty_position',
        'department',
        'profile_picture'
    ];
    

    public function scopeSearch($query, $term){
        $term = "%$term%"; // Fix variable interpolation
        $query->where(function ($query) use ($term) {
            $query->where('faculty_name', 'like', $term);
        });
    }
}
