I need to find vueJs component/template file in laravel application - php

I am working on laravel application and trying to find where from these following variables are coming so that I would customize them; As I have searched and found that these variables are coming from vueJs component file, and could not find this vueJs file as I have searched whole application's file and I have zero knowledge in vueJs. Is vueJs file is also embedded in head or before body tag as we put css and js files? please help me.
<div class="row align-items-center" v-cloak>
<div :class="item.pulse"></div>
<div class="col ml--2">
<small> #{{ item.last_status }}</small><br />
<small> #{{ item.time }}</small>
<h4 class="mb-0">
#{{ item.id }} #{{ item.restaurant_name }}
</h4>
<small>#{{ item.client }}</small><br />
<small>#{{ item.price }}</small><br />
</div>
<div class="col-auto">
<a class="btn btn-sm btn-primary" :href="item.link">{{ __('Details')}}</a>
</div>
</div>

Related

Change default pagination style in laravel

#extends('layouts.app')
#section('content')
<h4 style="text-align:center;">SHOES</h4>
#foreach($shoes as $list)
<div style="margin-top: 40px">
<div class="row d-flex justify-content-md-center">
<div class="card" style="width: 22rem;">
<img class="card-img-top justify-content-center" src="{{ asset("images/$list->shoe_image") }}" alt="" style="width:350px; height:350px;">
{{-- bg-card-pink p-2 m-2 --}}
<div class="card-body">
<h1>{{ $list->shoe_name }}</h1><br>
<h6>{{ $list->shoe_description }}</h6><br>
${{ $list->shoe_price }}<br>
</div>
<a class="btn btn-primary btn-dark" href="/detail/{{ $list->id }}">
SEE DETAILS
</a>
</div>
</div>
</div>
#endforeach
<div class="row d-flex justify-content-md-center mt-4">{{ $shoes->links() }}</div>
#endsection
Anybody had any idea changing the color/style of the pagination button on the blade?
I use default pagination by laravel which is $shoes->links()
You can customize default pagination by exporting pagination files from vendor folder to resources.
To export run in terminal: php artisan vendor:publish --tag=laravel-pagination
See Laravel Docs

how to add button on .php file by editing it

{!! view_render_event('bagisto.shop.layout.header.account-item.before') !!}
<login-header></login-header>
{!! view_render_event('bagisto.shop.layout.header.account-item.after') !!}
<script type="text/x-template" id="login-header-template">
<div class="dropdown">
<div id="account">
<div class="welcome-content pull-right" #click="togglePopup">
<i class="material-icons align-vertical-top">perm_identity</i>
<span class="text-center">
#guest('customer')
{{ __('velocity::app.header.welcome-message', ['customer_name' => trans('velocity::app.header.guest')]) }}!
#endguest
#auth('customer')
{{ __('velocity::app.header.welcome-message', ['customer_name' => auth()->guard('customer')->user()->first_name]) }}
#endauth
</span>
<span class="select-icon rango-arrow-down"></span>
</div>
</div>
<div class="account-modal sensitive-modal hide mt5">
<!--Content-->
#guest('customer')
<div class="modal-content">
<!--Header-->
<div class="modal-header no-border pb0">
<label class="fs18 grey">{{ __('shop::app.header.title') }}</label>
<button type="button" class="close disable-box-shadow" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" class="white-text fs20" #click="togglePopup">×</span>
</button>
</div>
<!--Body-->
<div class="pl10 fs14">
<p>{{ __('shop::app.header.dropdown-text') }}</p>
</div>
<!--Footer-->
<div class="modal-footer">
<div>
<a href="{{ route('customer.session.index') }}">
<button
type="button"
class="theme-btn fs14 fw6">
{{ __('shop::app.header.sign-in') }}
</button>
</a>
</div>
<div>
<a href="{{ route('customer.register.index') }}">
<button
type="button"
class="theme-btn fs14 fw6">
{{ __('shop::app.header.sign-up') }}
</button>
</a>
</div>
</div>
</div>
#endguest
#auth('customer')
<div class="modal-content customer-options">
<div class="customer-session">
<label class="">
{{ auth()->guard('customer')->user()->first_name }}
</label>
</div>
<ul type="none">
<li>
{{ __('shop::app.header.profile') }}
</li>
<li>
{{ __('velocity::app.shop.general.orders') }}
</li>
<li>
{{ __('shop::app.header.wishlist') }}
</li>
<li>
{{ __('velocity::app.customer.compare.text') }}
</li>
<li>
{{ __('shop::app.header.logout') }}
</li>
</ul>
</div>
#endauth
<!--/.Content-->
</div>
</div>
</script>
#push('scripts')
<script type="text/javascript">
Vue.component('login-header', {
template: '#login-header-template',
methods: {
togglePopup: function (event) {
let accountModal = this.$el.querySelector('.account-modal');
let modal = $('#cart-modal-content')[0];
if (modal)
modal.classList.add('hide');
accountModal.classList.toggle('hide');
event.stopPropagation();
}
}
})
</script>
#endpush
I have a php file for creating login page
it look like this page view
how to add a new login button like login with google by editing in it.
Please be detail while giving your answer, it is very helpful for those who are new in php.
It is better to provide general answers that is helpful for those who are working in other domain related to php.
This code belong to bagisto framework which is base on laravel.Bagisto is greate framework for creating ecommerce sites.
This is the repo of bagisto https://github.com/bagisto/bagisto.git
I am new to stackoverflow so feel free to improve my question for more clarity friends if need.
We have added social login in our master branch, you may take a pull from there. Below is the provided PR link
https://github.com/bagisto/bagisto/pull/3367
PS - as the user asked the questions regarding the platform bagisto that's why I am answering for that purpose.

