I am passing a route and trying to show on view page, but it's giving me route not found error, please check my code and let me know where i am mistaking.
here is my route.php file..
Route::get('amenities-view', 'PropertyController#amenitiesview');
Here are my controller.php file..
public function amenitiesview()
{
$amenities=Amenity::all();
return view('admin.amenities.amenity', compact($amenities));
}
here are my leftsidebar.blade.php file (Where i am clicking and going to amenity.blade.php file)
<li>
<a href="{{route('amenities.amenity')}}">
Amenities List
</a>
</li>
and here is my amenity.blade.php file..
#extends('layouts.adminPanel')
#section('body')
<body class="page-ecommerce-product">
#endsection
#section('admin-content')
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger" role="alert" style="display: none;">
<ul id="blogErrors">
</ul>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-action">
<button class="btn btn-close"></button>
<button class="btn btn-min"></button>
<button class="btn btn-expand"></button>
</div>
<div class="panel-title">Add Amenities</div>
<p>Code Here</p>
</div><!-- /.panel-heading -->
</div><!--/.panel-->
</div>
</div><!-- /.row -->
</div>
#endsection
You are using a route without naming it. use like below
Route::get('amenities-view', 'PropertyController#amenitiesview')->name('amenities.amenity');
Laravel Documentation about named routing.
Related
i installed livewire successfully but when i return the page and the page has
this
#livewire('counter')
it returns error
Livewire\Redirector::component(): Argument #1 ($component) must be of type Livewire\Component, App\Http\Livewire\Counter given
here is my test page
#extends('layouts.master')
#section('css')
#section('title')
empty
#stop
#endsection
#section('page-header')
<!-- breadcrumb -->
<div class="page-title">
<div class="row">
<div class="col-sm-6">
<h4 class="mb-0"> </h4>
</div>
<div class="col-sm-6">
<ol class="breadcrumb pt-0 pr-0 float-left float-sm-right ">
<li class="breadcrumb-item">Home</li>
<li class="breadcrumb-item active">Page Title</li>
</ol>
</div>
</div>
</div>
<!-- breadcrumb -->
#endsection
#section('content')
<!-- row -->
<div class="row">
<div class="col-md-12 mb-30">
<div class="card card-statistics h-100">
<div class="card-body">
#livewire('counter')
</div>
</div>
</div>
</div>
<!-- row closed -->
#endsection
#section('js')
#endsection
and my livewire/counter.blade.php page
<div>
hello world
</div>
and route
Route::get('test', function () {
return view('test');
});
I am doing a small project with vue.js and laravel. I have a list of products, when I click on a specific product on "Quick view" button I want to show all data about that product in a modal but the data is not showing in the modal.
Can you help me please. Here is my code:
#extends('app')
#section('content')
<div id ="crud" class="row">
<div class="col-xs-12">
<h1 class="page-header">Lista de Articulo</h1>
</div>
<div class="wrap-icon right-section col-md-12" data-toggle="modal" data-target="#list" >
<div class="wrap-icon-section wishlist">
<a href="#" class="link-direction">
<i class="fa fa-heart" aria-hidden="true"></i>
<div class="left-info">
<span class="index">0 item</span>
<br>
<span class="title">Wishlist</span>
</div>
</a>
</div>
</div>
<div class="row">
<div v-for="keep in keeps" class="col-md-4" style="width:25%;" #mouseover="showByIndex = keep" #mouseout="showByIndex = null">
<div class="container">
<img :src="keep.foto" style="width:100%; max-width:150px;">
<button class="btn" v-show="showByIndex === keep" v-on:click.prevent="showKeep(keep)">Quick view</button>
</div>
<h3>
<b> #{{keep.nombre}}</b>
</h3>
<p> #{{keep.descripcion}}</p>
I fixed it. The error was because I called the modal file outside the div. Thanks to everybody.
you can't send data directly from vue in blade structure, you need to write a component for that.
https://v3.vuejs.org/examples/modal.html#modal-component
I am a beginner in Laravel, and was wondering if any way to confirm delete before it go to /delete/{id}?
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading"><h2>List of Records:</h2></div>
</div>
<div class="card">
<div class="card-header">Dashboard</div>
<div class="card-body">
#if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
#endif
<p class="bg-primary">Record ID {{$record->id}}</p>
<p class="bg-success">Respond ID {{$record->col1}}</p>
<p class="bg-info">Start Date {{$record->col2}}</p>
<p class="bg-warning">End Date {{$record->col3}}</p>
<p class="bg-danger">Better Consumer Tools {{$record->col4}}</p>
<p class="bg-primary">More public education {{$record->col5}}</p>
<p class="bg-success">Strengthen energy efficiency {{$record->col6}}</p>
<p class="bg-info">Phase out inefficient stuff {{$record->col7}}</p>
<p class="bg-warning">Demand program {{$record->col8}}</p>
<p class="bg-danger">Lower business needs {{$record->col9}}</p>
<p class="bg-primary">Stronger standards {{$record->col10}}</p>
<p class="bg-success">Created at {{$record->created_at->format('d/m/y H:i')}}</p>
<p class="bg-info">Edit|Delete<p>
<button type="button">Go back to Main</button>
</div>
</div>
</div>
</div>
</div>
#endsection
if I use JavaScript functions, how could the function handle the anchor tag to href route?
use this in your anchor tag
<a onclick="return confirm('Are you sure?')" href="deleteRec/{{$record->id}}">Delete</a>
I install Auth in my laravel project. In my user table i define a role colum for define Teacher and Student. so in my blade page I want to give access some part for the teacher and hide that part for the student. But I can't do that.
Here is my code: this part only for the teacher.
#if($user->role==Teacher)
<div class="">
<div class="">
<div class="col-md-7 col-md-offset-3">
{!! Form::open(['files'=>true])!!}
<div class="panel panel-default">
<div class="panel-heading">Submit your works</div>
<div class="panel-body">
<div class="form-group>">
<label>Write a new title</label>
<textarea class="form-control" name="assainments" id="assainments"></textarea>
</div>
</div>
<div class="panel-footer clearfix">
<div class="row">
<div class="col-md-6">
<label for="file-upload" class="custom-file-upload">
<i class="glyphicon glyphicon-paperclip"></i>
</label>
<input id="file-upload" name="status_file_upload" type="file"/>
</div>
<div class="col-md-6">
<button class="btn btn-info pull-right btn-am"><i class="fa fa-plus">Add works</i></button>
</div>
</div>
</div>
</div>
#endif
To use the $userin your view you need to pass it from the controller or the method from which you are calling the view.<br/>
Or instead of$useryou can useAuth::user()`:
#if(Auth::user()->role==Teacher)
I want to be able to add as many widgets as i want to a page.
To make it easier to visualize, here is what i want to achieve:
Master Page
Regular Page
In regular page, i want to call blade template panel as many times as i want. Of course, i would like to change sections inside each panel too.
Master Page
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">#yield('title')</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-8">
#yield('panelsLeft')
</div>
<!-- /.col-lg-8 -->
<div class="col-lg-4">
#yield('panelsRight')
</div>
<!-- /.col-lg-4 -->
</div>
<!-- /.row -->
Panel Partial
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-{{ $panelIcon }} fa-fw"></i> #yield('panelTitle')
<div class="pull-right">
<div class="btn-group">
#yield('panelActions')
</div>
</div>
</div>
<!-- /.panel-heading -->
<div class="panel-body">
#yield('panelBody')
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
Regular Page
I want my regular page to extend master page, include as many panels as needed, and set sections of each of them. How can i achieve this?
I couldn't find an answer to this problem. Here is what i tried but it doesn't work:
#extends('layouts.content')
#section('title')
Dashboard
#stop
#section('panelsLeft')
#include('layouts.partial.panel', ['panelIcon'=>'flag'])
#section('panelTitle')
Current Projects
#stop
#section('panelActions')
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star"></span> Create New Project
</button>
#stop
#section('panelBody')
<ul class="project-list">
{{ $projects }}
</ul>
#stop
#include('layouts.partial.panel', ['panelIcon'=>'user'])
#section('panelTitle')
Current Users
#stop
#section('panelActions')
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star"></span> Create New User
</button>
#stop
#section('panelBody')
<ul class="user-list">
{{ $users }}
</ul>
#stop
#stop