How to improve speed on my laravel website? [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last year.
Improve this question
I built a website using Laravel and it's extremely slow.
This the code and the files for the website:
web.php:
Route::get('/product/{url}', 'FrontendController#getProduct')->where('url', '^[\w.-]*$');
FrontendController:
public function getProduct(String $url){
$product = Product::where('url', $url)->first();
$imgs = ProductImage::all()->where('product_id',$product->id);
return view('frontend.product', ['product' => $product, 'products' => Product::all(), 'images' => $imgs ]);
}
product.blade.php:
<div class="container-fluid display-products-desktop px-5" style="margin-top:15rem">
<div class="row mx-0 row-filters-desktop">
<div class="col-12 d-flex justify-content-end mb-5">
TALK WITH A DESIGNER
<!-- HOURS CONDITION -->
#php
$dt = new DateTime("now", new DateTimeZone('Portugal'));
#endphp
#if ($dt->format('H:i:s') >= '09:00:00' && $dt->format('H:i:s') <= '18:00:00')
<a class="cta-links" data-toggle="modal" data-target="#contact-five-minutes-modal">CALL ME IN 5 MINUTES</a>
#else
<a class="cta-links" data-toggle="modal" data-target="#contact-us-modal">CONTACT US</a>
#endif
</div>
</div>
<div class="row m-0">
<div class="col-2 p-0 thumb-div" style="border-right: 1px solid rgba(177, 177, 177, 0.8);">
<div class="swiper-container gallery-thumbs m-0">
<div class="swiper-wrapper">
#foreach ($images as $image)
<div class="swiper-slide thumbs"><img src="{{ $image->url }}" alt="" class="gallery-thumbs-slide"></div>
#endforeach
</div>
</div>
</div>
<div class="col-6 p-0">
<div class="swiper-container gallery-top m-0">
<div class="swiper-wrapper">
#foreach ($images as $image)
<div class="swiper-slide top"><img src="{{ $image->url }}" alt="" class="img-fluid"></div>
#endforeach
</div>
<div class="swiper-next-2 swiper-dark"></div>
<div class="swiper-prev-2 swiper-dark"></div>
</div>
</div>
<div class="col-4 p-0 margin-top-text" style="padding-left: 1.5rem !important">
<p class="product-page-pre-title">meet</p>
<h1 class="m-0 main-product-title" style="font-weight: 500">{{ $product->name }}</h1>
<h4 class="mb-5" style="font-weight: 500">by {{ $product->brand }}</h4>
<p class="paragraph-product-page">{{ $product->description }}</p>
<h5 class="mt-5 section-title-product-page">MATERIAL AND FINISHES:</h5>
<p class="paragraph-product-page">{{ $product->finishes }}</p>
<h5 class="mt-4 section-title-product-page">DIMENSIONS</h5>
<p class="paragraph-product-page m-0">{{ $product->dimensions }}</p>
<a class="cta-links" style="margin-top:2.5rem;margin-bottom:2.5rem; display:block;" href="#downloadCatalogue" data-bs-toggle="modal" data-bs-target="#downloadCatalogue">DOWNLOAD CATALOGUE</a>
<a class="cta-links" style="margin-top:2.5rem;margin-bottom:2.5rem; display:block;" href="#productSheet{{ $product->id}}" data-bs-toggle="modal" data-bs-target="#productSheet{{ $product->id}}">DOWNLOAD PRODUCT SHEET</a>
<a class="cta-links" style="margin-top:2.5rem;margin-bottom:2.5rem; display:block;" href="#reqCustom{{ $product->id}}" data-bs-toggle="modal" data-bs-target="#reqCustom{{ $product->id}}">REQUEST CUSTOMIZATION</a>
<button class="product-price-btn" data-bs-toggle="modal" data-bs-target="#getPrice{{ $product->id }}">GET PRICE</button>
</div>
</div>
<div class="row mx-0">
<div class="col-12 p-0 text-center" style="margin-top:6rem">
<h1 class="m-5" style="font-weight: 600">Related Products</h1>
</div>
</div>
<div class="d-row d-flex gap-2 justify-content-center">
<div class="col-md-3 px-0">
<img src="{{ $product->related_product_img_1}}" alt="" class="img-fluid">
</div>
<div class="col-md-3 px-0">
<img src="{{ $product->related_product_img_2}}" alt="" class="img-fluid">
</div>
<div class="col-md-3 px-0">
<img src="{{ $product->related_product_img_3}}" alt="" class="img-fluid">
</div>
<div class="col-md-3 px-0">
<img src="{{ $product->related_product_img_4}}" alt="" class="img-fluid">
</div>
</div>
<div class="d-row d-flex gap-2 justify-content-center" style="margin-bottom: 5rem">
#php
$slug_1 = str_replace(' ', '-', $product->related_product_name_1);
$url_1 = strtolower( $slug_1 );
$slug_2 = str_replace(' ', '-', $product->related_product_name_2);
$url_2 = strtolower( $slug_2 );
$slug_3 = str_replace(' ', '-', $product->related_product_name_3);
$url_3 = strtolower( $slug_3 );
$slug_4 = str_replace(' ', '-', $product->related_product_name_4);
$url_4 = strtolower( $slug_4 );
#endphp
<div class="col-md-3 px-0">
<div class="text-center mt-1">
<p class="product-subtitle">new</p>
<h4 class="product-title">{{ $product->related_product_name_1}}</h4>
<a class="product-price-link" href="#getPrice{{ $product->related_product_id_1}}" data-bs-toggle="modal" data-bs-target="#getPrice{{ $product->related_product_id_1}}">get price</a>
</div>
</div>
<div class="col-md-3 px-0">
<div class="text-center mt-1">
<p class="product-subtitle">new</p>
<h4 class="product-title">{{ $product->related_product_name_2}}</h4>
<a class="product-price-link" href="#getPrice{{ $product->related_product_id_2}}" data-bs-toggle="modal" data-bs-target="#getPrice{{ $product->related_product_id_2}}">get price</a>
</div>
</div>
<div class="col-md-3 pr-0 pl-1">
<div class="text-center mt-1">
<p class="product-subtitle">new</p>
<h4 class="product-title">{{ $product->related_product_name_3}}</h4>
<a class="product-price-link" href="#getPrice{{ $product->related_product_id_3}}" data-bs-toggle="modal" data-bs-target="#getPrice{{ $product->related_product_id_3}}">get price</a>
</div>
</div>
<div class="col-md-3">
<div class="text-center mt-1">
<p class="product-subtitle">new</p>
<h4 class="product-title">{{ $product->related_product_name_4}}</h4>
<a class="product-price-link" href="#getPrice{{ $product->related_product_id_4}}" data-bs-toggle="modal" data-bs-target="#getPrice{{ $product->related_product_id_4}}">get price</a>
</div>
</div>
</div>
</div>
These are the results shown on a speed test website:
I am a beginner, so I´ve been studying ways to improve this. Do any of you have suggestions on how to improve the website performance? Thanks in advance.

Solved it by changing the following code and removing a few bootstrap modals from the product.blade.
FrontEndController:
public function getProductTest(String $url){
$product = Product::where('url', $url)->first();
$imgs = ProductImage::where('product_id',$product->id)->get();
return view('frontend.product-test', ['product' => $product, 'images' => $imgs ]);
}
The speed went from almost eleven seconds to 1.22 seconds.

First change the below code in your frontendController
$imgs = ProductImage::where('product_id',$product->id)->get();
This will improve your query loading time.
Then in the below code
return view('frontend.product', ['product' => $product, 'products' => Product::all(), 'images' => $imgs ]);
why are you passing all the products to blade
'products' => Product::all(),
This is a bad idea, and it must be slowing down your page
only get what you need. calling everything in database is really not a good idea

Related

Images I upload in Laravel don't show after I have tried many answers online. All the images I upload store alright but they don't display

I have this in view. It is able to upload alright but it won't show. Is there anything more I should add?
<div class="col-md-4">
<img class="img img-fluid img-thumbnail" src="/storage/profile_images/{{$profile->profile_image}}"/> </div>
here is my show.blade.php file
<div class="col-md-4">
<img class="img img-fluid img-thumbnail" src="/storage/profile_images/{{$profile->profile_image}}"/></div>
Here is the player.blade.php file:
#if(count($players) > 0)
<?php $index = 0; ?>
#foreach($players as $player)
<div class="col-md-4">
<div class="card mb-1" style="width:300px">
<div class="card-body">
<img class="img img-fluid img-thumbnail" style="height: 170px; width: 350px" src="/storage/profile_images/{{$player->profile_image}}">
</div>
<div class="card-footer">
<div class="row justify-content-center">
{{$names[$index]}}<br>
</div>
<div class="row">
<div class="col-10">
<span class="h6">Team: {{$player->current_fc}}</span><br>
<span class="h6">Position: {{$player->position}}</span><br>
</div>
</div>
</div>
</div>
</div>
<?php $index++; ?>
#endforeach
<div class="col-12 mt-3">
{{$players->appends(request()->input())->links()}}
</div>
#else
<p>No Players available</p>
#endif
Follow above your image issue will be resolved:
Step 1:
Delete storage folder from public
Step 2:
Inside your project run this command
player.blade.php
php artisan storage:link
Step 3:
Replace or change as per this:
show.blade.php
<div class="col-md-4">
<img class="img img-fluid img-thumbnail" src="{{ url('storage/profile_images/.$profile->profile_image) }}" /></div>
Step 4:
Replace or change as per you required:
#if(count($players) > 0)
<?php $index = 0; ?>
#foreach($players as $player)
<div class="col-md-4">
<div class="card mb-1" style="width:300px">
<div class="card-body">
<img class="img img-fluid img-thumbnail" style="height: 170px; width: 350px" src="{{ url('storage/profile_images/.$profile->profile_image) }}">
</div>
<div class="card-footer">
<div class="row justify-content-center">
{{$names[$index]}}<br>
</div>
<div class="row">
<div class="col-10">
<span class="h6">Team: {{$player->current_fc}}</span><br>
<span class="h6">Position: {{$player->position}}</span><br>
</div>
</div>
</div>
</div>
</div>
<?php $index++; ?>
#endforeach
<div class="col-12 mt-3">
{{$players->appends(request()->input())->links()}}
</div>
#else
<p>No Players available</p>
#endif
You can use the asset function like in the example below:
#php
$imgUrl = '/storage/profile_images/'.$profile->profile_image;
#endphp
<img class="img img-fluid img-thumbnail" src="{{ asset($imgUrl)}}"/>
Also make sure that the storage is linked using the following command:
php artisan storage:link

how to display post data by category with laravel livewire

Good afternoon, how to display post data by category in laravel livewire? here I want to try to display post by category data in the following way but it still doesn't work:
web.php
Route::get('category/{category:slug}',[FrontController::class, 'category'])->name('category');
FrontController.php
public $search;
public function category(Category $category)
{
$categories = Category::all();
$general = General::find(1);
$locale = App::currentLocale();
$category_id = $category->id;
$search = request("search");
$posts = Post::where([
['lang',$locale],
['category_id',$category_id],
['status','PUBLISH'],
])->latest()->paginate(12);
if ($this->search !== null) {
$posts = Post::where([
['title','like', '%' . $this->search . '%'],
['lang',$locale],
['category_id',$category_id],
['status','PUBLISH'],
])->latest()->paginate(12);
}
// dd($category_id);
$tags = Tag::all();
$top = Post::where('status','PUBLISH')->orderBy('views','desc')->limit(5)->get();
return view ('front.category',compact('categories','category_id','general','locale','posts','tags','top'));
}
category.blade.php
#extends('layouts.front')
#section('content')
<main id="main">
<section class="post-category">
<div class="container-fluid">
<div class="row mt-3">
<div class="col-lg-3 col-md-12 col-sm-12 d-none d-lg-block">
<div class="sticky-top" style="top: 90px;">
<div class="card mb-3 rounded-3">
<div class="card-body">
<a href="#" target="_blank" rel="noreferrer">
<img src="{{ asset('front/img/ads.png') }}" alt="..." height="300" width="279" class="card-img-top" />
</a>
</div>
</div>
<div class="d-flex flex-column mb-3 bg-light shadow bg-body rounded">
<div class="card-header bg-primary bg-gradient text-white fw-bold fs-5">
{{ __('sentence.category') }}
</div>
<ul class="list-group list-group-flush">
#foreach ($categories as $category)
<li class="list-group-item d-flex justify-content-between align-items-center">
{{ $category->name }}
</li>
#endforeach
</ul>
</div>
<div class="d-flex flex-column bg-light bg-body shadow-lg rounded-3">
<div class="card-header bg-primary bg-gradient text-white fw-bold fs-5">
Tags
</div>
<div class="p-3 overflow-auto" style="max-height: 42vh">
<div class="nav tag-cloud">
#foreach ($tags as $tag)
{{ $tag->name }}
#endforeach
</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="category_id" value="{{ $category_id }}">
<livewire:category-index>
<div class="col-lg-3 col-md-12 col-sm-12">
<div class="sticky-top" style="top: 90px;">
<div class="card rounded-3 shadow-lg mb-3">
<div class="card-body">
<img src="{{ asset('front/img/ads1.png') }}" height="117" width="279" class="card-img-top" alt="...">
</div>
</div>
<div class="bg-light shadow bg-body rounded-3 mb-3">
<div class="card-header bg-primary bg-gradient text-white fw-bold fs-5">
{{ __('sentence.top_article') }}
</div>
<ul class="list-group list-group-flush mb-2">
#foreach ($top as $top)
<li class="list-group-item">
{{ $top->title }}
<div class="d-flex justify-content-between mt-3">
<small class="text-muted">{{ Carbon\Carbon::parse($top->created_at)->format("d F, Y") }}</small>
<small class="text-muted">{{ $top->views }} views </small>
</div>
</li>
#endforeach
</ul>
</div>
<div class="d-flex flex-column mb-3 bg-light shadow bg-body rounded d-lg-none d-xl-none">
<div class="card-header bg-primary bg-gradient text-white fw-bold fs-5">
{{ __('sentence.category') }}
</div>
<ul class="list-group list-group-flush">
#foreach ($categories as $category)
<li class="list-group-item d-flex justify-content-between align-items-center">
{{ $category->name }}
</li>
#endforeach
</ul>
</div>
<div class="d-flex flex-column bg-light bg-body shadow-lg rounded-3 d-lg-none d-xl-none">
<div class="card-header bg-primary bg-gradient text-white fw-bold fs-5">
{{ __('sentence.tag') }}
</div>
<div class="p-3 overflow-auto" style="max-height: 42vh">
<div class="nav tag-cloud">
#foreach ($tags as $tag)
{{ $tag->name }}
#endforeach
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
#endsection
#push('scripts')
#livewireScripts
<script type="text/javascript">
window.onscroll = function (ev) {
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
window.livewire.emit('category-index');
}
};
</script>
<script>
document.getElementById('load-more').onclick = function() {
window.livewire.emit('category-index');
};
</script>
#endpush
livewire\CategoryIndex.php
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use App\Models\{Category, Post};
use Illuminate\Support\Facades\App;
class CategoryIndex extends Component
{
public $limitPerPage = 10;
public $search;
protected $listeners = [
'category-index' => 'CategoryIndex'
];
protected $updatesQueryString = [
['search' => ['except' => '']],
];
public function CategoryIndex()
{
$this->limitPerPage = $this->limitPerPage + 6;
}
public function render()
{
$locale = App::currentLocale();
$category_id = request('category_id');
$posts = Post::where([
['lang',$locale],
['category_id',$category_id],
['status','PUBLISH'],
])->latest()->paginate($this->limitPerPage);
if ($this->search !== null) {
$posts = Post::where([
['title','like', '%' . $this->search . '%'],
['lang',$locale],
['category_id',$category_id],
['status','PUBLISH'],
])->latest()->paginate($this->limitPerPage);
}
$this->emit('postStore');
dd($category_id);
return view('livewire.category-index', ['posts' => $posts]);
}
}
livewire\category-index.blade.php
<div class="col-lg-6 col-md-12 col-sm-12">
<div id="section-title" class="section-title p-1 pt-3">
<h2 class="text-center fw-bold">{{ trans('sentence.recent_posts')}}</h2>
</div>
<div class="form-group has-search mb-3">
<span class="bi bi-search form-control-feedback"></span>
<input type="text" wire:model="search" class="form-control" placeholder="{{ __('sentence.search_form') }}">
</div>
#foreach ($posts as $data)
<div class="card bg-light shadow bg-body rounded-3 mb-2">
<div class="card-header bg-primary text-white d-flex justify-content-between">
<small>by {{$data->admin->name}}</small>
<small>{{ Carbon\Carbon::parse($data->created_at)->format("d F, Y") }}</small>
</div>
<div class="card-body">
<h2 class="card-title">
{{ $data->title }}
</h2>
<div class="card-footer bg-body d-flex justify-content-between align-items-center pb-0 px-0">
<div class="d-flex my-1">
#foreach ($data->tags as $tag)
{{ $tag->name }}
#endforeach
</div>
</div>
</div>
</div>
#endforeach
#if ($posts->count() == 0)
<div class="alert alert-danger" role="alert">
Data not found!
</div>
#endif
#if($posts->count() >= 10)
<div class="text-center d-md-none d-lg-none d-xl-none">
<button id="load-more" class="btn btn-primary my-3">
Load More
</button>
</div>
#endif
</div>
If I add($category_id); in FrontController.php the id of that category appears, but if I try to dd in livewire\CategoryIndex.php it shows null. what is the correct way to display posts by category? thank you
Livewire components work slightly differently to blade views, they do not automatically inherit variables from their parents.
What you need to do is pass your category_id to the Livewire component.
class CategoryIndex extends Component
{
public $categoryId;
}
<livewire:category-index :categoryId="$category_id" />

