<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class utilisateur extends Model
{
    protected $fillable = ['name', 'mail', 'password'];
        //Control the unicity of the code
    
    public static function mailunique($mail){
    	//Count how many time this code fugure in the product table, if it more or equal to once the fuction return false in other case it return true.

    	$ManyTime = utilisateur::whereMail($mail)->count('id');

    	if($ManyTime>0){
    		return false;
    	}else{
    		return true;
    	}
    }
}
