Ajax alert function is not working with laravel data

i am trying to alert when i click on edit button, but it is not working in table. Ajax Code: <script> $(function(){ var $datasearch=$(‘#datasearch’); $(‘#searchname’).on(‘keyup’, function(){ $.get(‘/teachers/search/’+$(this).val(), function(teachers){ $datasearch.empty(); for (var i=0; i<teachers.length; i++){ $datasearch.append(‘<tr>’ +'<td>’+teachers[i].efirst+'</td>’+ ‘<td>’+'<button class=”btn btn-primary alert”>edit</button>’+'</td>’ +'</tr>’); } }); }); }); </script> alert function: <script> $(document).ready(function(){ $(“.alert”).click(function() { alert(“clicked”); }); });…

mb_strpos() expects parameter 1 to be string, object given when querying 2 tables in Laravel

Ok, so I don’t know if this can be done, but I need to combine the results of 2 Where clauses from 2 tables into one variable. So far I have this working to query one table: $allCompanies = Products::where(‘category_id’, $id->id)->groupBy(‘company_id’)->get(); And this for the other: $companies = Company::where(‘visible’, 0)->get(); But is there any way…

Laravel – How to ensure that logged in user can only access his company data

I am developing a client portal application using Angular-7 as frontend and Laravel-5.8. I am using Larave Spatie for User Management. I have these three tables: CREATE TABLE `company` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `company_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `company_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;…

Laravel Project Port can’t access on Docker with Port

I have this configuration on my etc/httpd.conf <VirtualHost *:0207> DocumentRoot “/opt/lampp/htdocs/api_tk/public” ServerName localhost </VirtualHost> listen 0207 This is working on my local So I’m trying to implement this on my docker My Xampp dashboard can be accessible using this link ip 192.168.0.XX:3030 When this IP entered to the browser it redirects to xampp /dashboard where…

How to count the total of nested foreach in first row in laravel blade?

My data set and coding are listed below. [ { “color”:[ { “id”:1, “color”:”yellow” }, { “id”:2, “color”:”red” } ] }, { “color”:[ { “id”:3, “color”:”blue” }, { “id”:4, “color”:”green” } ] } ] @foreach ($items as $item) @foreach($item->color as $color) <p></p> @endforeach @endforeach What I want: yellow 1/4 red 2/4 blue 3/4 green 4/4…