Я получаю ошибку 404 из представления, которое фактически существует в моих маршрутах. Это представление, в котором я выбираю данные (sidebar.blade. php)
<div class="col-xl-3 col-lg-3 col-sm-12 col-xs-12 sidebar-shop-left">
<div class="product-categori">
<div class="search-product">
<form action="#">
<input class="form-control" placeholder="Search here..." type="text">
<button type="submit"> <i class="fa fa-search"></i> </button>
</form>
</div>
<div class="filter-sidebar-left">
<div class="title-left">
<h3>Categories</h3>
</div>
<div class="list-group list-group-collapse list-group-sm list-group-tree" id="list-group-men" data-children=".sub-men">
@foreach($categories as $cat)
<div class="list-group-collapse sub-men">
<a class="list-group-item list-group-item-action" href="#{{$cat->id}}" data-toggle="collapse" aria-expanded="true" aria-controls="sub-men1">{{$cat->name}}
</a>
<div class="collapse hide" id="{{$cat->id}}" data-parent="#list-group-men">
@foreach($cat->categories as $subcat)
@if($subcat->status==1)
<div class="list-group">
<a href="{{ asset('resume/'.$subcat->url) }}" class="list-group-item list-group-item-action active">{{$subcat->name}}</a>
</div>
@endif
@endforeach
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
Это мой файл маршрутов, т. Е. (Web. php).
// use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
// All Routes after Login
Route::group(['middleware'=>['frontlogin']],function(){
Route::get('/view-job','frontController@view');
Route::match(['get', 'post'], '/browse', 'frontController@browse');
Route::get('/resume/{url}','ResumeController@resumes');
// Resume Detail Page
Route::get('/resume/{id}','ResumeController@resume');
});
Route::match(['get', 'post'], '/how', 'frontController@how');
Route::get('/logout', 'AdminController@logout');
Это контроллер файла представления frontController.blade. php (browse_categories.blade. php). Функция browse ()
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Redirect;
use App\Category;
use App\Country;
use App\Enquiry;
use App\Resume;
use App\User;
use App\Job;
use Validator;
use Auth;
use Session;
use Image;
use DB;
class frontController extends Controller
{
public function browse(){
$title='Browse Categories';
$resume = Resume::get();
foreach($resume as $key => $val){
$category_name = Category::where(['id' => $val->category_id])->first();
$resume[$key]->category_name = $category_name->name;
}
$resume = json_decode(json_encode($resume));
// echo "<pre>"; print_r($resume); die;
$categories_menu = "";
$categories = Category::with('categories')->where(['parent_id' => 0])->get();
$categories = json_decode(json_encode($categories));
return view('pages.browse_categories')->with(compact('categories_menu', 'categories', 'resume'), 'title', $title);
}
}
Это файл вида. Я получаю ошибку 404 (detail.blade. php)
@section('content')
<!-- Start All Title Box -->
<div class="all-title-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Details</h2>
<!-- <ul class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Home</a></li>
<li class="breadcrumb-item active">Browse</li>
</ul> -->
</div>
</div>
</div>
</div>
<!-- End All Title Box -->
<!-- Start Shop Page -->
<div class="shop-box-inner">
<div class="container">
<div class="row">
@include('layouts.frontLayouts.frontSidebar')
<div class="col-xl-9 col-lg-9 col-sm-12 col-xs-12 shop-content-right">
<div class="right-product-box">
<div class="product-item-filter row">
<div class="col-12 col-sm-8 text-center text-sm-left">
<!-- <div class="toolbar-sorter-right">
<span>Sort by </span>
<select id="basic" class="selectpicker show-tick form-control" data-placeholder="$ USD">
<option data-display="Select">Nothing</option>
<option value="1">Popularity</option>
<option value="2">High Price → High Price</option>
<option value="3">Low Price → High Price</option>
<option value="4">Best Selling</option>
</select>
</div> -->
<p>Profile Details</p>
</div>
<div class="col-12 col-sm-4 text-center text-sm-right">
<!-- <ul class="nav nav-tabs ml-auto">
<li>
<a class="nav-link" href="#grid-view" data-toggle="tab"> <i class="fa fa-th"></i> </a>
</li>
<li>
<a class="nav-link active" href="#list-view" data-toggle="tab"> <i class="fa fa-list-ul"></i> </a>
</li> -->
</ul>
</div>
</div>
<div class="row product-categorie-box">
<div class="tab-content">
<!-- <div role="tabpanel" class="tab-pane fade" id="grid-view">
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-4 col-xl-4">
@foreach($resume as $res)
<div class="products-single fix">
<div class="box-img-hover">
@if(!empty($res->image))
<img src="{{ asset('/images/uploads/passport/small/'.$res->image) }}" class="img-fluid" alt="Image">
@endif
<div class="mask-icon">
<a class="cart" href="{{ url('/resume/'.$res->id) }}">View Profile</a>
</div>
</div>
<div class="why-text">
<h4>{{ $res->user_name}}</h4>
<h5> {{ $res->category_name}}</h5>
</div>
</div>
</div>
@endforeach
</div>
</div> -->
<div role="tabpanel" class="tab-pane fade show active" id="list-view">
<div class="list-view-box">
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-4 col-xl-4">
<div class="products-single fix">
<div class="box-img-hover">
<!-- <div class="type-lb">
<p class="sale">Sale</p>
</div> -->
<img src="{{ asset('/images/uploads/passport/medium/'.$resumeDetails->image) }}" class="img-fluid" alt="Image">
<!-- <div class="mask-icon">
<ul>
<li><a href="#" data-toggle="tooltip" data-placement="right" title="View"><i class="fas fa-eye"></i></a></li>
<li><a href="#" data-toggle="tooltip" data-placement="right" title="Compare"><i class="fas fa-sync-alt"></i></a></li>
<li><a href="#" data-toggle="tooltip" data-placement="right" title="Add to Wishlist"><i class="far fa-heart"></i></a></li>
</ul>
</div> -->
</div>
</div>
</div>
<div class="col-sm-6 col-md-6 col-lg-8 col-xl-8">
<div class="why-text full-width">
<h4>{{ $resumeDetails ->user_name }}</h4>
<h5>Expected Salary ${{ $resumeDetails->salary}}</h5>
<p>Staff Information: {{ $resumeDetails->summary}}</p>
<a class="btn hvr-hover" href="#">Message</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Shop Page -->
@endsection
Это контроллер вида файл, в котором я получаю ошибку 404, т.е. detail.blade. php (Resume Controller) Функция возобновления
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Validator;
use App\Resume;
use App\Category;
use App\Country;
use App\User;
use Auth;
use Session;
use Image;
use DB;
class ResumeController extends Controller
{
public function resumes($url=null){
$categoryCount = Category::where(['url'=>$url,'status'=>1])->count();
if($categoryCount==0){
abort(404);
}
$categories = Category::with('categories')->where(['parent_id' => 0])->get();
$categoryDetails = Category::where(['url'=>$url])->first();
if($categoryDetails->parent_id==0){
$subCategories = Category::where(['parent_id'=>$categoryDetails->id])->get();
$subCategories = json_decode(json_encode($subCategories));
foreach($subCategories as $subcat){
$cat_ids[] = $subcat->id;
}
$resumeAll = Resume::whereIn('resume.category_id', $cat_ids)->where('resume.status','1')->orderBy('resume.id','Desc');
$breadcrumb = "<a href='/'>Home</a> / <a href='".$categoryDetails->url."'>".$categoryDetails->name."</a>";
}else{
$resumeAll = Resume::where(['resume.category_id'=>$categoryDetails->id])->where('resume.status','1')->orderBy('resume.id','Desc');
$mainCategory = Category::where('id',$categoryDetails->parent_id)->first();
$breadcrumb = "<a href='/'>Home</a> / <a href='".$mainCategory->url."'>".$mainCategory->name."</a> / <a href='".$categoryDetails->url."'>".$categoryDetails->name."</a>";
}
$resumeAll = $resumeAll->paginate(6);
// $resumeAll = json_decode(json_encode($resumeAll));
// echo "<pre>"; print_r($resumeAll); die;
return view('pages.listing')->with(compact('categories','resumeAll','categoryDetails','url','breadcrumb'));
}
public function resume($id = null){
// Show 404 Page if resume is disabled
$resumeCount = Resume::where(['id'=>$id,'status'=>1])->count();
if($resumeCount==0){
abort(404);
}
// Get resume Details
$resumeDetails = Resume::with('experience')->where('id',$id)->first();
$relatedResumes = Resume::where('id','!=',$id)->where(['category_id' => $resumeDetails->category_id])->get();
$categories = Category::with('categories')->where(['parent_id' => 0])->get();
$categoryDetails = Category::where('id',$resumeDetails->category_id)->first();
if($categoryDetails->parent_id==0){
$breadcrumb = "<a href='/'>Home</a> / <a href='".$categoryDetails->url."'>".$categoryDetails->name."</a> / ".$resumeDetails->user_name;
}else{
$mainCategory = Category::where('id',$categoryDetails->parent_id)->first();
$breadcrumb = "<a style='color:#333;' href='/'>Home</a> / <a style='color:#333;' href='/resume/".$mainCategory->url."'>".$mainCategory->name."</a> / <a style='color:#333;' href='/resume/".$categoryDetails->url."'>".$categoryDetails->name."</a> / ".$resumeDetails->user_name;
}
$meta_title = $resumeDetails->user_name;
$meta_description = $resumeDetails->summary;
$meta_keywords = $resumeDetails->user_name;
return view('pages.detail')->with(compact('resumeDetails','categories','relatedResumes','meta_title','meta_description','meta_keywords','breadcrumb'));
}
public function deleteResume($id = null){
Resume::where(['id'=>$id])->delete();
return redirect()->back()->with('flash_message_success', 'Resume has been deleted successfully');
}
}