Questions tagged [laravel-components]

Official documentation: https://laravel.com/docs/8.x/blade#components

34 questions
0
votes
1 answer

laravel - passing data to class-based component, without @props

I have this component: class CategorySelect extends Component { public $id_name, $selected; public function __construct($selected=-1, $id_name="default_id") { $this->id_name = $id_name; $this->selected = $selected; …
yossi
  • 3,090
  • 7
  • 45
  • 65
0
votes
0 answers

How submitting this form trigger method of a component?

In laravel 9 I have component which I created with command php artisan make:component ProductCardReport In app/View/Components/ProductCardReport.php I get some data with eloquent :
mstdmstd
  • 2,195
  • 17
  • 63
  • 140
0
votes
1 answer

Laravel : Conditional block for the @foreach() in blade

@foreach (($loop->index == 3 ? FILTER_OPTION_NEW_EXISTING : ($loop->index == 4 ? $franchiseTypes : $categories)) as ($loop->index == 3 ? $key => $value : $item)) How can I attain this one? The first part of the @foreach depends on the loop->index…
MDB
  • 339
  • 4
  • 19
0
votes
1 answer

Laravel - One component class for multiple component views

I would like to create one "parent" component class that can render multiple different views based on which "child" view you pass in. For example, I would like to create a directory resources/views/components/icon where I could put…
0
votes
2 answers

pushing javascript codes at blade does not work out

I have a file called all.blade.php which goes like this: @component('admin.layouts.content' , ['title' => 'example file']) @slot('breadcrumb') @endslot …
japose7523
  • 29
  • 2
  • 15
0
votes
1 answer

Including Javascript codes with @stack not working

I'm working with Laravel 8 and I have a master.blade.php goes like this: @yield('content')
japose7523
  • 29
  • 2
  • 15
0
votes
0 answers

php artisan make:component not exist after upgrade from Laravel 6 to Laravel 9

i have upgraded from laravel 6 to 7 then 8 then 9 and make:component command not exist how to update it ?
0
votes
1 answer

Difference between @aware and @props directives in laravel 9

The @aware Laravel Blade template directive was introduced in Laravel 8, but I still don't understand what it does differently from the already existing @props directive. For instance, if I use a Blade template like this:
Udo E.
  • 2,665
  • 2
  • 21
  • 33
0
votes
1 answer
0
votes
1 answer

Laravel can not pass variable from controller to component

I can not see my variable in component Controller class DigitalContentController extends Controller { public function productsList(){ $contents = DigitalContent::all(); return view('pages.digitalContents',…
CC7052
  • 563
  • 5
  • 16
0
votes
2 answers

Laravel: getting blade components syntax error, unexpected 'endif' (T_ENDIF), expecting end of file

I am learning laravel on Laracast however I am having some issues I have this code on file components/layout.blade.php Host Cloud Template - Services {{$content}} And this on…
0
votes
1 answer

Laravel component not showing

I'm trying to learn laravel and I'm trying to use some components. I've created a layout component which is including the navbar and it's correctly working. I'm still working with key/values arrays into the controller, as I did not study databases…
0
votes
0 answers

Yajra Datatable and Laravel-breeze, maybe csrf_token problem

I made a table using yajra datatables, everything works fine (buttons, table title, table data, editing, etc.) (Listing 1). Now I am trying to implement this using Laravel 8 components, but I do not understand how to do it correctly. I gave an…
0
votes
1 answer

In a Laravel component, how to do I remove a default class?

In a Laravel component, you can specify default classes and merge them with extra classes that get passed in, something like this: merge(['class' => 'text-white']) }}>{{ $slot }} But what if I want to remove that "text-white"…
Magmatic
  • 1,754
  • 3
  • 19
  • 34
0
votes
0 answers

Laravel 8: How to pass data from grand parent component to grand children?

I've recently started working with Laravel during one of my courses and those components look really promising. One problem though, that I've come across, is passing data from, let's say, the controller, to a nested component. Here's my…