
[英]Behaviour should change due to authorization at service or controller level?
我想獲取一些資源,我希望根據連接的用戶有 2 種不同的行為。 如果用戶是管理員,他會檢索所有資源,否則他只會檢索他可以訪問的資源。 關於這種情況有什么建議嗎? 最好的方法是什么?為什么? 以下是我發現的不同選項: 在controller層: 在服務層面: 我應該創建 2 個控制器嗎: ...
[英]Behaviour should change due to authorization at service or controller level?
我想獲取一些資源,我希望根據連接的用戶有 2 種不同的行為。 如果用戶是管理員,他會檢索所有資源,否則他只會檢索他可以訪問的資源。 關於這種情況有什么建議嗎? 最好的方法是什么?為什么? 以下是我發現的不同選項: 在controller層: 在服務層面: 我應該創建 2 個控制器嗎: ...
[英]How to pass variables into different functions inside a php controller
我正在嘗試創建一個表單選擇字段,顯示所有具有指定類型的學校。 代碼的 laravel 功能有效。 因為我在一頁上有這個,所以一切正常。 但我被要求將它們移到兩個單獨的頁面上。 我的問題是如何將我的 $type 變量從我的 storeType function 正確地放入我的學校選擇 functio ...
[英]problems loading 2 custom controllers in gazebo
我知道有很多關於此錯誤的問題,但我找不到解決方案。 我三次檢查了我用來定義宏和插件的名稱,我認為我已經很好地定義了它們,所以我想我在這里遺漏了一些東西。 我之前做了一個 controller 沒有問題,現在主要的區別是我想選擇 2 個控制器而不是 1 個。所以,每次我啟動工作控制器時,都會出現這個日 ...
[英]Render and/or redirect Ruby
我有 2 個會話客戶端和管理員的登錄頁面,所以當客戶端登錄時,我會重定向以完成表單,當管理員登錄時,我將他重定向到儀表板,問題是: ActionController::DoubleRenderError(在此操作中多次調用渲染和/或重定向。請注意,您只能調用渲染或重定向,並且每個操作最多一次。另 ...
[英]Asp.Versioning.Http AmbiguousMatchException: The request matched multiple endpoints on controllers
我正在嘗試使用 Asp.Versioning.Http package 版本 6.4.0 在我的控制器上實現基於 header 的版本控制它應該在這里非常簡單但是我得到AmbiguousMatchException: The request matched multiple endpoints ex ...
[英]I wrote the delete method according to the Laravel documentation, but the data is not deleted
Employees.php 文件 EmployeesController.php employees.blade.php 文件 route.php 文件 我清除了緩存,但不知道問題出在哪里。 看來我正確地寫了 function ps 版本 Laravel 9 mySQL 8 phpMyAd ...
[英]Routes are declared in routes.yaml but symfony don't found them. Even when i try using annotations
我有一個 symfony 應用程序忽略了我可以聲明的 roytes。 例如,我在routes.yaml中有這行代碼:app_titi path: /titi methods: ['GET'] defaults: _controller: 'App\Contro ...
[英]ErrorException Undefined variable | Laravel , php
我是 Laravel 的新用戶。 我在向視圖頁面顯示數據時遇到此錯誤: Laravel 給我解決方案: 這是 iku.blade.php 中的代碼: 這是 IkuController.php 中的代碼 這是 web.php iku.blade.php 文件似乎無法訪問 IkuControlle ...
[英]LateInitializationError: Field 'controller' has not been initialized
我在 SideBarWidget() 中使用SideBar()小部件並在我的主屏幕SideBarScreen() SideBarWidget()使用它,但我無法在Sidebar()小部件中初始化controller ...我該如何解決這個問題側邊欄_屏幕 側邊欄控件 側邊欄 這給出了錯誤LateIn ...
[英]code error when creating controller in laravel
在 laravel 中創建 controller 時出現代碼錯誤php artisan make:Controller KmsController 運行時異常無法檢測應用程序命名空間。 照亮\控制台\GeneratorCommand::rootNamespace() 我試過了: composer d ...
[英]Getx controller not found even after Get.put() | Flutter | Getx
即使在進入屏幕之前我有 Get.put() 之后也會出現此錯誤。 任何的想法? ...
[英]Laravel throwing "Function () does not exist" with method ->controller() on routes
我這里有這條路由: 問題是路由無法“找到”controller,我嘗試了很多不同的方法來解決這個問題,我找到了很多關於這個問題的信息,但沒有一個能幫助我解決問題,要么我得到"Function () does not exist"或"Target class [App\\Http\\Controll ...
[英]I am exporting PDF from HTML using Baryryvdh/laravel-snappy it's working but zooming out the pdf file
我正在使用 windows 機器使用 barryvdh/laravel-snappy。 這是我在 controller 中的代碼: 問題是文件創建的 a4 尺寸很小,如給定的屏幕截圖所示: ...
[英]How can I add CancellationToken to my Controller?
我知道,這里有很多關於 CancellationToken 的答案,但是對於我的問題,我還沒有找到任何解決方案。 我只想在用戶開始新呼叫時取消此呼叫: 我發現了類似的東西,但我不知道 cancellationToken 來自哪里以及我必須從這里傳遞它的地方: 最好的祝福, 邁克爾我已經嘗試添加 c ...
[英]The return of string value is null or empty when I call the function using GetX in flutter
我想調用字符串 function,我在運行應用程序時使用package_info_plus獲取 packageName,就像這樣: 當我嘗試在 Image.asset() 中調用RxString two時 它顯示 null 值,我有什么辦法可以在條件情況下使用 packageName 值,然后在Im ...
[英]Using flutter GetX controller for setState()
我想調用我的controller中字符串的值,這里是我的controller: 我想在我的小部件中調用 function setImage() ,但調用后出現問題,您可以在此處查看: [Get] 檢測到 GetX 的不當使用。 您應該只對將要更新的特定小部件使用 GetX 或 Obx。 如果您看 ...
[英]Best practice for controller method returns based on prefix
在web.php中,我有兩條路線,一條用於管理員,另一條用於用戶,如下所示Route::prefix('admin')->group(function () { Route::get('', [AdminController::class, 'index'])->name('ad ...
[英]How do I rename a pdf, upload it and open it in another browser tap?
我在 laravel 中有一個項目,我必須在其中獲取一個 pdf 文件,重命名並將其保存在存儲中。 然后它應該重定向回來。 對於另一個 function,它應該在瀏覽器中的另一個點擊中顯示這個 pdf 文件。 我沒有收到錯誤,但它沒有保存我的文件 **這是 controller:** ...
[英]updateOrCreate - Laravel 8
剛開始學習Laravel,不知道怎么更新表中的數據。 這里有張桌子: 我想插入條目:machine_name + number_of_shifts。 同時,如果有 machine_name 記錄,那么必須為這條記錄更新 number_of_shifts 值。 或者,如果沒有記錄,則創建一個新的 ...
[英]make model , controller ,seeder,factory,migration in custom folder
有沒有辦法在自定義文件夾中創建 model 和所有其他類當我嘗試 我希望創造 等等僅在自定義文件夾(位置)中創建 model,但在主文件夾中創建 controller 和其他文件夾 ...