<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Authenticatable;


class Journal extends Model {
	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'journaux';


    function getEcritures() {
        $ecritures=GrandLivre::where('journal','=',$this->nom_court)->get();
        if(!$ecritures) return "";
        return $ecritures;
    }

    function getNbEcrituresAttribute() {
        $nb=GrandLivre::where('journal','=',$this->nom_court)->count();
        return $nb;
    }
}