<?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!
|
*/

/*Route::get('/', function () {
    return view('welcome');
});*/

Route::group(['namespace' => 'Admin', 'prefix' => 'admin'], function () {
    
    Route::get('/', 'IndexController@index');

    Route::get('login', [ 'as' => 'login', 'uses' => 'IndexController@index']);
    
    Route::post('login', 'IndexController@postLogin');
    Route::get('logout', 'IndexController@logout');

    Route::get('forgot_password', 'IndexController@forgot_password');
    Route::post('forgot_password', 'IndexController@forgot_password_send');
 
    Route::get('dashboard', 'DashboardController@index');   
    Route::get('profile', 'AdminController@profile');   
    Route::post('profile', 'AdminController@updateProfile');

    Route::get('category', 'CategoryController@list');  
    Route::get('category/add', 'CategoryController@add'); 
    Route::get('category/edit/{id}', 'CategoryController@edit');  
    Route::post('category/add_edit', 'CategoryController@addnew');    
    Route::get('category/delete/{id}', 'CategoryController@delete');

    Route::get('artists', 'ArtistsController@list');  
    Route::get('artists/add', 'ArtistsController@add'); 
    Route::get('artists/edit/{id}', 'ArtistsController@edit');  
    Route::post('artists/add_edit', 'ArtistsController@addnew');    
    Route::get('artists/delete/{id}', 'ArtistsController@delete');

    Route::get('album', 'AlbumController@list');  
    Route::get('album/add', 'AlbumController@add'); 
    Route::get('album/edit/{id}', 'AlbumController@edit');  
    Route::post('album/add_edit', 'AlbumController@addnew');    
    Route::get('album/delete/{id}', 'AlbumController@delete');

    Route::get('songs', 'SongsController@list');  
    Route::get('songs/add', 'SongsController@add'); 
    Route::get('songs/edit/{id}', 'SongsController@edit');  
    Route::post('songs/add_edit', 'SongsController@addnew');    
    Route::get('songs/delete/{id}', 'SongsController@delete');

    Route::get('playlist', 'PlaylistController@list');  
    Route::get('playlist/add', 'PlaylistController@add'); 
    Route::get('playlist/edit/{id}', 'PlaylistController@edit');  
    Route::post('playlist/add_edit', 'PlaylistController@addnew');    
    Route::get('playlist/delete/{id}', 'PlaylistController@delete');

    Route::get('slider', 'SliderController@list');  
    Route::get('slider/add', 'SliderController@add'); 
    Route::get('slider/edit/{id}', 'SliderController@edit');  
    Route::post('slider/add_edit', 'SliderController@addnew');    
    Route::get('slider/delete/{id}', 'SliderController@delete');

    Route::get('home_sections', 'HomeSectionsController@list');  
    Route::get('home_sections/add', 'HomeSectionsController@add'); 
    Route::get('home_sections/edit/{id}', 'HomeSectionsController@edit');  
    Route::post('home_sections/add_edit', 'HomeSectionsController@addnew');    
    Route::get('home_sections/delete/{id}', 'HomeSectionsController@delete');

    Route::get('suggestions', 'SuggestionController@list');
    Route::get('suggestions/delete/{id}', 'SuggestionController@delete');

    Route::get('reports', 'ReportsController@list');
    Route::get('reports/delete/{id}', 'ReportsController@delete');

    Route::get('users', 'UsersController@list');   
    Route::get('users/add', 'UsersController@add'); 
    Route::get('users/edit/{id}', 'UsersController@edit'); 
    Route::post('users/add_edit', 'UsersController@addnew');   
    Route::get('users/delete/{id}', 'UsersController@delete');
    Route::get('users/history/{id}', 'UsersController@user_history');
    Route::get('users/export', 'UsersController@user_export');  

    Route::get('sub_admin', 'UsersController@admin_list'); 
    Route::get('sub_admin/add', 'UsersController@admin_add'); 
    Route::get('sub_admin/edit/{id}', 'UsersController@admin_edit');   
    Route::post('sub_admin/add_edit', 'UsersController@admin_addnew'); 
    Route::get('sub_admin/delete/{id}', 'UsersController@admin_delete');

    Route::get('subscription_plan', 'SubscriptionPlanController@list');  
    Route::get('subscription_plan/add', 'SubscriptionPlanController@add'); 
    Route::get('subscription_plan/edit/{id}', 'SubscriptionPlanController@edit');  
    Route::post('subscription_plan/add_edit', 'SubscriptionPlanController@addnew');
  
    Route::get('payment_gateway', 'PaymentGatewayController@list');
    Route::get('payment_gateway/edit/{id}', 'PaymentGatewayController@edit');   
    Route::post('payment_gateway/paypal', 'PaymentGatewayController@paypal');
    Route::post('payment_gateway/stripe', 'PaymentGatewayController@stripe');
    Route::post('payment_gateway/razorpay', 'PaymentGatewayController@razorpay');
    Route::post('payment_gateway/paystack', 'PaymentGatewayController@paystack');   
    Route::post('payment_gateway/payu', 'PaymentGatewayController@payu');   
    Route::post('payment_gateway/flutterwave', 'PaymentGatewayController@flutterwave');    
    Route::post('payment_gateway/cinetpay', 'PaymentGatewayController@cinetpay');
    Route::post('payment_gateway/banktransfer', 'PaymentGatewayController@banktransfer');
    Route::post('payment_gateway/instamojo', 'PaymentGatewayController@instamojo');

    Route::get('transactions', 'TransactionsController@transactions_list');
    Route::post('transactions/export', 'TransactionsController@transactions_export');

  
    Route::get('pages', 'PagesController@pages_list');  
    Route::get('pages/add', 'PagesController@add'); 
    Route::get('pages/edit/{id}', 'PagesController@edit');  
    Route::post('pages/add_edit', 'PagesController@addnew');    
    Route::get('pages/delete/{id}', 'PagesController@delete');

    Route::get('ad_list', 'AppAdsController@list');
    Route::get('ad_list/edit/{id}', 'AppAdsController@edit');   
    Route::post('ad_list/admob', 'AppAdsController@admob');
    Route::post('ad_list/startapp', 'AppAdsController@startapp');
    Route::post('ad_list/facebook', 'AppAdsController@facebook');
    Route::post('ad_list/applovins', 'AppAdsController@applovins');
    Route::post('ad_list/wortise', 'AppAdsController@wortise');
    Route::post('ad_list/unity', 'AppAdsController@unity');

    Route::get('general_settings', 'SettingsController@general_settings');
    Route::post('general_settings', 'SettingsController@update_general_settings');
    Route::get('email_settings', 'SettingsController@email_settings');
    Route::post('email_settings', 'SettingsController@update_email_settings'); 
    Route::get('test_smtp_settings', 'SettingsController@test_smtp_settings');         
    Route::get('onesignal_notification', 'SettingsController@onesignal_notification');
    Route::post('onesignal_notification', 'SettingsController@update_onesignal_notification');
    Route::get('app_update_popup', 'SettingsController@app_update_popup');
    Route::post('app_update_popup', 'SettingsController@update_app_update_popup');
    Route::get('others_settings', 'SettingsController@others_settings');
    Route::post('others_settings', 'SettingsController@update_others_settings');

    Route::get('netsocks', 'SettingsController@netsocks');
    Route::post('netsocks', 'SettingsController@update_netsocks');

    Route::get('notification_send', 'SettingsController@notification_send');
    Route::post('notification_send', 'SettingsController@send_android_notification');

      
    Route::get('verify_purchase_app', 'SettingsController@verify_purchase_app');
    Route::post('verify_purchase_app', 'SettingsController@verify_purchase_app_update');

    Route::get('api_urls', 'SettingsController@api_urls');

    Route::post('ajax_status', 'ActionsController@ajax_status');
    Route::post('ajax_delete', 'ActionsController@ajax_delete');
 
});

//Site

Route::get('/', 'IndexController@index');
Route::get('page/{id}/{slug}', 'PagesController@page_details');  

//Clear Cache
Route::get('/clear-cache', function() {

    $clearRoute = Artisan::call('route:clear');
    echo "Route cleared. <br/>";

   $clearCache = Artisan::call('cache:clear');
   echo "Cache cleared. <br/>";

   $setCache = Artisan::call('config:cache');
   echo "Cache configured. <br/>";

   $exitCode = Artisan::call('view:clear');

   echo "View cache cleared. <br/>";

   return '<h1>Cache facade value cleared</h1>';
});
