Questions tagged [laravel-blade]
Blade is the simple, yet powerful templating engine provided with Laravel. Unlike other popular PHP templating engines, Blade does not restrict you from using plain PHP code in your views.
5,968
questions
0
votes
1answer
35 views
How to get instance of a collection in Laravel 8 to use in a if statement?
How to get instance of a collection in Laravel 8?
I want to make a if statement if $event->like (CODE BELOW) does not exists for that specific event
and an else statement I want to execute the ...
0
votes
1answer
8 views
new link & controller produce Action Controller@index not defined error
I am creating a backend page that i want to use to manage employee data (with laravel 5.8). I Added a link on a sidemenu blade that points to the employee overview page.
Link:
<li class="nav-...
0
votes
1answer
25 views
Problem in my Laravel blade with variables
I have a problem with my blade. I get this error when I run my project:
my blade codes:
@foreach(\App\Category::all()->where('parent' , $product->categories->where('parent' , '0')->first()-...
0
votes
0answers
9 views
Handle both old and passed values together in blade?
I have a form in blade with one field.
Blade Code
@if ($errors->any())
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif
<form method="post" class=...
1
vote
1answer
26 views
Check if at least one input has value with laravel controller
I have a simple form where the user should be able to only fill the inputs he wants but if the form hasn't at least one input filled, it should return a error message saying that the form can't be ...
0
votes
2answers
28 views
How to get the old value of a select input in blade laravel 8?
I have a Select and this Select can open routes when the onchange event is triggered, everything works fine, but when the new Route has opened, the Select entry initialized and revert to the first ...
0
votes
3answers
31 views
Include layout in Laravel
My master.blade.php file is like below
<body>
@include('layouts.header')
@yield('content')
@include('layouts.footer')
@include('layouts.footer-script')
</body>
My ...
0
votes
1answer
63 views
Laravel edit shallow nested resource
I'm using the following resource using shallow nesting
Route::resource('organizations.emaildomains', 'OrganizationEmailDomainController', ['except' => ['show']])->shallow();
Got the following ...
1
vote
1answer
29 views
Laravel: extending view from module
I have a module in my Laravel app (it could also be a composer package).
This module has a view composer which sets an array to all views containing the routes which should be included in the main ...
0
votes
1answer
48 views
CSS styles for <x-> tags
I need help with setting color to html divs. I use Laravel 8 and of course I installed simple auth module Breeze with tailwind css framework. But now I need to change auth card color.
All my views use ...
0
votes
0answers
23 views
why Laravel @yield and @section not wokring?
I have Master as a main page where I load dynamic pages.
Master
<!DOCTYPE html>
<html lang="en">
<head>
@include('backend.includes.header')
@yield('style')
</head>
&...
0
votes
2answers
53 views
Laravel destroy nested resource
I have a resource name OrganizationEmailDomain
Route::resource('organizations.emaildomains', 'OrganizationEmailDomainController', ['except' => ['show']]);
and able to index it just fine
In that ...
0
votes
0answers
26 views
Spatie media library is adding media when passing a eloquent query result to a blade: AssertViewHas not equal
I have a written a project in which I am using the Spatie Medialibrary. Right now I am writing tests for my code but I am facing a very weird problem. In my tests I want to check if the view really ...
2
votes
1answer
29 views
How to add blank table cell if no match from for loop?
I would like for the table cell value to be in the right column based on the column value at the top. As seen, it currently does not align correctly. When I use the else condition, it duplicates the ...
0
votes
1answer
45 views
Using Laravel Inertia.js, Vue and Blade in parallel?
Is there a way to use Laravel Blade for one part of a multipage site (e-commerce), and Inertia/Vue for some specific pages (like the basket and the admin pages)? Not mixing the two on the same pages, ...
-1
votes
0answers
28 views
Pagination not working properly in Laravel 8.x
I am quite new to Laravel, and I don't understand why the pagination is not working properly in my case. It displays all of the hostnames, not only the 48.
view.:
@if($posts->isNotEmpty())
...
0
votes
2answers
41 views
how can i use float left for n-th child
i have foreach loop for div contain image and data
i want to make even index image float to left and data float to right
and odd index float data to left and image to right
but its not working
....
0
votes
0answers
10 views
problem with render() method in laravel 8 (Arrows break down)
I am using laravel 8 and blade template. while I use the render() method in the view the arrows (helps to go to the next and previous page) takes the whole page and breaks down into two different ...
-1
votes
0answers
12 views
im using foreach with slider with bootstrap 5 but its not sliding
im using slider in bootstrap 5 and foreach in blade.php file
its not sliding and i think the reason maybe because im looping with active class in
im looping with active class
how my i solve that ,
...
0
votes
0answers
28 views
Rendering PHP, SCSS, JS, Blade-Files from Blade-Files
Currently I am struggling with finding the best approach, to implement the following, maybe not everyday, requirement.
I plan to develop a Laravel application. The very general idea of this ...
1
vote
1answer
23 views
I can't center bootstrap svg icons
I want the svg icons to be centered, instead, I see them shifted to the right.If you can help I will be very grateful.
here is a screenshot
My welcome.blade.php
@extends('layouts.layout')
@section('...
-1
votes
0answers
22 views
How to pass a variable to the onchange function correctly?
foreach ($packages as $package) {
<input type="file" id="invoice" value="{{ $package->item_id }}" ...
0
votes
1answer
23 views
How to stop my data from disappearing on render?
I'm working on a project where I use Livewire to create components that will be rendered in a view. Basic stuff, but I've come across this weird problem that I haven't been able to find the answer to ...
-1
votes
2answers
31 views
Attempt to read property “degree” on null
i have created a profile where users can add their education fields.
when there is no value in the database it throws an error. how can i get rid of this ? Attempt to read property "degree" ...
0
votes
0answers
41 views
Question related to Laravel 8 based dating app. user likes and favorites features issue
I coded for likes and favourites features of the Laravel 8 dating app. Members can see matching partners and I filtered them from the below query.
$match = DB::table('matchcriterias')
...
0
votes
2answers
103 views
Laravel - Trying to get property 'id' of non-object
I have an error:
"Trying to get property 'id' of non-object (View: C:
xampp\htdocs\klikdesaku\resources\views\admin\posts\create.blade.php)"
I had used it without laravel collective form (...
0
votes
2answers
68 views
VueJS Template Within Blade not Updated
Vue Version: 2.6
Laravel Version: 5.4
I have VueJS DOM with :disabled flag within laravel blade file(laravel mix), main data contain, images object like code below:
data() {
return {
images: {}
...
0
votes
1answer
30 views
2 way binding with Vue3 Inline template (using slots) in laravel blade template files
In Vue3, inline-templates were depreciated and now slots are used. Is it possible to have 2-way binding of variables for Vuejs components written in blade templates?
I want to have 2-way binding for ...
0
votes
0answers
18 views
Blade custom elements rendered as text in Laravel 8
I have some custom blade elements (defined inside the boot function of the AppServiceProvider) that I use normally on other pages, but since I recently updated to Laravel 8 my custom elements are ...
0
votes
1answer
31 views
button width 100% if have only one post
I“m traying to create one button that it has width 100% in blade if only have only one post in blog.
i explaning better. i“m doing a blog. When open post i can see my post and two button (previous and ...
-1
votes
0answers
30 views
Blade template engine doesn't reinder correctly
I'm getting into laravel and I'm trying to work with blade templating but its not rendering. All my examples are coming for the laravel documentation. This has made me made for 3 days. Please HELP
So ...
1
vote
1answer
34 views
How i can pass parameter from view to controller
How i can get data from view and send it to controller
for example
$banner['Top-right']
how i can send "Top-right" to controller to select all banner in this location
//$location = Top-...
-2
votes
0answers
16 views
Laravel Collection into Blade Format
Hi i have laravel collection data as shown on images below,
i need the data collection show as format below
| ID LAYANAN | UMUR 1 | UMUR 2 | UMUR 3 | UMUR 4 | SUM |
| ---------- | ------ | ------ | ...
0
votes
0answers
32 views
Laravel: pass data to view in “console command”
I'm using Laravel blades/views to generate files by templates from the custom console command. Unfortunately, any of the variants from official documentation are not working.
This is how I'm trying to ...
0
votes
0answers
32 views
foreach() method retrieves null after closing modal - Livewire
I'm working with livewire on laravel 8 and I have a component that contains a table, some buttons and a set of modals to make some operations with the date from the tables. There's one modal that ...
0
votes
0answers
19 views
Laravel include throw plain text
When I just add to a Laravel blade view another blade with @include it throws me a code as plain text.
blade1.blade
<div class="container-fluid">
@include('chat')
</div>
...
0
votes
1answer
22 views
Laravel select field validation
I am currently building a feature where a user can select an option from a select box, once an item is selected you can click a button which hits my endpoint which submits and stores it.
However if i ...
0
votes
2answers
43 views
How to avoid checking every time, if variable is set in blade template? Laravel 8
I know about something like this:
{{ old('contents', $page->contents ?? null) }}
But what about more complicated cases, like checkboxes and selects?
<select id="custom_template" name=&...
0
votes
1answer
44 views
HTML Image and PhpStorm
Cannot resolve file 'logo.png' - said the HTML
<img src="logo.png" alt="Logo" width="314" height="70">
The HTML keeps saying it can't find it, but it ...
0
votes
1answer
23 views
Laravel Blade: How to access string translations of a different locale from the current locale?
I am a newbie to laravel. Please humour me. I am working on a website that can be used in two different languages. I have two files, en.json and te.json, in resources/lang:
// en.json
"language-...
0
votes
2answers
28 views
Laravel: Hide View Data chunk based on user Id
So I have Blade that displays $data with array of menu items:
$data = [
[
'icon' => 'pie-chart',
'name' => 'Example',
'url' => request()->root()...,
'...
0
votes
1answer
25 views
Laravel Livewire Timing Out
Hey all you clever people, I need some help with some livewire, Im making a request to a external API in my component and im wanting to show that on the blade however it just keeps timing out so was ...
0
votes
2answers
16 views
Can't select specific paramter from eloquent relationship collection - works in tinker
I am attempting to get the latest user to have updated a document.
I have setup the database and relationships in the document model as follows:
public function getLastUpdateUser()
{
return $this-&...
1
vote
2answers
80 views
Laravel load external URL in modal window
I have a button on my blade which opens a modal window in laravel-livewire like
<a href="#" wire:click="confirmI">
Also, here's my controller
public function confirmI()
...
0
votes
2answers
41 views
Error in showing laravel data to blade using eloquent
I have this Contractor Model
public function ContractorDetails()
{
return $this->hasOne(ContractorDetails::class)->select('id', 'contractors_id');
}
And ContractorDetails Model
public ...
0
votes
1answer
31 views
pivot table data is not showing in blade php
i have two tables orders and status. it related in a pivot table order_status
in my Order model
public function status()
{
return $this->belongsToMany('App\Status')->withTimestamps();
}
in ...
0
votes
1answer
28 views
TinyMce not showing icons
I am using laravel with blade and Vue.js (the tinymce- wrapper @tinymce/tinymce-vue).
Problem:
TinyMce (version 5.7.0) is not showing icons after i switched from cloud to self hosted.
<template>
...
1
vote
0answers
39 views
Search for total days and attendance at laravel
I want to ask how to get the total days to 30 days. Then after getting a total value of 30 days, the total attendance is sought. The flow that I caught (total days - attendance).
My model:
public ...
0
votes
1answer
24 views
PhpStorm showing 'Attribute value not closed' error
I'm adding a JS file in a blade @section using Blade syntax and Laravel asset links, yet PhpStorm is flagging it as 'Attribute value not closed' with red squiggly lines in the places shown below. It ...
0
votes
0answers
12 views
Statamic V2: Conditions cant be used to filter the collection of block:item
I want to filter the "block:title" that contains "Rewards".
{{ if block:title or block:subtitle or block:description }}
<div class="col-12 col-md-8 m-auto">
<...