Forelse loop inside a <div> tag

I'm trying to make a container with a list of images and attributes, but when I add a tag around the array, the array simply go outside my container, I had searched this type of question but didn't find it.
This is the code:
#if(count($elitePublications) > 0)
<div style="border:2px gold solid">
#forelse($elitePublications as $key => $publication)
#include('publications.small', compact('publication'))
#empty
<p></p>
#endforelse
</div>
#endif
It only make the container but the list is outside
The code of publications.small:
<div class="col-sm-4 book">
<a href="{{ route('users.publications.show', ['publications'=>$publication->id, 'users'=>$publication->user->username]) }}">
<div class="book-cover">
{{ $publication->image }}
<div class="inner-book-content">
<h4>{{ $publication->published_book_title }}</h4>
<strong class="book-price">
</strong>
</div>
</div>
</a>
</div>
Thanks in advance.
The issue here is about Bootstrap. Some kind of problem with the columns and the rows (who guest the results), so I just added a class in my div called "row" it act as a container for my array.
Like:
<div class="row">
<h4 style="font-style: italic;"> Recomendados </h4>
#forelse($elitePublications as $key => $publication)
#include('publications.small', compact('publication'))
#empty
#endforelse
</div>

MethodNotAllowedHttpException not found when I paginate in Laravel

Hello this is my first question here.
I am using php laravel framework and I am getting this error
MethodNotAllowedHttpException in RouteCollection.php line 233:
This error comes when I go to second page of the result list.
My controller code.
public function find_product(Request $request)
{
$search = trim($request->product);
$products = Store_product::(query-for-products-working)
->paginate(1);
return view('fc.product',compact('products','search'));
}
My web.php code
Route::post('/product', 'FlashCartController#find_product');
My view code
#foreach($products as $product)
<div class="fc-col">
<div class="panel panel-primary">
<div class="panel-heading fc-col-head"><div class="marquee">{{ $product->product_name }}</div></div>
<div class="panel-body fc-col-body">
<img src="{{ image_check('uploads/store/products/',$product->product_image1,'uploads/service/') }}" class="img-responsive" style="width:100%; height: 100%;" alt="{{ $product->product_name }}" />
</div>
<div class="panel-footer fc-col-footer">
<span class="price">Rs.
{{
price_check($product->product_discount, $product->product_price, $product->sale_id, $product->discount)
}}/-
</span>
</div>
</div>
</div>
#endforeach
<div>
{{ $products->links() }}
</div>
and the form
<form action="/product" method="POST">
{{ csrf_field() }}
<div class="input-group container">
<input type="text" name="product" class="form-control" value="{{$search}}" placeholder="Enter product name" />
<div class="input-group-btn">
<input type="submit" class="btn btn-danger" value="Search" />
</div>
</div>
</form>
Why my method is not allowed. And if this is not the method to use what should I do?
Can anyone help me with this please? :(
Okay so your problem as I understand it is that when you paginate to the next page the url becomes empty and no results are shown.
In your view you have this line:
{{ $products->links() }}
Which shows that whatever your url is at the moment, just ignore it and add pagination to it.
That means if your url is like www.abc.com?product=graphics it will ignore product and only add www.abc.com?page=1,2,... Of course your page will be blank.
Instead use this:
{{ $products->appends(request()->input())->links() }}
Now it tells the system to add pagination but append variables to it too. What variables? The variables that are appended on the url already.
Hope it helps

Symfony2 accessing values in base html

I have a dynamic menu and in the top right corner I want to dinamically display the number of products I have in my cart. All my twigs extend base.html.twig in which I have this dynamic menu.
<div id="mainBody" class="container">
<header id="header">
<div class="row">
<div class="span12">
<img src="{{ asset('bundles/mpshop/img/logo_title.png') }}" alt="Bootsshop"/>
<div class="pull-right"> <br/>
<span class="btn btn-mini btn-warning"> <i class="icon-shopping-cart icon-white"></i> [ {{ cart|length }} ] </span>
<span class="btn btn-mini active">$155.00</span>
<span class="btn btn-mini">£</span>
<span class="btn btn-mini">€</span>
</div>
</div>
</div>
However when I add {{ cart|length }} I am getting variable cart does not exist. Does base.html.twig has its own controller? How to give the base twig the cart with session so it could see my array?
One way to do this is create a helper class and include a method from that class in the menu (navbar?)
To do this you can make a regular Controller called for example HelperController.php then create a method within that new controller, like shownumberofproductsAction and then create a corresponding view file: shownumberofproducts.html.twig
Then in your top right menu simply call:
{% render controller("MySomethingBundle:Helper:shownumberofproducts") %}

Categories