Blade Directives β
If you're using the package to conditionally render HTML based on the connection agent, you can do so in a simple and elegant way. Here are all the directives included in the package.
Is Mobile Connection β
This directive validates if the connection is from a mobile device (tablet, smartphone, etc.). You can use it directly in the Blade views.
@agentMobile
  <p>Mobile Connection Detected</p>
@endAgentMobile@agentMobile
  <p>Mobile Connection Detected</p>
@endAgentMobileIs Desktop Connection β
This directive validates if the connection is from a desktop device. You can use it directly in the Blade views.
@agentDesktop
  <p>Desktop Connection Detected</p>
@endAgentDesktop@agentDesktop
  <p>Desktop Connection Detected</p>
@endAgentDesktopFrom iPhone β
This directive validates if the connection is from an iPhone specifically, not validating iPad or similar devices; it is limited to checking if the connecting device is an iPhone.
@agentIPhone
  <p>Connection from iPhone Detected</p>
@endAgentIPhone@agentIPhone
  <p>Connection from iPhone Detected</p>
@endAgentIPhoneFrom Macintosh β
This directive validates if the connection is from a Macintosh device specifically, not validating iMac or similar devices.
@agentMacintosh
  <p>Connection from Macintosh Detected</p>
@endAgentMacintosh@agentMacintosh
  <p>Connection from Macintosh Detected</p>
@endAgentMacintoshFrom iMac β
This directive validates if the connection is from an iMac specifically, not validating Macintosh or similar devices.
@agentIMac
  <p>Connection from iMac Detected</p>
@endAgentIMac@agentIMac
  <p>Connection from iMac Detected</p>
@endAgentIMacFrom iPod β
This directive validates if the connection is from an iPod specifically, not validating similar devices.
@agentIpod
  <p>Connection from iPod Detected</p>
@endAgentIpod@agentIpod
  <p>Connection from iPod Detected</p>
@endAgentIpodFrom iPad β
This directive validates if the connection is from an iPad specifically, not validating similar devices.
@agentIpad
  <p>Connection from iPad Detected</p>
@endAgentIpad@agentIpad
  <p>Connection from iPad Detected</p>
@endAgentIpadFrom Linux β
This directive validates if the connection is from a device with the Linux operating system (regardless of the distribution).
@agentLinux
  <p>Connection from Linux Device Detected</p>
@endAgentLinux@agentLinux
  <p>Connection from Linux Device Detected</p>
@endAgentLinuxFrom Android β
This directive validates if the connection is from a device with the Android operating system, commonly working on Linux but determining if an Android is in use.
@agentAndroid
  <p>Connection from Android Device Detected</p>
@endAgentAndroid@agentAndroid
  <p>Connection from Android Device Detected</p>
@endAgentAndroidFrom Windows β
This directive validates if the connection is from a device with the Windows operating system, specifically Windows Desktop.
@agentWindows
  <p>Connection from Windows Device Detected</p>
@endAgentWindows@agentWindows
  <p>Connection from Windows Device Detected</p>
@endAgentWindowsFrom Windows Phone β
Although rare, if there are still users with this technology, we can identify them.
@agentWindowsPhone
  <p>Connection from Windows Phone Detected</p>
@endAgentWindowsPhone@agentWindowsPhone
  <p>Connection from Windows Phone Detected</p>
@endAgentWindowsPhoneFrom a Tablet β
Sometimes we need to adjust content for tablets, so with this method, you can determine if the connection is from a tablet.
@agentTablet
  <p>Connection from Tablet Detected</p>
@endAgentTablet@agentTablet
  <p>Connection from Tablet Detected</p>
@endAgentTabletIs Crawler β
If we need to validate if the agent is a crawler, we can do so extremely simply:
@agentCrawler
  <p>Connection from Crawler Detected</p>
@endAgentCrawler@agentCrawler
  <p>Connection from Crawler Detected</p>
@endAgentCrawlerValidate by Match β
If you want to have a dynamic method of validating the agent, you may find it convenient to use the following method supplied by the package:
@agentMatch('Mac')
  <p>Connection from Mac Detected</p>
@endAgentMatch@agentMatch('Mac')
  <p>Connection from Mac Detected</p>
@endAgentMatchConnection IP: β
You can also find out through which IP the Agent connected to the application:
@agentRemoteIp('181.10.10.23')
  <p>Connection from IP: 181.10.10.23 Detected</p>
@endAgentRemoteIp@agentRemoteIp('181.10.10.23')
  <p>Connection from IP: 181.10.10.23 Detected</p>
@endAgentRemoteIpConnection Port β
It may be useful to know through which port the connection occurred, so here it is:
@agentRemotePort('8080')
  <p>Connection from Port: 8080 Detected</p>
@endAgentRemotePort@agentRemotePort('8080')
  <p>Connection from Port: 8080 Detected</p>
@endAgentRemotePort
Laravel Agent Detection