Delete from laravel list - laravel

i am trying to create a delete and edit button so that i can data from list. please hel how i can do it. in laravel 5.4.Below is the interface of the application and the buttons codes. help on how the edit and delete will work.
<td><a class="btn btn-primary btn-sm" href="#">
<i class="fa fa-pencil-square-o fa-lg" aria-hidden="true"></i> Edit</a> <!-- </td> -->
<!-- <td> --><a class="btn btn-danger btn-sm" href="{{route('contacts.index', $contacts->id)}}" onclick="return confirm('Are you sure to delete the contact');">
<i class="fa fa-trash-o fa-lg" aria-hidden="true"></i> Delete</a></td>
</tr>
enter image description here

Related

Undefined offset: 2 (View: C:\inetpub\wwwroot\SHDEPHA Portal\resources\views\travel_requests\form.blade.php) on Laravel

Below is my blade codes, the error shows thats its caused by line 307 of the codes.
#endwhile
#endif
Total Request
</table>
<div class="text-center {{$visibility}}">
<button class="btn btn-secondary btn-s add_row_after">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use plus"></i>
Add Row After
</button>
<button class="btn btn-secondary btn-s add_row_before">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use plus"></i>
Add Row Before
</button>
<button class="btn btn-secondary btn-s remove_row">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use minus"></i>
Remove Line
</button>
</div>

ASP.net core find model.primary_key_field_name in custom scaffolding

I have an asp.net core MVC project I am creating custom scaffolding template files
I am following this answer to add custom scaffolding template pages
on Details page I want o add link to Listing, Edit and Delete page as below
#using System.Linq
##model #Model.ViewDataTypeName
#: <div class="card-body py-2">
#: <a asp-action="Delete" asp-route-id="##Model.pkName" class="float-right btn-floating btn-sm btn-danger m-0" title="Delete #Model.ViewDataTypeShortName Record"><i class="fa fa-trash"></i></a>
#: <a asp-action="Edit" asp-route-id="##Model.pkName" class="float-right btn-floating btn-sm btn-warning m-0 mr-2" title="Edit #Model.ViewDataTypeShortName Record"><i class="fa fa-edit"></i></a>
#: <a asp-action="Index" class="float-right btn-floating btn-sm btn-info m-0 mr-2" title="Back to #Model.ViewDataTypeShortName listing page"><i class="fa fa-arrow-left"></i></a>
#: <h4 class="mb-2 mb-sm-0 pt-1">#Model.ViewDataTypeShortName Details</h4>
#: </div>
Notice asp-route-id="##Model.pkName" in above example, Actualloy here I need to put primaryKey field name dynamically, ##Model.pkName is not a valid property but I just wanted to show something here.

How to add number_format decimal in laravel in html view?

does anyone know how to add the decimal number_format here?, I don't use the blade from Laravel but I route the view directly to html... so if I add the number_format attribute, I'm confused ;(
<tr dir-paginate="income in incomes | filter:searchText | itemsPerPage:20" total-items="totalItems">
<td>{{income.incomeTitle}}</td>
<td>{{income_cat[income.incomeCategory]}}</td>
<td>Rp.{{income.incomeAmount}}</td>
<td>{{income.incomeDate}}</td>
<td>{{income.incomeNotes}}</td>
<td>
<a ng-show="income.incomeImage != ''" target="_blank" href="{{'index.php/incomes/download/'+income.id}}"><button type="button" class="btn btn-success btn-circle" title="{{phrase.Download}}" tooltip><i class="fa fa-cloud-download"></i></button></a>
<button ng-show="$root.can('Incomes.editIncome')" ng-click="edit(income.id)" type="button" class="btn btn-info btn-circle" title="{{phrase.Edit}}" tooltip><i class="fa fa-pencil"></i></button>
<button ng-show="$root.can('Incomes.delIncome')" ng-click="remove(income,$index)" type="button" class="btn btn-danger btn-circle" title="{{phrase.Remove}}" tooltip><i class="fa fa-trash-o"></i></button>
</td>
</tr>

laravel vue js can't find data ID

this is my category component
<tr v-for="(categoryList, index) in getCategoryList" :key="categoryList.id">
<td>{{index+1}}</td>
<td>{{categoryList.cat_name}}</td>
<td>
<div class="">
<router-link :to ="'/editCategory/${categoryList.id}'" class="btn btn-sm btn-success"><i class="fa fa-edit"></i></router-link>
<router-link to="" class="btn btn-sm btn-danger"><i class="fa fa-trash"></i></router-link>
</div>
</td>
</tr>
may router
import categoryedit from './components/admin/category/edit.vue';
export const routes = [
{
path: '/editCategory/:categoryId',
component: categoryedit
}
attach file
enter image description here
how to find category id ?
Set router-link as:
<router-link :to ="'/editCategory/'+categoryList.id" class="btn btn-sm btn-success"><i class="fa fa-edit"></i></router-link>

How to show the total number with Laravel Simple pagination?

I made simple paging with the collection macro to paginate the data in the series. How can I use simple paging result-> total () is not used? I want to do it briefly like gmaila. It has 1-50 / 200 <> style.
<div class="btn-group">
<a href="{{ $dataArray->previousPageUrl() }}">
<button type="button" class="btn btn-default btn-sm">
<i class="fas fa-chevron-left"></i>
</button>
</a>
<a href="{{ $dataArray->nextPageUrl() }}">
<button type="button" class="btn btn-default btn-sm">
<i class="fas fa-chevron-right"></i>
</button>
</a>
</div>
To have a pagination text similar to that of Gmail you can do this:
{{($items->currentPage() - 1) * $items->perPage() + 1 . '-' . $items->currentPage() * $items->perPage() . ' of ' . $items->total()}}
You can enter the code where you prefer in your view.

Resources