so I keep getting this error Cannot end a section without first starting one in Laravel on my website online but localhost it is working no problem I don't see anything wrong with the code and I tried changing #stop with #endsection still the same, and I repeat I got this error on my online website, not my localhost my localhost is working fine, btw when I removed the heading section the error is gone but I need it.
here's my code
#extends('AdminPanel.master.main')
#section('heading')
Banner Details
<a style="float: right" href="/admin/banners-list" class="btn btn-primary">
<i class="fa fa-arrow-left"></i> Back To List
</a>
#stop
#section('body')
<div class="panel">
<div class="table-responsive">
<ul class="nav nav-tabs" style="margin-bottom: 2%">
<li class="nav-item">
<a class="nav-link active" href="#tab_a" data-toggle="tab">English</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#tab_b" data-toggle="tab">العربية </a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#tab_c" data-toggle="tab">Urdu </a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#tab_d" data-toggle="tab">Chinese </a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active login-tabs" id="tab_a">
<table class="table table-hover profile">
<tbody>
<tr>
<td><i class="fa fa-user fa-fw"></i>Title</td>
<td> {{$data->TitleEn}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Caption</td>
<td> {{$data->CaptionEn}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Image</td>
<td><img #if($data->Image)src="/admin-assests/banner/{{$data->Image}}" #endif width="200px"
height="200px"></td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane login-tabs" id="tab_b">
<table class="table table-hover profile">
<tbody>
<tr>
<td><i class="fa fa-user fa-fw"></i>العنوان</td>
<td> {{$data->TitleAr}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>الوصف</td>
<td> {{$data->CaptionAr}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Image</td>
<td><img #if($data->Image)src="/admin-assests/banner/{{$data->Image}}" #endif width="200px"
height="200px"></td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane login-tabs" id="tab_c">
<table class="table table-hover profile">
<tbody>
<tr>
<td><i class="fa fa-user fa-fw"></i>العنوان</td>
<td> {{$data->TitleUr}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>الوصف</td>
<td> {{$data->CaptionUr}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Image</td>
<td><img #if($data->Image)src="/admin-assests/banner/{{$data->Image}}" #endif width="200px"
height="200px"></td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane login-tabs" id="tab_d">
<table class="table table-hover profile">
<tbody>
<tr>
<td><i class="fa fa-user fa-fw"></i>العنوان</td>
<td> {{$data->TitleCh}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>الوصف</td>
<td> {{$data->CaptionCh}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Image</td>
<td><img #if($data->Image)src="/admin-assests/banner/{{$data->Image}}" #endif width="200px"
height="200px"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 pull-right">
Edit Info
</div>
</div>
#stop
main
<html lang="en">
<head>
#include('AdminPanel.master.head')
#include('AdminPanel.master.navbar')
</head>
<body>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">#yield('heading')</h1>
</div>
</div>
#yield('body')
</div>
#include('AdminPanel.master.footer')
</body>
Related
I have a series of processes that handle items in a warehouse, now, the problem is that if the item is pending in an inventory adjustment operation, it should not allow a purchase/sale to be processed.
My intention is to go through the items of a sale, check if there is any pending in a stock adjustment and if so, not let the operation be processed until the adjustment is approved/rejected, but I am not succeeding, since I don't know how to loop through everything before processing a condition.
For now I have:
#foreach ($venta->detalleventas as $detalleventa)
#if ($detalleventa->articulo->ajusinv == 'y')
<a class="jsgrid-button btn btn-warning">
Ajuste pendiente <i class="fas fa-exclamation-triangle"></i>
</a>
#break
#else
<a class="btn btn-success" href="{{ route('cambio.estado.ventas', $venta) }}"
title="Aprobar"><i class="fas fa-check"></i>
</a>
<a class="btn btn-danger text-white" href="{{ route('cambio.rechazado.ventas', $venta) }}"
title="Rechazar"><i class="fas fa-ban"></i>
</a>
#endif
#endforeach
But it is repeating the approve and reject buttons to me as follows:
My table is:
<table id="order-listing"
class="table venta .table-hover table-striped mt-0.5 table-bordered shadow-lg dt-responsive">
<thead class="bg-primary text-white">
<tr>
<th scope="col" width='10px'>ID</th>
<th scope="col" width='50px'>Fecha</th>
<th scope="col" width='80px'>Empleado</th>
<th scope="col" width='10px'>#</th>
<th scope="col" width='350px'>Artículos</th>
<th scope="col" width='70px'>Almacenes</th>
<th scope="col" width='100px'>Estado</th>
<th scope="col" width='165px'>Acciones</th>
</tr>
</thead>
<tbody>
#foreach ($ventas as $venta)
<tr>
<td>{{ $venta->id }}</td>
<td>
{{ \Carbon\Carbon::parse($venta->created_at)->format('d-m-y') }}
</td>
<td>{{ ucwords($venta->cliente->nombre) }} {{$venta->cliente->apellido}}</td>
<td>
#foreach ($venta->detalleventas as $detalleventa)
{{$detalleventa->cantidad}} <br>
#endforeach
</td>
<td style="width: 50px;">
#foreach ($venta->detalleventas as $detalleventa)
• {{$detalleventa->articulo->nombre}} <br>
#endforeach
</td>
<td>
#foreach ($venta->detalleventas as $detalleventa)
{{$detalleventa->almacen->nom_alm}} <br>
#endforeach
</td>
<td>
<a class="btn btn-warning text-bold" target="_blank">Por aprobar</a>
</td>
<td style="width: 50px;">
#can('cambio.estado.ventas')
#foreach ($venta->detalleventas as $detalleventa)
#if ($detalleventa->articulo->ajusinv == 'y')
<a class="jsgrid-button btn btn-warning">
Ajuste pendiente <i class="fas fa-exclamation-triangle"></i>
</a>
#break
#else
<a class="btn btn-success" href="{{ route('cambio.estado.ventas', $venta) }}"
title="Aprobar"><i class="fas fa-check"></i>
</a>
<a class="btn btn-danger text-white" href="{{ route('cambio.rechazado.ventas', $venta) }}"
title="Rechazar"><i class="fas fa-ban"></i>
</a>
#endif
#endforeach
#endcan
#can('ventas.pdf')
<a href="{{ route('ventas.pdf', $venta) }}" class="btn btn-secondary text-bold" title="Imprimir"
target="_blank"><i class="fas fa-file-pdf"></i></a>
#endcan
#can('ventas.show')
<a href="{{ route('admin.ventas.show', $venta) }}" class="btn btn-info" title="Ver detalles"><i
class="fas fa-eye"></i> </a>
#endcan
</td>
</tr>
#endforeach
</tbody>
</table>
Well, my solution was to use #php(count=0) and if the condition applies the counter goes up and then the if depends on that number
#php($count=0)
#foreach ($venta->detalleventas as $detalleventa)
#if ($detalleventa->articulo->ajusinv == 'y')
#php($count++)
#endif
#endforeach
#if ($count >= 1)
<a class="jsgrid-button btn btn-warning">
Ajuste pendiente <i class="fas fa-exclamation-triangle"></i>
</a>
#break
#else
<a class="btn btn-success" href="{{ route('cambio.estado.ventas', $venta) }}"
title="Aprobar"><i class="fas fa-check"></i>
</a>
<a class="btn btn-danger text-white" href="{{ route('cambio.rechazado.ventas', $venta) }}"
title="Rechazar"><i class="fas fa-ban"></i>
</a>
#endif
Hi everyone this is the following code:
header.php
<?php
DatabaseConnect::getDbConnection();
?>
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Azubi Site</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<body class="bg-light">
<?php if ($controller->getShowNavigationBar() === true) { ?>
<nav class="navbar p-2 navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" target="_blank" href="https://www.randompage.com/"><img width="100px" alt="Fatchip-Logo" class="img-thumbnail" src="Views/Images/random_logo.png"></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="<?= $controller->getUrl('index.php')?>">List</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= $controller->getUrl('index.php?controller=AzubiForm')?>">Form</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= $controller->getUrl('index.php?controller=Profile')?>">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= $controller->getUrl('index.php?controller=AzubiCards')?>">Team</a>
</li>
</ul>
<a class="dflex" href="<?= $controller->getUrl('index.php?controller=Logout')?>"><img width="50px" src="Views/Images/exit.png"></a>
</div>
</div>
<?php } ?>
</nav>
<?php include __DIR__.'/errorBox.php' ?>
<div class="container d-flex align-items-center justify-content-center">
list.php
<?php
/** #var AzubiList $controller */
$data = $controller->getAzubiData();
$search = $this->getRequestParameter('search');
$this->deleteSelected(); ?>
<div class="mainContent bg-light p-2">
<form class="list_form" action="<?php echo $controller->getUrl('index.php'); ?>" method="post">
<div class="input-group mb-3">
<input name="search" type="text" class="form-control" placeholder="Search" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<input class="btn btn-primary" value="Search" type="submit" name="submit-search">
</div>
</div>
<br>
<table style="padding: 10px; border-radius: 10px;" class="table table-striped">
<thead class="table-dark">
<tr>
<th scope="col">Select</th>
<th scope="col">Name</th>
<th scope="col">Birthday</th>
<th scope="col">Email</th>
<th scope="col">Edit</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
foreach ($data as $azubi){ ?>
<tr>
<td><input type="checkbox" class="selectButtonList" name="checkedId[]" value="<?= $azubi->getId(); ?>"></td>
<td><?= $azubi->getName(); ?></td>
<td><?= $azubi->getBirthday(); ?></td>
<td><?= $azubi->getEmail(); ?></td>
<td><img style="width: 25px" src="Views/images/1200px-Simpleicons_Business_crayon-pen-variant-in-diagonal-position.svg.png">
</td>
<td><img style="width: 15px" src="Views/images/1000_F_272554194_9bJhYSJkUcLbTjXfDlDANV2RyQYGO06N.jpg"></td>
</tr>
<?php }?>
</tbody>
</table>
<div class="pagination justify-content-center">
<?php
$totalPages = $controller->getNumberOfPages();
for ($i=1; $i <= $totalPages; $i++){
if (!empty($search)){
echo "<a class='page-link' href='index.php?page=".$i."&search=".$search."'>".$i."</a>";
echo "<br>";
echo "<br>";
echo "<a style='position: absolute; top: 0; right: 0;' class='btn btn-secondary' href='index.php'>Refresh Page</a>";
} else {
echo "<a class='page-link' href='index.php?page=".$i."'>".$i."</a>";
}
}
?>
</div>
<br>
<div class="row">
<div class="col-lg-6">
<div class="buttonLinkForm">
<a class="btn btn-success" role="button" href="<?php echo $controller->getUrl('index.php?controller=AzubiForm'); ?>">Neue Azubi anlegen</a>
</div>
</div>
<div class="col-lg-6 d-flex flex-row-reverse">
<div>
<input class="btn btn-danger" type="submit" name ="delete_all_button" value="Ausgewählte Azubis löschen">
</div>
</div>
</div>
</form>
</div>
Basically, I would like to display this webpage in a responsive manner, meaning that it can properly viewed on smaller displays(iphone 6/7/8). The Navbar has already been done, however I am having a bit of trouble with the table. Would kinly appreciate the help and suggestions! Thankyou!
I need to use pagination on a laravel blade, but from the controller comes another variable that does not pass pagination, how can I solve it?
<div class="main-content">
<div class="breadcrumb">
<h1>Página de Cliente</h1>
</div>
<div class="separator-breadcrumb border-top"></div>
<div class="card user-profile o-hidden mb-4">
<div class="user-info"><img class="profile-picture avatar-lg mb-2" alt="" />
<p class="m-0 text-24">{{ $customer->name }}</p>
<p class="text-muted m-0">{{ $customer->email }}</p>
</div>
<div class="card-body">
<ul class="nav nav-tabs profile-nav mb-4" id="profileTab" role="tablist">
<li class="nav-item"><a class="nav-link active" id="timeline-tab" data-toggle="tab" href="#timeline" role="tab" aria-controls="timeline" aria-selected="false">Propostas</a></li>
<li class="nav-item"><a class="nav-link" id="about-tab" data-toggle="tab" href="#about" role="tab" aria-controls="about" aria-selected="true">#</a></li>
<li class="nav-item"><a class="nav-link" id="friends-tab" data-toggle="tab" href="#friends" role="tab" aria-controls="friends" aria-selected="false">#</a></li>
<li class="nav-item"><a class="nav-link" id="photos-tab" data-toggle="tab" href="#photos" role="tab" aria-controls="photos" aria-selected="false">#</a></li>
</ul>
<div class="tab-content" id="profileTabContent">
<div class="tab-pane fade active show" id="timeline" role="tabpanel" aria-labelledby="timeline-tab">
<div class="row mb-4">
<div class="col-md-12 mb-3">
<div class="card text-left">
<div class="card-body">
<h4 class="card-title mb-3">Lista de Propostas</h4>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Data</th>
<th scope="col">Vendedor</th>
<th scope="col">Produto</th>
<th scope="col">Preço</th>
<th scope="col">Produção</th>
</tr>
</thead>
#foreach($proposals as $proposal)
<tbody>
<tr>
<th scope="row"> {{ $proposal->id_proposal }} </th>
<td> {{ $proposal->date }} </td>
<td> {{$proposal->users()->first()->name }} </td>
<td>
#foreach($proposal->proposed_phases()->get() as $proposedphase)
<p>{{ $proposedphase->features()->first()->name }}</p>
#endforeach
</td>
<td>
#foreach($proposal->proposed_phases()->get() as $proposedphase)
<p>{{ $proposedphase->amount }}€</p>
#endforeach
</td>
#if($proposal->id_production == null)
<td><span class="badge badge-danger">Produção</span></td>
#else
<td><span class="badge badge-success">Produção</span></td>
#endif
#if($proposal->id_production == null)
<td>
<a href="{{ URL::route('new.production', array('id_proposal'=>$proposal->id_proposal)) }}" class="text-success mr-2">
<button class="nav-icon i-Add font-weight-bold btn btn-success m-0" type="button" data-toggle="tooltip" data-placement="top" title="Criar Produção"></button>
</a>
</td>
#else
<td>
<a href="{{ URL::route('new.label', array('id_proposal'=>$proposal->id_proposal)) }}" class="text-success mr-2">
<button class="nav-icon i-Add font-weight-bold btn btn-warning m-0" type="button" data-toggle="tooltip" data-placement="top" title="Criar Etiquetas"></button>
</a>
</td>
#endif
</tr>
</tbody>
#endforeach
</table>
{{-- Pagination --}}
<div class="d-flex justify-content-center">
{!! $proposals->links() !!}
</div>
</div>
</div>
</div>
</div>
CONTROLLER
public function PageCustomer(Request $request)
{
$data = $request->all();
$customer = customer::where('id_customer', $data['id_customer'])->first();
$proposals = proposal::where('id_customer', $customer['id_customer'])->paginate(5);
return view('admin.customer.page_customer', compact('customer', 'proposals'));
}
the variable that does not pass to the second page is $customer
I tried to pass an array with the values of name and email, but it didn't work. how can i resolve this situation?
Use appends on Paginator :
{!! $proposals->appends(['customer' => $customer])->links() !!}
As of Laravel 7, you can call the withQueryString() method on your Paginator instance :
{!! $proposals->withQueryString()->links() !!}
withQueryString() method appends all current query string values to the pagination links.
I'm new to Laravel, and I cannot find my mistake. I'm sure it's stupid, but the error message it's not really explicit, and I have not found a similar error on the net.
I have this Blade template:
#extends('basicTemplateInside')
#section('title')
ABC
#endsection
#section('content')
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
#foreach ($lines as $line)
<tr>
<td> {{ $line->name }} </td>
<td> {{ $line->creationTimeStamp }} </td>
<td></td>
<td><span class="glyphicon glyphicon-pencil"></span></td>
<td><span class="glyphicon glyphicon-remove"></span></td>
</tr>
#endforeach
</tbody>
</table>
#endsection
and it gives me this error in line 19 [ #foreach ($lines as $line) ]:
Whoops, looks like something went wrong.
FatalErrorException in 79b7933d82e3f98a55e82cb71b63543f97265b8b.php line 19: parse error
1. in 79b7933d82e3f98a55e82cb71b63543f97265b8b.php line 19
If you think the problem might be in the controller, here is the code:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\CableType;
class CableTypesContoller extends Controller
{
public function show(){
$cableTypes = CableType::all();
//$data = array('lines'=>$cableTypes,'title'=>'Cable Types');
//return view('insideTable5wDelSee')->with($data);
return view('insideTable5wDelSee')->with('lines',$cableTypes);
}
}
The compiled file 79b7933d82e3f98a55e82cb71b63543f97265b8b.php :
<?php $__env->startSection('title'); ?>
ABC
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($lines as $line): ?>
<tr>
<td> <?php echo e( $line->name); ?> </td>
<td> <?php echo e($line->creationTimeStamp); ?> </td>
<td></td>
<td><span class="glyphicon glyphicon-pencil"></span></td>
<td><span class="glyphicon glyphicon-remove"></span></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('basicTemplateInside', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
and basicTemplateInside.blade.php :
#extends('basicTemplate')
#section('body')
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"> ****** </a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="content" style="margin-top: 5%;">
<div class="col-md-10 col-md-offset-1">
<div class="row">
<h1>#yield('title')</h1>
</div>
<div class="row">
#yield('content')
</div>
</div>
</div>
#endsection
and basicTemplate.blade.php (if you need the one before, you might need this one too) :
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>****** - #yield('pageTitle')</title>
<link href="{{ URL::asset('css/bootstrap.min.css')}}" rel="stylesheet" >
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
#yield('body')
<script src="{{ URL::asset('js/jQuery.js')}}"></script>
<script src="{{ URL::asset('js/bootstrap.min.js')}}"></script>
</body>
</html>
Thank you for your time.
I am using laravel 5.3
I have a responding navigation menu, when I click on domains, it shows all the domains I already have in DB, and then when I click on one of these domains I get the corresponding projects.
Now, I am want that when I click on project it displays all the corresponding data in a table for example. But, this is what I am getting :
this is ProjectController :
public function index(Request $request)
{
$projects1=DB::table('projects')->where('domain_id', '=', 1)->get();
$projects2=DB::table('projects')->where('domain_id', '=', 2)->get();
$projects3=DB::table('projects')->where('domain_id', '=', 3)->get();
return view('projects.index',compact('projects', 'projects1', 'projects2', 'projects3'));
}
and this is index.blade.php :
<div class="nav-side-menu">
<div class="brand">Menu</div>
<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
<div class="menu-list">
<ul id="menu-content" class="menu-content collapse out">
<li data-toggle="collapse" data-target="#products" class="collapsed active">
<i class="fa fa-gift fa-lg"></i> Domains <span class="arrow"></span>
</li>
<ul class="sub-menu collapse" id="products">
<li data-toggle="collapse" data-target="#domain1_projet" class="collapsed active">
<i class="fa fa-gift fa-lg"></i> Domain 1 <span class="arrow"></span>
</li>
<ul class="sub-menu collapse" id="domain1_projet">
#foreach ($projects1 as $key => $project)
<li>{{$project->title}}</li>
#endforeach
<table class="table table-bordered">
<tr>
<th>No</th>
<th>title</th>
<th>code</th>
<th>domain_id</th>
</tr>
#foreach ($projects1 as $key => $project1)
<tr>
<td>{{ ++$i }}</td>
<td>{{ $project1->title }}</td>
<td>{{ $project1->code }}</td>
<td>{{ $project1->domain_id}}</td>
</tr>
#endforeach
</table>
</ul>
<li data-toggle="collapse" data-target="#domain2_projet" class="collapsed active">
<i class="fa fa-gift fa-lg"></i> Domain 2 <span class="arrow"></span>
</li>
<ul class="sub-menu collapse" id="domaine2_projet">
#foreach ($projects2 as $key => $project)
<li>{{$project->title}}</li>
#endforeach
</ul>
</ul>
</ul>
</div>
</div>
the #if clause I added before table was just to test, but I need to change that. I want to be able to display data of each project not in a manual way. I also want to know how to show and hide the information of each project when clicking on the links.
As you can see in index.blade.php, It's because I already know the names of project I did if (($project->intitule)=="Title") and elseif(($project->intitule)=="Project2") But, in fact I have many projects in database. How can I be able to display all the projects and then when I click on one of them, how can get a table containing information of that specific project
CONTROLLER
public function index(Request $request)
{
$projects=DB::table('projects')->get();
return view('projects.index',compact('projects'));
}
VIEW
<div class="nav-side-menu">
<div class="brand">Menu</div>
<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
<div class="menu-list">
<ul id="menu-content" class="menu-content collapse out">
<li data-toggle="collapse" data-target="#products" class="collapsed active">
<i class="fa fa-gift fa-lg"></i> Domains <span class="arrow"></span>
</li>
<ul class="sub-menu collapse" id="products">
#for ($i = 0; $i < count($projects); $i++)
<li data-toggle="collapse" data-target="#domain1_projet{{$i}}" class="collapsed active">
<i class="fa fa-gift fa-lg"></i> Domain {{$projects[$i]->domain_id}} <span class="arrow"></span>
</li>
<ul class="sub-menu collapse" id="domain1_projet{{$i}}">
<li>{{$projects[$i]->title}}</li>
<table class="table table-bordered">
<tr>
<th>No</th>
<th>title</th>
<th>code</th>
<th>domain_id</th>
</tr>
<tr>
<td>{{ $i }}</td>
<td>{{ $projects[$i]->title }}</td>
<td>{{ $projects[$i]->code }}</td>
<td>{{ $projects[$i]->domain_id}}</td>
</tr>
</table>
</ul>
#endfor
</ul>
</ul>
</div>
</div>
Try it! and let me know if return errors!