php - Laravel - How to use a vendor class? -
I want to use mobile detection on m routes.php file. I compose the package Added as required in JSN and it is installed in the vendor file. How can I use it now?
I tried this answer and there was no luck because the class was not found:
{"name": "laurel / larval", "description": "larval framework "", "Append", "app", "app", "app", "app", "app" Model "," app / database / migration "," app / command "," database / seeds "," ap / test / tests.cf "]}," script ": {" post-install-CMD ": [" Php artisan spot "PHP-Artisan Optimization"], "Post-Update-CMD": ["php artisan clear-compiled", "php artisan optimize"], "post-project-CMD": ["php artisan key: generated "]", "Config": {"prefer-install": "dist"}, "minimal stability": "static"}
Edit: I use it one Tried: But the surname never said that the class was not found.
This package is located in the name of the code detection \ mobile detective
though you want to make sure it's the correct namespace if you have your own routes.php
Have tried to add proper namespace to?
Use Search MobileDetect as MobileDetect;
Or you can refer to the proper namespace inline. Here's an example:
$ detect = new detection \ MobileDetect \ Mobile_Detect; $ DeviceType = ($ detect-> hasmobile ()? ($ Detect-> IsTablet ()? 'Tablet': 'Phone'): 'Computer');
If this does not work for you, you can participate by adding it to your composer.json
classmap:
< Code> "autoload": {"classmap": {"/ vendor / serbanghita / namespaced /"],}
Fill the correct path, then a composer Dump-Auto < / Code>.
Comments
Post a Comment