I want to make a cell’s data different in each row of the same column, according to the value of the $row[‘epilogh’]: So let’s say that if $row[‘epilogh’] is ‘A’ I want a form so a file could be uploaded. On the other hand when $row[‘epilogh’] is …
Simple regex on string
I’m working on a simple mention system and in my PHP script and I need to extract client:6 from the larger text where one or more @mention like @[John Doe (#6)](client:6) will be present. Ex. This is my text how do you like it @John and do you have any thoughts @Jane In php the string will look like. an…
Code Executing on Page Load instead of OnClick
I have a code that gets executed on page load twice, despite adding the code to the ‘Click’ command. I have placed the code ‘alert(“Testing”);’ within the portion of the code pertaining to ‘click(function(evt)’ – grateful if someone can advise if I misunderstood the f…
Is mass assignment protection needed when properly using validation?
I’ve been using Laravel (5.4) and PHP both for the very first time in a legacy app I’ve been tasked to maintain, and over the past couple of months I have noticed a pain point, which is mass assignment. I believe I have a well-enough grasp of what is is, but I am not sure if I am really utilizing
Accessing php variable from within function scope
I have this code in a codeigniter controller that’s the beginnings of a pagination/sorting feature for a table in the view. I’m passing order_by as a query parameter and then this is part of the controller action: The problem is…I keep getting the error Undefined variable: order_by. Since I&…
Undefined Index Array
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”]
For some reason. IF statement is working….Ive tried If/else with no luck either [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 7 m…
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…
User Redirection accordingly an enum input. PHP code
I’m trying to redirect the logged-in user to a different page according to the enum input was stored at db. I was trying those lines, but it always redirects me at pro.php. How can I do this with the right way? What is the issue with the code? Here is my table definition: # Name Type Null Default 1 id
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 …