×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: idrees amiri
Added: Oct 19, 2021 2:51 AM
Views: 2199
Tags: no tags
  1. <?php
  2. // use App\Models\User;
  3. use App\Http\Controllers\StudentController;
  4. use App\Http\Livewire\ProductController;
  5. use App\Http\Livewire\SubjectController;
  6. use Illuminate\Support\Facades\Route;
  7. use Illuminate\Support\Facades\Cache;
  8. use App\Models\Product;
  9. use App\Models\Subject;
  10.  
  11. use App\Http\Livewire\Crud;
  12.  
  13.  
  14.  
  15. Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
  16.    
  17.     $users = App\Models\User::all();
  18.    
  19.     return view('dashboard', ['users' => $users]);
  20. })->name('dashboard');
  21.  
  22. Route::group(['prefix' => 'dashboard'], function() {
  23.    
  24.     Route::get('products', ProductController::class);
  25.     Route::get('subjects', SubjectController::class)->name('admin.subjects');
  26.     Route::get('subject/latest', [SubjectController::class, 'latestSubjects'])->name('subject.latest');
  27.     Route::get('brands', App\Http\Livewire\BrandController::class)->name('admin.brands');
  28.  
  29.     Route::get('/email/verify', function () {
  30.         return view('auth.verify-email');
  31.     })->middleware('auth')->name('verification.notice');
  32. });
  33.  
  34.  
  35.  
  36.  
  37.  
  38. /**
  39.  *
  40.  * Frontend routes
  41.  */
  42. Route::get('/', function () {
  43.     return view('frontend.index', ['name' => 'Victoria']);
  44.  
  45. })->name('front.home');
  46.  
  47. Route::get('/about', function () {
  48.     return view('frontend.about', ['title' => 'About Us']);
  49.  
  50. })->name('front.about');
  51.  
  52. Route::get('/team', function () {
  53.     return view('frontend.team', ['title' => 'Our Team']);
  54.  
  55. })->name('front.team');
  56.  
  57. Route::get('/testimonials', function () {
  58.     return view('frontend.testimonials', ['title' => 'Testimonials']);
  59.  
  60. })->name('front.testimonials');
  61.  
  62. Route::get('/portfolio', function () {
  63.     return view('frontend.portfolio', ['title' => 'Our portfolio']);
  64.  
  65. })->name('front.portfolio');
  66.  
  67. Route::get('/contact', function () {
  68.     return view('frontend.contact', ['title' => 'contact']);
  69.  
  70. })->name('front.contact');
  71.  
  72. Route::get('/blog', function () {
  73.     return view('frontend.blog', ['title' => 'blog']);
  74.  
  75. })->name('front.blog');
  76.  
  77. Route::get('/portfolio-detail', function () {
  78.     return view('frontend.portfolio-detail', ['title' => 'portfolio-detail']);
  79.  
  80. })->name('front.portfolio-detail');
  81.  
  82. Route::get('/pricing', function () {
  83.     return view('frontend.pricing', ['title' => 'pricing']);
  84.  
  85. })->name('front.pricing');
  86.  
  87.  
  88. Route::get('/services', function () {
  89.     return view('frontend.services', ['title' => 'services']);
  90.  
  91. })->name('front.services');
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. // Route::get('students', Crud::class);
  104. Route::get('students', [StudentController::class, 'index']);
  105. // Route::resource('student', StudentController::class)->middleware('age');
  106.  
  107. Route::get('/products/{id}', function($id){
  108.     $p = Product::find($id);
  109.     return response()->json(['data'=>$p, 'status'=> 'success', 'code'=> 200]);
  110.  
  111. });
  112. // Route::any('users/{user}', function($user) {
  113. //     $result = User::findOrFail($user);
  114.    
  115. //     Cache::add('user_by_id', $result, 150);
  116.    
  117.  
  118. // });
  119.  
  120.  
  121. Route::get('/subject', function () {
  122.      
  123.     //logic of your route
  124.     return "this is a simple response with text";
  125. });