Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
6.1 kB
5
Indexable
Never
<?php

use App\Http\Controllers\CommentController;
use App\Http\Controllers\CommentsController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\MediaController;
use App\Http\Controllers\PostController;
use App\Http\Controllers\ProgramController;
use App\Http\Controllers\StatisController;
use Illuminate\Support\Facades\Auth;
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 and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', function () {
    if (Auth::check()) 
        {
            if(Auth::user()->role == 1){
                return redirect('dashboard');
            } elseif(Auth::user()->role == 2) {
                return redirect('super-dashboard');
            } else{
                return view('login');
            }
        }
        else
        {
            return view('login');
        }
})->name('/');

Route::post('/login', [LoginController::class,'index'])->name('login');

Route::group(['middleware' => 'auth','user'], function() {
    Route::post('/logout', [LoginController::class,'logout'])->name('logout');
    Route::get('/update-user', [LoginController::class,'updateuser'])->name('update-user');
    Route::post('/store-user', [LoginController::class,'storeuser'])->name('storeuser');
    Route::get('/dashboard', [DashboardController::class,'index'])->name('dashboard');
    Route::get('/statis', [StatisController::class,'index'])->name('statis');

    Route::get('/post', [PostController::class,'index'])->name('post');
    Route::get('/draftpost', [PostController::class,'draftpost'])->name('draftpost');
    Route::get('/publishpost', [PostController::class,'publishpost'])->name('publishpost');
    Route::get('/create-post', [PostController::class,'create'])->name('createpost');
    Route::post('/store-post', [PostController::class,'store'])->name('storepost');
    Route::get('/get-post/{id}', [PostController::class,'get'])->name('getpost');
    Route::post('/update-post', [PostController::class,'update'])->name('updatepost');
    Route::post('/delete-post/{id}', [PostController::class,'delete'])->name('deletepost');
    Route::post('/searchpost', [PostController::class,'searchpost'])->name('searchpost');
    
    Route::get('/media', [MediaController::class,'index'])->name('media');
    Route::get('/image', [MediaController::class,'image'])->name('image');
    Route::get('/document', [MediaController::class,'document'])->name('document');
    Route::get('/video', [MediaController::class,'video'])->name('video');
    Route::get('/audio', [MediaController::class,'audio'])->name('audio');
    Route::get('/download/{id}', [MediaController::class,'download'])->name('download');
    Route::get('/create-media', [MediaController::class,'create'])->name('createmedia');
    Route::post('/store-media', [MediaController::class,'store'])->name('storemedia');
    Route::get('/get-media/{id}', [MediaController::class,'get'])->name('getmedia');
    Route::post('/update-media', [MediaController::class,'update'])->name('updatemedia');
    Route::post('/delete-media/{id}', [MediaController::class,'delete'])->name('deletemedia');
    Route::post('/searchmedia', [MediaController::class,'searchmedia'])->name('searchmedia');
    
    Route::get('/comment', [CommentsController::class,'index'])->name('comment');
    Route::post('/searchcomment', [CommentsController::class,'searchcomment'])->name('searchcomment');
    Route::post('/delete-comment/{id}', [CommentsController::class,'delete'])->name('deletecomment');
    
    Route::get('/program', [ProgramController::class,'index'])->name('program');
    Route::get('/activeprogram', [ProgramController::class,'activeprogram'])->name('activeprogram');
    Route::get('/nonactiveprogram', [ProgramController::class,'nonactiveprogram'])->name('nonactiveprogram');
    Route::get('/create-program', [ProgramController::class,'create'])->name('createprogram');
    Route::post('/store-program', [ProgramController::class,'store'])->name('storeprogram');
    Route::get('/get-program/{id}', [ProgramController::class,'get'])->name('getprogram');
    Route::post('/update-program', [ProgramController::class,'update'])->name('updateprogram');
    Route::post('/delete-program/{id}', [ProgramController::class,'delete'])->name('deleteprogram');
    Route::post('/searchprogram', [ProgramController::class,'searchprogram'])->name('searchprogram');
    
});

Route::group(['middleware' => 'auth','admin'], function() {
    Route::get('/super-dashboard', [DashboardController::class,'superindex'])->name('superdashboard');
    Route::get('/super-user', [DashboardController::class,'superuser'])->name('superuser');
    Route::get('/create-user', [DashboardController::class,'createuser'])->name('createuser');
    Route::post('/storeuser', [DashboardController::class,'storeuser'])->name('storeuser');
    Route::get('/get-user/{id}', [DashboardController::class,'getuser'])->name('getuser');
    Route::get('/catch-user', [DashboardController::class,'mydata'])->name('catch-user');
    Route::post('/saveuser', [DashboardController::class,'saveuser'])->name('saveuser');
    Route::post('/delete-user/{id}', [DashboardController::class,'deleteuser'])->name('deleteuser');
    
    Route::get('/selectadmin', [DashboardController::class,'selectadmin'])->name('selectadmin');
    Route::get('/selectsuperadmin', [DashboardController::class,'selectsuperadmin'])->name('selectsuperadmin');
    Route::post('/searchuser', [DashboardController::class,'searchuser'])->name('searchuser');
    Route::get('/mydata', [DashboardController::class,'mydata'])->name('mydata');
    
});


Leave a Comment