According to the loop in the fertilizer I'm just showing the value of one of them! It must be equal to the amount of data ID code because I want it to update the Value Form I, how do I do?
And if there is another way to say thanks.
In principle I would like to use AJAX Edition
#foreach($category as $cat)
<tr>
<td id="destroy_"><a data-delete id="destroy" data-id="{{$cat->id}}" href="#"><span
class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></td>
<td id="update_"><a href="#" data-toggle="modal" data-target="#myModal"><span
class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></td>
<td>{{$cat->category}}
</td>
<th id="dataId" class="text-right">{{$cat->id}}</th>
</tr>
#endforeach
Related
I'm a beginner in mySQL database and html/css development,
I have a database which contain an "association" table and a "FinancialMaterial_assistance" table that contains every single association register, the received assistance, each with it's own id.
So my question is: how to filter and show in my list view every association with it's only own registration? (without showing registration of other association)
In my current listview , every association could see all the received assistance, without filtering or privacy and confidentiality of every one of them.
Thank you for help I will be grateful if you create or give my PHP code or condition. This is my code:
<?php
if(isset($_GET['search'])==false){
$sql="select * from don ORDER BY idSub ASC ";
$result=mysqli_query($con,$sql);
if($result){
$num = 1;
while($ass = mysqli_fetch_array($result)){
$idSub=$ass['idSub'];
$date=$ass['date'];
$nomDon=$ass['nomDon'];
$description=$ass['description'];
$quantite=$ass['quantite'];
$source=$ass['source'];
echo '
<tr>
<th scope="row">'.$num++.'</th>
<td>'.$date.'</td>
<td>'.$nomDon.'</td>
<td>'.$description.'</td>
<td>'.$quantite.'</td>
<td>'.$source.'</td>
<td><button class="btn btn-primary">
<i class="fa fa-pencil" aria-hidden="true"></i>
Edit
</button>
</td>
<td> <button class="btn" >
<i class="fa fa-trash-o" aria-hidden="true" red-color></i>
Delete
</button>
</td>
</tr>
';
} }
?>
by the way I didn't link tables yet
how to get data from table and pass it in controller in json format and get those data in view using angularjs
I want to get data from json encoded variable from controller and show it to view page using angularjs
view page using angularjs
<div class="card" ng-app = "myApp">
<table class="table table-hover" ng-controller = "menuController">
<thead>
<tr>
<th>Name</th>
<th>Parent menu</th>
<th>Order</th>
<th>Status</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat = "x in values">
<td>{{x.name}}</td>
<td>{{x.parent_name}}</td>
<td>{{x.orders}}</td>
<td>{{x.status}}</td>
<td class="text-right">
<button type="button" class="btn btn-icon-toggle"
data-toggle="tooltip" data-placement="top"
data-original-title="Edit row">
<i class="fa fa-pencil"></i>
</button>
<button type="button" class="btn btn-icon-toggle"
data-toggle="tooltip" data-placement="top"
data-original-title="Copy row">
<i class="fa fa-copy"></i>
</button>
<button type="button" class="btn btn-icon-toggle"
data-toggle="tooltip" data-placement="top"
data-original-title="Delete row">
<i class="fa fa-trash-o"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
var app = angular.module('myApp');
app.controller('menuController',function ($scope,$http) {
$scope.values = ["Milk", "Bread", "Cheese"];
});
PHP controller code
public function getmenu(){
$records=Menu::all();
return json_encode($records);
}
route code
Route::group(['prefix'=>'admin'],function(){
Route::get('/form','HomeController#form');
});
ErrorException (E_ERROR)
Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) (View:form.blade.php)
I think it might be because you are serving your view which contains the angular code with Laravel, and in the file form.blade.php you use the angular syntax, which is the same as the blade one.
To solve that, you can try to remove blade word from the view filename, so it would become form.php or (alternative way instead of modifying the filename) each time you have to print something with the JavaScript framework instead of blade, use: #{{ variableToPrint }}.
So for example, part of your loop would become:
<tr ng-repeat="x in values">
<td>#{{x.name}}</td>
<td>#{{x.parent_name}}</td>
<td>#{x.orders}}</td>
<td>#{{x.status}}</td>
<!-- ... -->
You get the error as blade uses the same syntax to evaluate and print values, so if you write: {{ x.name }} blade finds a string literal x which gets interpreted as a constant.
If you prefix the # sign, blade will recognize that as an instruction not to be parsed, but that needs to be left as it is, it would just remove the #, leaving you with the correct code for you JavaScript loop
I already get all the data from the database and displayed it on my vue component. But, how can I display specific data on the table?
Like if the results from the database contains a user type of 'SuperAdmin'
I wanted to filter it like don't display if you find data related 'SuperAdmin'
https://imgur.com/kwTziOG - Here is my output.
I have searched this kind of problem and nothings pops-up.
Say for example.
['Paul','paul#new.com',['Admin']
['Paul', 'paul#new.com', ['SuperAdmin']
I just want to display the first array. Since it doesn't have a user type of SuperAdmin.
<tr v-for="user in users.data" :key="user.id">
<td>{{user.id}}</td>
<td>{{user.name}}</td>
<td>{{user.email}}</td>
<td>{{user.type}}</td>
<td>{{user.created_at |myDate}}</td>
<td>
<a href="#" #click="editModal(user)">
<i class="fa fa-edit"></i>
</a>
/
<a href="#" #click="deleteUser(user.id)">
<i class="fa fa-trash red"></i>
</a>
</td>
</tr>
I just displayed all the data being fetch in the database. Just wanted it to filter it somehow.
I have not used Vue in alittle while but if I remember correctly you can just use 'v-if' and it will conditionally render the data. Below is an example of how this could be done.
Possible Solution
<tr v-for="user in users.data" :key="user.id">
<div v-if="user.type == 'SuperAdmin'">
<td>{{user.id}}</td>
<td>{{user.name}}</td>
<td>{{user.email}}</td>
<td>{{user.type}}</td>
<td>{{user.created_at |myDate}}</td>
<td>
<a href="#" #click="editModal(user)">
<i class="fa fa-edit"></i>
</a>
<a href="#" #click="deleteUser(user.id)">
<i class="fa fa-trash red"></i>
</a>
</td>
</div>
</tr>
Hope this answered your question, good luck!
i'm trying to create a table with some button, a, glyphicon, span etc... but it is dynamic and goes inside php text. The table and the dynamic variables are showed but when I add everythings die. This is my code:
$output .= '<tr> <td>
<span class="glyphicon glyphicon-pencil"></span>
<span class="glyphicon glyphicon-remove"></span>
</td> <td>'.$product["Title"].'</td>
<td>'.money($product["Price"]).'</td>
<td>'.$category.'</td>
<td>'.$row1["mobile"].'</td></tr> ';' }
I am trying to get all record which are available in my database table currently there are 3 records available with id 1,2 and 3 and i am only getting record related to id 1.
My Controller method:
public function EmailList()
{
$listing = Buyer::all();
return view('email-list',compact('listing'));
}
and my route:
$router->get('/List-of-Emails', 'AjaxController#EmailList');
and in my view i am passing foreach loop
#foreach($listing as $list)
<tr>
<input type="hidden" id="rwid" value="{{$list->id}}"/>
<td>
<input id="{{$list->id}}" class="checkbox-custom" name="{{$list->id}}" type="checkbox"
value="{{$list->id}}">
<label for="{{$list->id}}" class="checkbox-custom-label"></label>
</td>
<td>
<p data-placement="top" data-toggle="tooltip" title="" data-original-title="Tolltip">
{{$list->name}}
</p>
</td>
<td>
<a href="" class="pglst-lnk">
{{$list->email}}
</a>
</td>
<td>
{{$list->created_at}}
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
#endforeach
i am getting only first and only single record however i want to get all records from table where i am doing wrong.
Any help would be highly appreciated!
I think this is a DOM parsing error.
Can you put the #endforeach just below the closing </tr> tag?
#foreach($listing as $list)
<tr>
<!-- data -->
</tr>
#endforeach
EDIT: Explanation
For those interested: the browser is incapable of parsing the HTML as given by OP. This is because after one record, he closes the table and a couple of divs. Then the foreach-loop starts again, in which he suddenly introduces new <tr>s and is closing <table>s and <div>s that don't exist. It will probably put an error message in the console, but not everybody looks there as it's not directly obvious that the outputted HTML is wrong.
Use Some query like
$user = DB::table('users')->where('name', 'John')->orderby('id','desc')->limit('the record you want')->first();