lundi 23 avril 2018

else statement is not working

It is a bit strange question but I am stucked here. I am just using a query to determine the value of a variable, and I am getting my expected value. But when I pass it to blade file , I get the value if variable. But the condition is not working properly.

Blade.php

@foreach($rolepermssion as $role)

  @if($rol==1)
    <form method="post" action="">

    </form>

  @else
     <form method="post" action="">
    </form    
    @endif
    @endforeach

Controller.php

public function modulePermission(){
    $role_id = $_GET['role_id'];

    $rol= RolePermission::where("roles_id", "=", $role_id)->count();

    $rolepermssion=RolePermission::where('roles_id','=',$role_id)->get();
    return view('system-configurations.module-permission',compact('rolepermssion','rol','role_id','avail'));
}

Aucun commentaire:

Enregistrer un commentaire