Laravel 8 Livewire wire:click:prevent Not Working - laravel

Please Someone please I am in the middle of my final year project but this is not working I am trying for 3 days I am new so I don't know how to ask a question so if you need something please ask me Thanks
This is the view for Shop and i have used Composer require Hardevine/shoppingcart
This is the ShopComponent for Shop

When I ran Laravel 8 on IIS, I had a similar problem. The problem was that the browser couldn't access some of the livewire js files, and the solution was:
Go to D:\Projects\Laravel\laravel8ecommerce\vendor\livewire\livewire\config\livewire.php
and set
'asset_url' => "your_url",
and the problem was disappeared.

I had same problem. To solve this issue what I did was enclose my blade template files with a <div> containing an id="main" like so:
<div id="main">
your blade template code
<div>

Instead Of This
wire:click:prevent=“store({{$product->id}},’{{$product->name}}’,{{$product->regular_price}})”
You need to use this in your blade file
#livewireStyles
your code will be in this area
#livewireScripts
Try This For Calling Store Function
wire:click.prevent="store({{$product->id}},{{$product->name}},{{$product->regular_price}})”
Or
wire:click="store({{$product->id}},{{$product->name}},{{$product->regular_price}})”

My solution was based on #KumTem answer
Inside the livewire blades located at app\resources\views\livewire\sample_blade.php
<div id="main">
... templates here
</div>

Related

I can not found blade from resources. But website working

#section('contents') <app-employee-list></app-employee-list> #endsection
How I can get the full html structure form this? I can not found full code. but website is working.
This maybe a vue component, you can find it in this path
resources/js/components
OR it may be a laravel component, you can find it in this path
resources/views/components

Handle content which contains laravel blade code in vuejs

#Asking
Help me for my problem,
I have blog content and it has syntax examples like {{ $title }} because my content describes laravel blade.
Problem
When I render my blog content on Vuejs everything goes wrong because there is a sytax blade {{ $title }}
Any solution to this problem?
please use below code
{{ $title }} - use for laravel blade
{{{$title}}} - use for Vue js in laravel blade page
if you want to bind both please try with below code
In script tag
var title = '{{$title}}';
In Vue js CLI
data:return{ title:'{{$title}}' }
If you still getting a problem, then please brief all about your problem with the code I will resolve it.
I try to parse README.md file from hexters/rolevel and I render the README.md content with vuejs, and my apps error and Blank

Laravel how can using the require file

Laravel how can I use the require file when using #section('content') method, how can I require the file into the this?
I want to using the menu bar, but I don't know how to separate it.
I have this code
<div class="links">
About Me
Employment History
News
Blog
Nova
Forge
Vapor
GitHub
</div>
can independent to menu.php
Make menu.blade.php with this code in your views directory.
In place of code write #include('menu')
If location of file is different then #include('path-to-file') will be loaded.
In Laravel blade you can use #include('file path')
You can use yield() to solve the problem.

Broken html script - does Incapsula change the html tags positions?

I am using Magento2 with fpc, varnish, redis and Incapsula, and I am facing a very strange behaviour for a broken html content. I have a phtml file containing some php followed by javascript as follows:
<div class="some-class">
<!--html -->
</div>
<script>
//...
$element.wrap('<div class="red"></div>');
//..
</script>
In a parent template (also phtml file), this file is being included using php include (yes this is how a Magento core module including it without using blocks) as:
<?php include 'path/to/file.phtml'; ?>
The problem is that on the page source I am getting the following unexpected html:
<div class="some-class">
<!--html -->
</div>
<script>
//...
$element.wrap('<div class="red"></script></div>');
//..broken content here due to the moved script tag
Notice the moved ending tag ..
I know that this scenario can happen due to several issues, but I am suspecting Incapsula because its being used by the only environment where the issue occurs
Please suggest possible scenarios related to caching, any help or idea is appreciated.
Thanks
Try to use this way to echo other phtml in phtml.
<?php
echo $block->getLayout()
->createBlock("Magento\Framework\View\Element\Template")
->setTemplate("Your_Module::file.phtml")
->toHtml();
?>

Laravel (5.2) Blade - How to prevent a Blade Directive in an email address from being parsed?

Update This is a bug in Laravel 5.2 & 5.3
I've got a weird one here. A user's email address on our client's system has a domain with the following substring in it '#parent'. I am not including the whole thing just for the sake of privacy.
Because #parent is a Blade directive, Laravel seems to either process or ignore the #parent and strips it out of the rendered email address on the page.
For example, let's say the email address is john#parentstuff.com. Laravel will render the following on the page: johnstuff.com. See how it removes #parent from the email?
What I've tried to fix it:
1. {!! $user->email !!}
2. {{ e($user->email) }}
I know that this is an issue with Blade as AJAX & jQuery rendered content with this same email address is displayed just fine elsewhere on the site.
UPDATE
Upon further investigation, it appears this may be a bug in how Blade processes the #parent directive. I set up 3 new Laravel projects for the following versions: 5.2, 5.3 and 5.4. The project in question is a Laravel 5.2 project, FYI.
I created the following setup for each of the above mentioned versions to test the bug.
Route
Route::get('/test', function () {
$foo = 'john#parentingstuff.org';
return view('test')->with('foo', $foo);
});
Templates
Base
<html>
<head>
<title>App Name - #yield('title')</title>
</head>
<body>
<div class="container">
#yield('content')
</div>
</body>
</html>
Test View
#extends('test-base')
#section('content')
{{$foo}}
#endsection
Outputs
L5.2: johningstuff.org
L5.3: johningstuff.org
L5.4: john#parentingstuff.org
Theories
One very interesting case I noticed while running these tests was that having the {{$foo}} variable inside of a #section directive vs moving it outside of the #section directive led to two different outputs.
Example
{{$foo}}
#section('content')
{{$foo}}
#endsection
The output of this was...
john#parentingstuff.org
johningstuff.org
Conclusion
So, does anyone know how to patch this bug in Laravel 5.2 or Laravel 5.3? Currently, upgrading to L5.4 is not an option for our client.
Anyone have any clever tricks they can think of that might help?
I believe the problem is elsewhere. You are doing probably something more than you wrote.
Sample controller method content
return view('test', ['email' => 'john#parentstuff.com'];
Sample view:
Email is: {{ $email }}
Result is:
Email is: john#parentstuff.com
so I believe you are doing something more than you wrote.
Something very screwy is going on in your setup, because that shouldn't be possible. Laravel processes Blade instructions before interpreting any variables.
I tested with a very simple example:
Route::get('test', function() {
$foo = 'john#parentstuff.com';
return view('test')->with('foo', $foo);
});
and a Blade template of:
{{ $foo }}
and it works just fine. #parent is not interpreted.
This is a bug in Laravel verions prior to 5.4. See the following:
https://github.com/laravel/framework/issues/10068
https://github.com/laravel/framework/pull/16033
This is a bug in Laravel 5.1 too.
A quick solution could be to change the # sign to
#
to fix it.

Resources