Trying to set default Cateogry View in frontend Laravel 6

I am a total amateur on Laravel and I am trying to find a way to display by default a specific category with it's services instead of showing ALL the services for alla the categories that exist.
<section class="categories sp-80-50 bg-dull">
<div class="container">
<div class="row">
<div class="col-12">
<div class="all-title">
<p>#lang('front.categoriesTitle')</p>
<h3 class="sec-title">
#lang('front.categories')
</h3>
</div>
</div>
</div>
<div id="categories" class="row justify-content-center">
#foreach ($categories as $category)
#if($category->services->count() > 0)
<div class="col-xl-2 col-lg-3 col-md-4 col-sm-6 col-12 mb-30 categories-list" data-category-id="{{ $category->id }}">
<div class="ctg-item" style="background-image:url('{{ $category->category_image_url }}')">
<a href="javascript:;">
<div class="icon-box">
<i class="flaticon-fork"></i>
</div>
<div class="content-box">
<h5 class="mb-0">
{{ ucwords($category->name) }}
</h5>
</div>
</a>
</div>
</div>
#endif
#endforeach
</div>
</div>
</section> */
<section class="listings sp-80 bg-w">
<div class="container">
<div class="row">
<div class="col-12">
<div class="all-title">
<p> #lang('front.servicesTitle') </p>
<h3 class="sec-title">
#lang('front.services')
</h3>
</div>
</div>
</div>
<div id="services" class="row">
#foreach ($services as $service)
<div class="col-lg-3 col-md-6 col-12 mb-30 services-list service-category-{{ $service->category_id }}">
<div class="listing-item">
<div class="img-holder" style="background-image: url('{{ $service->service_image_url }}')">
<div class="category-name">
<i class="flaticon-fork mr-1"></i>{{ ucwords($service->category->name) }}
</div>
</div>``
and
var categories = `
<div class="col-xl-2 col-lg-3 col-md-4 col-sm-6 col-12 mb-30 categories-list">
</div>`;
response.categories.forEach(category => {
if (category.services.length > 0) {
var url = category.category_image_url;
categories += `
<div class="col-xl-2 col-lg-3 col-md-4 col-sm-4 col-12 mb-30 categories-list" data-category-id="${category.id}">
<div class="ctg-item" style="background-image:url('${url}')">
<a href="javascript:;">
<div class="icon-box">
<i class="flaticon-fork"></i>
</div>
<div class="content-box">
<h5 class="mb-0">
${category.name}
</h5>
</div>
</a>
</div>
</div>`
}
});
$('#categories').html(categories);
var services = '';
if (response.services.length > 0) {
response.services.forEach(service => {
services += `
<div class="col-lg-3 col-md-6 col-12 mb-30 services-list service-category-${service.category_id}">
<div class="listing-item">
<div class="img-holder" style="background-image: url('${ service.service_image_url }')">
<div class="category-name">
<i class="flaticon-fork mr-1"></i>${service.category.name}
</div>
<div class="time-remaining">
<i class="fa fa-clock-o mr-2"></i>
<span>έως ${service.time} ${makeSingular(service.time, service.time_type)}</span>
</div>
</div>
You can access the webpage at https://click-away.store
I need to set the default Services view for the 1st Button Category.
Sorry if my question is silly or the solution is simple but I couldn't find out what to do!
Your error is that you never loop over the category's services.
You check if there are any services, but you never loop over them. So, within the #if you should do that.
#foreach ($categories as $category)
#if($category->services->count() > 0)
#foreach($category->services as $service)
// your code
#endforeach
#endif
#endforeach

create view for each category - laravel

I currently print all categories in one view, with them I mark a difference between its subcategories
#foreach($tipos as $tipo)
<div class="card">
<h4 style="margin-top: 5px;">{{$tipo->tipo }}</h4>
</div>
#foreach($tipo->categories as $category)
<div style="margin-top: 20px;" class="col-lg-4 col-sm-6 mb-4">
<div class="card h-100">
<a href="{{ route('category-detail',['slug'=>$category->slug]) }}">
#if(!empty($category->image))
<img class="card-img-top" src="{{url($category->image)}}" alt="">
#else
<img class="card-img-top" src="http://placehold.it/700x400" alt="">
#endif
</a>
<div class="card-body">
<h4 class="card-title">
{{$category->name}}
</h4>
<p class="card-text">{{$category->descripcion}}</p>
</div>
</div>
</div>
#endforeach
#endforeach
I get the names from:
categories table:
Now I need to create a view for each of them, enter it using url,
controller:
public function list($id){
$tipos = App\Tipo::findOrFail($id);
return view('list.tipos', compact('tipos'));
}
route:
Route::get('/list{id}','HomeController#list')->name('list.categories');
pivot table:
How can I print the content of each category? help pls
Modify your controller like this
Note: Change the Model Names (App\Pivote) and (App\Category) to what you have set in your code.
public function list($id){
$tipos = App\Tipo::findOrFail($id);
$pivot_data = App\Pivote::select('category_id')->where('tipo_id',$id)->get()->toArray();
$categories = App\Category::whereIn('id',$pivot_data)->get()->toArray();
return view('list.tipos', compact('tipos','categories'));
}
And modify your view something like this
<div class="card">
<h4 style="margin-top: 5px;">{{$tipos->tipo }}</h4>
</div>
#foreach($categories as $key => $category)
<div style="margin-top: 20px;" class="col-lg-4 col-sm-6 mb-4">
<div class="card h-100">
<a href="{{ route('category-detail',['slug'=>$category['slug']]) }}">
#if(!empty($category['image']))
<img class="card-img-top" src="{{asset($category['image'])}}" alt="">
#else
<img class="card-img-top" src="http://placehold.it/700x400" alt="">
#endif
</a>
<div class="card-body">
<h4 class="card-title">
{{$category['name']}}
</h4>
<p class="card-text">{{$category['descripcion']}}</p>
</div>
</div>
#endforeach

laravel foreach broke column

Sorry for title i couldn't think better title!
anyway, this is my blog page code:
#extends('layouts.frontend_index')
#section('title', 'Blog')
#section('content')
<div class="container">
<div class="row" style="margin-bottom:30px;">
<div class="col-md-8">
<div class="row">
#forelse($posts as $post)
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12" style="margin-bottom:15px;">
<div class="card card2">
<div class="cardimg">
<img src="{{ url('images/') }}/{{ $post->image }}" class="card-img-top" style="width:100%; height:auto; max-height:500px;" alt="{{ $post->title }}">
</div>
<div class="card-block">
<h4 class="card-title">{{$post->title}}</h4>
<p class="card-text">{!! str_limit($post->body, 10) !!}</p>
<p><a class="btn btn-block btn-link" href="{{ route('frontshow', $post->slug ) }}">Read More <i class="fa fa-arrow-right"></i></a></p>
</div>
</div>
</div>
#empty
<p>No Post Available yet!</p>
<div class="text-center">
<a class="btn btn-error" href="{{url('/')}}">Back to Main Page</a>
</div>
#endforelse
<div class="col-md-12 text-center">
{{$posts->links()}}
</div>
</div><!--end row-->
</div><!--end col-md-8-->
<div class="col-md-4">
<h3>Get Latest Updates...</h3>
<a target="_blank" href="https://t.me/studiotjd"><div id="telegram"></div></a>
<a target="_blank" href="https://www.facebook.com/studiotjd"><div id="facebook"></div></a>
<a target="_blank" href="https://www.instagram.com/studiotjd/"><div id="instagram"></div></a>
</div><!--end col-md-4-->
</div><!--end row-->
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4 span3 wow rollIn" style="animation-delay: 1s;"><div id="Library"></div></div><!--end col-md-4-->
<div class="col-md-4 span3 wow bounceInDown center" style="animation-delay: 1s;"><div id="Library2"></div></div><!--end col-md-4-->
<div class="col-md-4 span3 wow bounceInRight" style="animation-delay: 1s;"><div id="Library3"></div></div><!--end col-md-4-->
</div><!--end row-->
</div><!--end col-md-12-->
</div><!--end row-->
</div>
#endsection
here is how it looks like in view:
I tried almost everything to fix this issue but nothing works!
As you can see in my inspect all col-md-4 goes under first col-md-4 and i don't know why
Is there anyone knows how to fix this issue?
try this
{{ strip_tags(str_limit($post->body, 10)) }}
I think you have html element stored in your database, and you are just using str_limit so the tags in your body is not closed.
problem is a height of div, check it on the inspector code. 1 px or more is

Categories