![](/img/trans.png)
[英]Returning Pivot table data in Laravel 9 Resource (Building an API)
我正在嘗試在 Laravel 9 中構建一個 API 並想要來自 pivot 表的數據。 我想檢索所有實例,無論它們是否分配了會話,並在相關位置顯示會話。 我目前有一個實例表和一個會話表 - 每個實例可以有多個會話,每個 session 可以屬於多個案例。 實例 Model Session Mo ...
[英]Returning Pivot table data in Laravel 9 Resource (Building an API)
我正在嘗試在 Laravel 9 中構建一個 API 並想要來自 pivot 表的數據。 我想檢索所有實例,無論它們是否分配了會話,並在相關位置顯示會話。 我目前有一個實例表和一個會話表 - 每個實例可以有多個會話,每個 session 可以屬於多個案例。 實例 Model Session Mo ...
[英]Converting Laravel "return view($this->theme" to return Json data
我買了這個 Codecanyon WebApp 項目,我想使用 API 開發同一系統的移動版本(flutter 和 Dart),只是為了讓我意識到沒有 API 我可以使用 Flutter 和 dart 為移動應用程序集成這些功能。 ..下面的一些代碼 api.php web.php(因為文件很長, ...
[英]Data is not stored in database eventhough API successfully passed in postman
我正在嘗試從前端(flutter)通過 API 存儲歷史數據。 下面是laravel中的controller。當我在postman中運行我的代碼時,它應該可以工作,因為當我發送請求時確實出現了消息“suksess add data”並且date_checkIn,time_checkIn都被記錄在這里 ...
[英]Laravel appended attribute blocking AJAX query
我有一個叫 OrdenesTrabajo 的 model。 我有一個名為“show_personal”的附加字段,如下所示: 當在重定向到視圖的 Controller 中使用時,附加字段不會導致任何問題。 但是當我必須使用 AJAX 調用 controller 操作來咨詢 OrdenesTrabaj ...
[英]Laravel api page number 2 and above of pagination issue
我正在嘗試自定義 laravel 分頁來解決此問題: 我希望結果是這樣的: 當我使用整個集合時效果很好,但是如果使用(where)獲取集合的一部分,這個問題就會出現在我身上。 這個即將到來的代碼腳本已經在 AppServiceProvider 啟動方法中使用了: ...
[英]how to get data from external API to datatable with using Laravel
錯誤異常為 foreach() 提供的參數無效(視圖:D:\Projects\Laravel\Laravel-api\resources\views\new.blade.php) Controller 如何從外部 API 中檢索數據到 Laravel 中的數據表 17 ...
[英]Laravel collection result format change got so many errors to the following format
我在這里使用 Laravel php Api 來獲取數據並傳輸到 angular 項目。需要幫助格式化 laravel 集合。是否可以這樣做? 當前 Output: 輸入:- 預計 output;- ...
[英]How to Generate unique usernames using Laravel
我正在嘗試在使用 laravel 注冊時為用戶生成唯一的用戶名。我想包括名字和姓氏。 如果我只使用名字或姓氏,它會起作用,但如果我同時嘗試兩者,它會向數據庫輸入一個空白值。 請幫忙。 這是我的代碼:Auth Controller ` ` 用戶 Model ` ` ...
[英]All requests ends up in GET route. Laravel
我有一個 Laravel(8.83) 應用程序。 API 路由總是以GET請求結束。 為了檢查問題,我刪除了除一條以外的所有路線。 現在我只有一條路線: 盡管我在 postman 上發出PUT請求,但結果是: "The GET method is not supported for this r ...
[英]Generate both access and refresh tokens in Laravel login
我正在嘗試使用護照在 laravel 中實施身份驗證。 一旦用戶登錄,我需要創建一個新的 accessToken 和 refreshToken。現在,按照 Laravel 的文檔,它可以像這樣 donde: 這里的解決方法是創建一個 API 端點,該端點基本上會獲取用戶的憑據並將它們與其他所需數據一 ...
[英]bol.com api integration with laravel I need to get product details
這是已使用的鏈接 https://api.bol.com/retailer/public/Retailer-API/index.html 我必須獲取訂單詳細信息和帶有報價的單個訂單,但我需要獲取帶有圖像的產品詳細信息。 我已經閱讀了所有文檔並理解了這一點。 我只需要產品的 get API,而不是 p ...
[英]Logic to check current session if it has future session then disable button
您好,我有父表和子表會話。 我用它來創建學生時間表。 這是關系 在我的 Session Model 我有這個屬性來刪除 session 記錄。 當未來 session 出現在條款頁面時。 不允許刪除內部 session 頁面。 示例:當前 session 為 8 月至 9 月未來的 session ...
[英]Failed asserting that a row in the table student.sections matches the attributes
您好,我是 PHPUnit 的新手,對 laravel 的了解最少。 我試圖測試這種大規模創建學生部分的方法 更新這是測試用例。 我試圖將我修改的方法與我的測試相匹配,但我沒有這樣做。 更新這是我得到的錯誤。 仍然無法匹配。 我不知道我做錯了什么。 ...
[英]Observer not running when creating in database
你好我有這種批量創建學生部分的方法注冊 controller 方法此代碼工作正常,但它沒有進入我的 studentSectionObserver。 盡管使用 for 循環將其一一保存。 然后我 output 這個活動與 studentSectionObserver 並添加了 log::info 但它 ...
[英]Illuminate\Database\Eloquent\Relations\HasOne::$section_id
我有一個觀察者,我想要 output 消息,只要注冊中有部分。 我不確定這是否足夠的信息。 請不要猶豫,要求我提供更多。 更新的數據庫架構 但這給了我未定義屬性的錯誤 這是我的入學關系 這是我在App\Models\Student\Section中的學生部分 ...
[英]Model observer is not triggering while updating
我在嘗試使用觀察者時遇到一個問題,即它不會僅在更新的情況下觸發觀察者。 它在其他情況下工作正常。 我對此進行了一些研究,並找到了一些解決方案,但不幸的是,它對我不起作用。 因為它沒有達到我觀察者的更新。 調度觀察者。 我在我的 controller 中調用了更新方法,如下所示: 觀察者提供者 但只有 ...
[英]Show message if observer receives data from api - Laravel
我有一個名為審計跟蹤的頁面,它記錄用戶活動 這是我使用的 api。 這是 controller 中的 dropSchedules 方法 在這里,我的關系模型student和schedule有很多student schedule student schedule model: student mode ...
[英]Get sex from table then groupby to current date filter with academic level
我對 laravel 關系和 eloquent 很陌生。 我想按性別和學術水平計算今天日期和分組的注冊學生總數。 這是我的 api。 這是我的注冊 model。 關系 hasMany ,學生、專業、學術水平與招生有很多關系。 這是我的學術水平表 這是我想要實現的目標的說明。 編輯: 我在 cont ...
[英]Laravel 9: Implicit model binding not working on nested one-to-many relationship
我在使用 Laravel 的隱式 model 綁定時遇到問題,該綁定使用嵌套路由和自定義鍵(不是 ID)。 我有這些示例模型: 類別(遷移): 帖子(遷移): 關系是一對多的: 帖子有一個類別。 一個類別可以有多個帖子(具有相同類別的帖子)。 model 類如: 和 我正在使用這些路由來創建類別/ ...
[英]exists validation is not working in laravel
登錄控制器 我正在創建一個登錄 API。 所以,如果用戶或管理員輸入錯誤的電子郵件和密碼,我想顯示電子郵件錯誤和密碼錯誤。 在這里,當我輸入正確的電子郵件和錯誤的密碼時,它只顯示密碼錯誤錯誤,這是可以的,但是當我輸入錯誤的電子郵件和正確的密碼時,它會顯示兩條錯誤消息,即電子郵件錯誤和密碼錯誤。 ...