your vux actions get function code?
did you use fetch or axios ?
in your chrome console show anything ?
How do i set background image height and width in css?
How to add slug to href?
Can you send the code as a screenshots ?
who know about laravel deplopy server ?
The Fetch API provides a JavaScript interface for accessing and manipulating parts of the HTTP pipeline, such as requests and responses. It also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network.
you mean get method?
actions: {
get ({ commit }, {url, id}) {
return fetch(…)
}
}
actions: {
get ({ commit }, {url, id}) {
return fetch(…)
}
}
yeah
fetch(`${url}/${id}`)
console.error(‘Error:’, error);
});
Thanks let me try it



I do
Will u please share
Source code?
It’s in a private repo. And currently in production. Dm me your email address
Tempuser0705@gmail.com
background-size:
Component1.vue
method: {
myMethod() {
//Code
}
}
Component2.vue
method: {
method2() {
//how to call myMethod() which is in component1
}
}
No not a cron job I am using laravel queue
My laravel version is 5.7
This issue happen for some user at that time only normally it’s working fine
2 hr delay for last mail but first mail shoot after 7 hr
Can’t understand why all mail shoot at same time.
we are looking for an experienced Laravel(PHP) developers for Mohali Chandigarh Location. Interested candidates can reach me
Thanks
Hello Pm me
I have three tables, houses & categories & category_house.
houses & category_house tables
public function up()
{
Schema::create(‘houses’, function (Blueprint $table) {
$table->bigIncrements(‘id’);
$table->bigInteger(‘user_id’)->unsigned();
$table->foreign(‘user_id’)->references(‘id’)->on(‘users’)->onDelete(‘cascade’);
$table->string(‘title’);
$table->string(‘slug’);
$table->string(‘lang’);
$table->string(‘image’)->nullable();
$table->text(‘sliders’);
$table->text(‘body’);
$table->timestamps();
});
Schema::create(‘category_house’, function (Blueprint $table) {
$table->bigInteger(‘category_id’)->unsigned();
$table->foreign(‘category_id’)->references(‘id’)->on(‘categories’)->onDelete(‘cascade’);
$table->bigInteger(‘house_id’)->unsigned();
$table->foreign(‘house_id’)->references(‘id’)->on(‘houses’)->onDelete(‘cascade’);
$table->primary([‘category_id’ , ‘house_id’]);
});
}
categories table
public function up()
{
Schema::create(‘categories’, function (Blueprint $table) {
$table->bigIncrements(‘id’);
$table->string(‘name’);
$table->string(‘lang’);
$table->string(‘href’)->nullable();
$table->integer(‘parent_id’);
$table->string(‘icon’)->nullable();
$table->timestamps();
});
}
edit.blade.php
<form action=”{{ route(‘houses.update’, $house->id) }}” method=”post”>
@csrf
@method(‘PUT’)
<input type=”hidden” name=”sliders”>
<div class=”col-md-6″>
<div class=”form-group”>
<label for=”title”>Title</label>
<input type=”text” class=”form-control” id=”title” name=”title” value=”{{ old(‘title’) ?? $house->title }}”>
</div>
</div>
<div class=”col-md-12″>
<div class=”form-group”>
<label for=”body”>Body</label>
<textarea class=”form-control” id=”body” name=”body”>{{ old(‘body’) ?? $house->body }}</textarea>
</div>
</div>
<div class=”col-md-6″>
<div class=”form-group”>
<label for=”category”>Sub Category</label>
<select name=”category” id=”category” class=”form-control”>
@foreach($categories as $category)
<option value=”{{ $category->id }}” {{ $house->categories()->pluck(‘id’)->contains($category->id) ? ‘selected’ : ” }}>
{{ $category->name }}
</option>
@endforeach
</select>
</div>
</div>
<div class=”col-md-6″>
<div class=”form-group”>
<label for=”lang”>Language</label>
<select id=”lang” name=”lang” class=”form-control”>
<option value=”fa” {{ $house->lang == ‘fa’ ? ‘selected’ : ” }}>Farsi</option>
<option value=”en” {{ $house->lang == ‘en’ ? ‘selected’ : ” }}>English</option>
</select>
</div>
</div>
//…..
<div class=”form-group”>
<button class=”btn btn-primary btn-lg btn-block”>
<i class=”fas fa-check ml-2″></i>Save
</button>
</div>
</form>
HouseController.php
public function update(Request $request, House $house)
{
$house->user_id = 1;
$house->title = $request->title;
$house->lang = $request->lang;
$house->body = $request->body;
if($request->has(‘image’)) {
$image = $request->file(‘image’);
$filename = $image->getClientOriginalName();
$image->move(public_path(‘images/slideShows’), $filename);
$house->image = $request->file(‘image’)->getClientOriginalName();
$house->save();
$house->categories()->sync($request->category);
$category = Category::findOrFail($request->get(‘category’))->getParent();
$category->name = $request->title;
$category->parent_id = $request->category;
$category->lang = $request->lang;
$category->href = $request->slug;
$category->save();
return redirect()->route(‘houses.index’);
}
Category.php
public function getParent ()
{
return $this->hasOne(Category::class, ‘id’, ‘parent_id’)->withDefault([‘name’ => ‘-‘]);
}
For example, I have the following cateories in database.
id`—-`name`—————–`lang`——`href`———`parent_id`——–`icon`—————–`created_at`——–`updated_at
8`—–`Main Menu`——–`en`———-`NULL`——`0`———————`fas fa-cube`——`NULL`—————-`NULL
The correct method should be stored this way
id`—-`name`—————–`lang`——`href`———————-`parent_id`——–`icon`—————–`created_at`——–`updated_at
8`—–`Main Menu`——–`en`———-`NULL`——————-`0`———————`fas fa-cube`——`NULL`—————-`NULL
20`—`Duplex House`—-`en`———-`duplex-house`——`8`———————`NULL`—————`NULL`—————-`NULL
But this way it is saved.
id`—-`name`—————–`lang`——`href`———————-`parent_id`——–`icon`—————–`created_at`——–`updated_at
8`—–`Duplex House`—-`en`———`NULL`——————-`8`———————`fas fa-cube`——`NULL`—————-`NULL
20`—`Duplex House`—-`en`———`NULL`——————-`8`———————`NULL`—————`NULL`—————-`NULL
And when I changed this code
$category = Category::findOrFail($request->get(‘category’))->getParent();
I want to add slug to href.
– slug => house
– href => categories
$house->save();
$house->categories()->sync($request->category);
$category = Category::findOrFail($request->get(‘category’))->getParent();
$category->name = $request->title;
$category->parent_id = $request->category;
$category->lang = $request->lang;
$category->href = $request->slug;
$category->save();
return redirect()->route(‘houses.index’);
}
Category.php
public function getParent ()
{
return $this->hasOne(Category::class, ‘id’, ‘parent_id’)->withDefault([‘name’ => ‘-‘]);
}
For example, I have the following cateories in database.
id`—-`name`—————–`lang`——`href`———`parent_id`——–`icon`—————–`created_at`——–`updated_at
8`—–`Main Menu`——–`en`———-`NULL`——`0`———————`fas fa-cube`——`NULL`—————-`NULL
The correct method should be stored this way
id`—-`name`—————–`lang`——`href`———————-`parent_id`——–`icon`—————–`created_at`——–`updated_at
8`—–`Main Menu`——–`en`———-`NULL`——————-`0`———————`fas fa-cube`——`NULL`—————-`NULL
20`—`Duplex House`—-`en`———-`duplex-house`——`8`———————`NULL`—————`NULL`—————-`NULL
But this way it is saved.
id`—-`name`—————–`lang`——`href`———————-`parent_id`——–`icon`—————–`created_at`——–`updated_at
8`—–`Duplex House`—-`en`———`NULL`——————-`8`———————`fas fa-cube`——`NULL`—————-`NULL
20`—`Duplex House`—-`en`———`NULL`——————-`8`———————`NULL`—————`NULL`—————-`NULL
And when I changed this code
$category = Category::findOrFail($request->get(‘category’))->getParent();
I want to add slug to href.
– slug => house
– href => categories
Can you send the code as a screenshots ?
I canβt read well π
I think this is what we are interested at πππ»
In the blade you are sending the house id as a parameter
And in update function you are updating the house
{you passed the id not the house}
Solution:
1) Change update function to:
public function update(Request $request, $id)
2) Add this line at the beginning of the update function
$house = House::find($id);



Your problem is $sections not exist
Show controller code

Controller code
Should be
return view(‘vendorsDb.sections.sections’, [
‘sections’ => $sections,
]);
return view(‘vendorsDb.sections.sections’, [
‘sections’ => $sections,
]);
Thank you it has worked ππ
I canβt read well π