How to add number_format decimal in laravel in html view? - laravel-5

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>

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>

Submit Button not getting correct route to add new data in Laravel

I am facing problem for Submit Button not getting correct route to add new data.
2 Blade file with 2 Submit Button which need to save 2 data to 2 different tables.
Problem facing - Data submitted in 1 table for both submit button....
addnewBuffalo.blade.php
<div class="box-header with-border" align="right">
<button type="submit" class="btn btn-success btn"><i class="fa fa-floppy-o"></i> <b>Add
Buffalo</b></button><a href="" class="btn btn-warning btn"><i class="fa fa-refresh">
</i> <b> Refresh</b></a>
</div>
addnewcow.blade.php
<div class="box-header with-border" align="right">
<button type="submit" class="btn btn-success btn"><i class="fa fa-floppy-o"></i> <b>Add
Cow</b></button><a href="" class="btn btn-warning btn"><i class="fa fa-refresh"></i> <b>
Refresh</b></a>
</div>
web.php
Route:: post('submit', 'App\Http\Controllers\addnewbuffaloController#addbuffaloData')
->name('submit');
Route:: post('submit', 'App\Http\Controllers\addnewcowController#addcowData')
->name('submit');
You need to create 2 separate Route Names. Having ->name('submit') for both won't work. And having the same path won't work
Route::post('submit=buffalo', 'App\Http\Controllers\addnewbuffaloController#addbuffaloData')
->name('submit-buffalo');
Route::post('submit-cow', 'App\Http\Controllers\addnewcowController#addcowData')
->name('submit-cow');
Or if the form is wrapped by one form tag then you can handle both submissions in the one Controller action
<button type="submit" name="buffalo-submission">Save Buffalo</button>
<button type="submit" name="cow-submission">Save Cow</button>
Then in the controller action code you could check
if ($request->has('buffalo-submission') {
Do buffalo code
} else if ($request->has('cow-submission')) {
do cow code
}

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 make two If condition in laravel

Two conditions I want to apply for a button that will show the application when applied and if the user has a login then the button will show and ask to login.
Blade
#if (Auth::check())
#if ($tuitionJob->checkApply())
<form action="{{url('/tuition/apply')}}" method="POST">
#csrf
<input type="hidden" value="{{$tuitionJob->id}}" name="tuitionid">
<button type="submit" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
Apply <i class="fa fa-send"></i>
</button>
</form>
#else
<a href="/login" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
<i class="fa fa-send"></i>
Login For Apply
</a>
#else
<a href="tuition/job" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
<i class="fa fa-send"></i>
Applied
</a>
#endif
#endif
Model
public function checkApply(){
return \DB::table('tuition_applies')->where('users_id', auth()->user()->id)
->where('tuition_post_id', $this->id)->exists();
}
Try && Logical Operator
#if(Auth::check() && $tuitionJob->checkApply())
//Code
#else
//Code
#endif
May be helpful for you
#if (Auth::check())
#if ($tuitionJob->checkApply())
<form action="{{url('/tuition/apply')}}" method="POST">
#csrf
<input type="hidden" value="{{$tuitionJob->id}}" name="tuitionid">
<button type="submit" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
Apply <i class="fa fa-send"></i>
</button>
</form>
#else
<a href="/login" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
<i class="fa fa-send"></i>
Login For Apply
</a>
#endif
#else
<a href="tuition/job" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
<i class="fa fa-send"></i>
Applied
</a>
#endif
Try this

Delete from laravel list

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

Resources