0

Route report.expAlert error (View: /home/grocersa/edesimarket.com/resources/views/layout/main.blade.php (i defined all place but not triggered plz help to find out)

This is my web.php file coding

Route::get('report/product_quantity_alert', 'ReportController@productQuantityAlert')->name('report.qtyAlert');
    Route::get('report/product_expiry_alert', 'ReportController@productExpiryAlert')->name('report.expAlert');
    Route::get('report/warehouse_stock', 'ReportController@warehouseStock')->name('report.warehouseStock');

This my main.blade.php coding

for sidebar (nav - menu )

  @if($product_exp_alert_active)
                  <li id="expAlert-report-menu">
                    <a href="{{route('report.expAlert')}}">{{trans('file.Product Expiry Alert')}}</a>
                  </li>
                  @endif

for user permission

@if($product_qty_alert_active || $product_exp_alert_active)

for database & roll permission

 $product_qty_alert_active = DB::table('permissions')
                      ->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
                      ->where([
                        ['permissions.name', 'product-qty-alert'],
                        ['role_id', $role->id] ])->first();
                $product_exp_alert_active = DB::table('permissions')
                      ->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
                      ->where([
                        ['permissions.name', 'product-exp-alert'],
                        ['role_id', $role->id] ])->first();

for define

 @if($alert_product > 0)
                <li class="nav-item">
                      <a rel="nofollow" data-target="#" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-item"><i class="dripicons-bell"></i><span class="badge badge-danger">{{$alert_product}}</span>
                      </a>
                      <ul class="dropdown-menu edit-options dropdown-menu-right dropdown-default notifications" user="menu">
                          <li class="notifications">
                            <a href="{{route('report.qtyAlert')}}" class="btn btn-link"> {{$alert_product}} product exceeds alert quantity</a>
                            </li>
                            <li class="notifications">
                            <a href="{{route('report.expAlert')}}" class="btn btn-link"> {{$alert_product}} product expiry alert</a>
                          </li>
                      </ul>
                </li>
                @endif

This is my reportcontroller.php coding

class ReportController extends Controller
{
    public function productQuantityAlert()
    {
        $role = Role::find(Auth::user()->role_id);
        if($role->hasPermissionTo('product-qty-alert')){
            $lims_product_data = Product::select('name','code', 'image', 'qty', 'alert_quantity')->where('is_active', true)->whereColumn('alert_quantity', '>', 'qty')->get();
            return view('report.qty_alert_report', compact('lims_product_data'));
        }
        else
            return redirect()->back()->with('not_permitted', 'Sorry! You are not allowed to access this module');
    }
    
    public function productExpiryAlert()
    {
        $role = Role::find(Auth::user()->role_id);
        if($role->hasPermissionTo('product-exp-alert')){
            $lims_product_data = Product::select('name','code', 'image', 'qty', 'alert_expiry')->where('is_active', true)->whereColumn('alert_expiry', '>', 'name')->get();
            return view('report.exp_alert_report', compact('lims_product_data'));
        }
        else
            return redirect()->back()->with('not_permitted', 'Sorry! You are not allowed to access this module');
    }
  • 1
    Are you caching your routes by chance? If you are, and you adjust your routes, you'll need to reload that as explained here: https://stackoverflow.com/questions/37878951/how-to-clear-laravel-route-caching-on-server. If you're not caching, then you'll have to check if that route is defined correctly (it looks like it is, but you can confirm with `php artisan route:list`, then searching for `report.expAlert`) – Tim Lewis Sep 09 '21 at 19:05
  • does your route appear if you run `php artisan route:list`? If not, do `php artisan route:clear` – Cornel Raiu Sep 09 '21 at 19:05
  • no route not appear - cornel raju – Maulik Prajapati Sep 09 '21 at 19:08
  • how to confirm with php artisan route:list ? plz help – Maulik Prajapati Sep 09 '21 at 19:10
  • 1
    Was there something unclear about us saying run `php artisan route:list` and see if `report.expAlert` appears in that list? Copy the output of that command to a text file and search against it... Or literally any other method of searching for text... – Tim Lewis Sep 09 '21 at 19:11
  • @MaulikPrajapati or just refer to the documentation or other SO posts - including the one linked by Tim above. – Cornel Raiu Sep 09 '21 at 19:16
  • not appear in list – Maulik Prajapati Sep 09 '21 at 19:18
  • No this route not appear in list – Maulik Prajapati Sep 09 '21 at 19:29
  • `php artisan route:clear && php artisan view:clear && php artisan config:clear && php artisan cache:clear && php artisan clear-compiled && composer dump-autoload` clear all caches see if your routes load. – Cameron Sep 09 '21 at 19:55

0 Answers0