Laravel wywołanie metody static w widoku

0

Mam taki problem nie mogę wywołać funkcji w widoku blade Dostaje komunikat.

Class 'Usee' not found (View: /var/www/html/nastroj_2020/resources/views/Main/showMood.blade.php) 

Tutaj jest częśc kodu nie będe pokazywał całego to to mija się z celem.

widok blade.

                    @if (Usee::IfDrugs($list["date_start"],$list["date_end"],$idUser) == 0 )
                        <button class="btn btn-danger btn-lg" disabled>Nie było leków</button>
                    @else
                        <button onclick="showAction('{{route('action.show')}}',{{$i-1}},{{$listPercent[$i-1]["id"]}})" class="btn btn-primary btn-lg">Pokaż leki</button>
                    @endif
<?php


namespace App\Http\Controllers\Main;
//namespace App\Http\Controllers\Guest;
//use App\Http\Controllers\User\UserRegisterController;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Validator;
use Illuminate\Http\Request;
use App\Http\Services\User as ServiceUser;
use App\Http\Services\Calendar;
use App\Http\Services\Mood;
use App\Http\Services\Action as Action2;
use App\Http\Services\Common;
use App\Http\Services\Product;
use App\Http\Services\DrugsUses as Drugs;
use App\Usee as Usee;
use App\Action;
use Auth;
use App\Mail\OrderShipped;
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Auth;
class Usee extends Model
{
    public static function IfDrugs($dateStart,$dateEnd,$idUser) {
        return self::where("date",">=",$dateStart)->where("date","<=",$dateEnd)->where("id_users",$idUser)->count();
    }
}

Generaln ie chodzi mi o wywołanie metody w widoku blade.

2

Spróbuj wykorzystać pełną ścieżkę do klasy, tj.: \App\Usee::IfDrugs(...).

0

W Widokach musisz podawać pełnego namespace bo nie masz przecież nigdzie dodane "use". Jak chcesz krótką wersje to musisz stworzyć swoją fasade.

1 użytkowników online, w tym zalogowanych: 0, gości: 1