I just learning laravel and got this error calling array on route class using foreach but i got error (undefined index) Answer You’re using the wrong variable within the foreach scope. use $post[“title”] instead of $posts[“title”]
Tag: laravel
Should Controller Layer cannot use Repository Layer?
I’m confused about Controller use Repository directly. Is it Repository layer must encapsulated by Service layer? I’m using like this now in Laravel: Is is Bad to use Repository Layer directly from Controller Layer? Answer Note: In regard of MVC-based applications, this answer is a general one. It does not refer to Laravel, in particular. The controller: In a proper
I am fetching data of user where role equals to teacher , status is active and other orWhere. This collection gives me super admin user also but why?
I am working on search. I am facing issue with the query. when ever i search super. It gives me super admin user also but i am using ->whereRelation(‘role’,’name’, ‘teacher’) Answer that because if any orWhere come with true, the record will be fetched, you should group your orWhere in one statment:
routes/web route me to another route
My web doesn’t seem to be directing to the correct page. Here is my blade Here is my routes/web and here is my controller For some reason, when I click the a tag with the href {{ route(‘add-new-information’) }} to go to the add page ‘adminviews/addinfo’, instead the page will go to the ‘adminviews/infoadmin’ page, which will cause an error,
mPDF how to leave all content on a single page
I want to export an HTML to pdf using mPDF, but I want everything to be on a single page, without any page breaks. How can I do that? Answer “mPDF has limited scope to control when automatic page-breaks occur, and does not have ‘widows’ or ‘orphans’ protection.” https://mpdf.github.io/paging/page-breaks.html
PHP How to orderby two columns when the data is equal
This return come from this query. Let`s understand my doubt, i have this data. When i have the equal points data 0 is 120 and data 1 is 120. I need to display the first data with less totalTime in this case needs to be like this : Can i manage this only with SQL or i need to order
Authenticate users from more than two tables in laravel 8 api
As I know Auth::attempt is used to authenticate users from users table, but i want to authenticate another users from students table and teachers from teachers table. How to create multiple authentication for different users? I’m new in laravel api’s Answer I think there’s much stuff on the net, but may this could be useful for you: I’ve written medium
Is the other way to use Vue component in Laravel?
I have a Laravel project and I would like to integrate Vue. I’m not getting any error bu the Vue components just not loading up. I guess I’m making somekind of logical mistake if I’m not getting an error. index.blade.php: App.js: routes.js: audit/index.vue: Answer Have you added configuration in the webpack file for Vue components? Refer Laravel Mix Vue The
Hide block in if condition
I’m a beginner I want to make a condition under which we either hide the block or leave it, I did it and everything works But I am planning to add a few more blocks and everything will look like this, there will be a lot of code copying Can I do it somehow shorter so as not to copy
SSL Error for Sentry v2.10 with Laravel 6.20.27 (PHP v7.4.19)
I am using sentry (version 2.10) with Laravel v6.20.27 and PHP v7.4.19. I follow the same steps mentioned in the documentation (https://docs.sentry.io/platforms/php/guides/laravel/other-versions/laravel5-6/). However I am not able to proceed as I am getting the below error Please help me to solve this issue. Answer I faced the same issue on my local. I’m using Laragon on Windows. I downloaded a