laravel-routing

Laravel authenticated dynamic subdomain routing

这一生的挚爱 提交于 2021-02-19 04:42:43
问题 I'm trying to get authenticated subdomain routing working for some specific variable subdomains: app.example.com staging.app.example.com testing.app.example.com These should be guarded by the auth middleware. They all essentially reference app.example.com but for different environments. Everything that hits these domains should go to the guest routes: example.com staging.example.com testing.example.com This is what I've tried so far... Created this middleware to prevent the subdomain

Why i got other url in active url laravel?

爱⌒轻易说出口 提交于 2021-02-11 14:41:45
问题 I am using Laravel 8 and I am facing issue with URL on local server ubuntu . When I on http://www.ereciept.com/ route then each and everything working fine. If i hit an other route like http://www.ereciept.com/invoices/show and then i cal ajax route http://www.ereciept.com/language/key then the hit url become http://www.ereciept.com/invoices/language/key. I don't know what happening. My we file is Route::get('language/{key}', [SwitchLanguageController::class, 'switchLanguage'])->name(

Pass variables to multiple view in laravel

落花浮王杯 提交于 2021-02-08 10:13:00
问题 I want to pass a variable to multiple view bu when i use share method in View. Its says the share method isn't find on View. How you say i use it and i try the composer either but no matter how i try it can't work could you give me simple example of this action My controller categorycontroller.php public function site(){ $data = array(); $data['subcategories'] = SubCategory::all(); $data['categories'] = Category::all(); return view('template.sitemap',compact("data")); } My route web.php Route

passing multiple variable to one view in laravel 5.6

我只是一个虾纸丫 提交于 2021-01-29 10:44:23
问题 hello to all I want to pass multiple variables to one view this is my CategoryController.php public function site() { $categories = Category::all(); return view('template.sitemap', ['categories' => $categories]); } and this is SubCategoryController.php public function index2(){ $subcategories = SubCategory::all(); return view('template.sitemap',['subcategories'=>$subcategories]); } this is my route for this action in web.php Route::get('sitemap.html','CategoryController@site')->name('sitemap'

Laravel routes not working as expected

戏子无情 提交于 2021-01-29 07:26:00
问题 I have just created UserController and added a route in the routes.php file: Route::resource('users', 'UserController'); When I visit laravel.dev/users I expected to see the user index view, but instead I get a 404 error: The requested URL /users was not found on this server. Here is the output when running: php artisan routes +--------+------------------------+---------------+------------------------+----------------+---------------+ | Domain | URI | Name | Action | Before Filters | After

Laravel 5.2, Maximum function nesting level

烈酒焚心 提交于 2021-01-29 03:06:22
问题 Please, help me to find what is going on. I just set up a basic Laravel project. It's a new fresh Laravel project (5.2.29) This is route.php Route::get('/', 'TestController@index'); This is the test controller class TestController extends Controller { public function index() { return view('home'); } } The home.blade.php is the one that comes with a fresh Laravel installation, the one printing "Laravel 5". When I add the 'web' middleware, as following Route::group(['middleware' => ['web']],

Laravel 5.2, Maximum function nesting level

青春壹個敷衍的年華 提交于 2021-01-29 03:03:24
问题 Please, help me to find what is going on. I just set up a basic Laravel project. It's a new fresh Laravel project (5.2.29) This is route.php Route::get('/', 'TestController@index'); This is the test controller class TestController extends Controller { public function index() { return view('home'); } } The home.blade.php is the one that comes with a fresh Laravel installation, the one printing "Laravel 5". When I add the 'web' middleware, as following Route::group(['middleware' => ['web']],

Wildcard URL routing in Laravel

瘦欲@ 提交于 2021-01-27 19:14:24
问题 I am attempting to create a set of routes in laravel. The first two are simple. / loads home /12345 loads a result for 12345 via ResultController, which I accomplished with {result}/ . The third route I would like is /12345/foo/bar/baz, which eventually will execute a second controller that presents files. Basically /foo/bar/baz represents the file location, so it could be any level of depth. I would like to pass it to the controller as a single value. I tried the below route to simply test

Laravel how to get current Route

与世无争的帅哥 提交于 2020-12-27 03:14:35
问题 I have the following in my Routes.php: Route::get('cat/{cat}', ['as' => 'cat', 'uses' => 'CatController@get']); I want to check in my sidebar.blade.php file if any of the views returned from the Controller function matches the current page. {cat} could be either a,b,c,d,f or e. The sidebar consists of 6 images. If for example the route is cat/a the image of tis route should be changed. People suggested Route::current()->getName() but this only returns cat and not /a, /b, /c, etc. Also some

how to use apiReources method with `only`?

你离开我真会死。 提交于 2020-12-10 04:11:30
问题 I'm creating an api with Laravel and I am looking for a easy lazy way to to register Api resources. I'm currently defining my routes like this: Route::apiResoruce('categories', 'CategoryController')->only(['index', 'show']); I checked Laravel's controller documentation and I saw apiResources method which I can create multiple api resources at once. the goal: is to be able to use apiResources with only method like this Route::apiResources(['categories' => 'CategoryController', 'products' =>