@johndoee Hi. Why the themes directory is not in your resource/views directory since it seems to contains blade view templates?
May 8, 2024
1
Level 2
production.ERROR: View [themes.edugator.index] not found
My laravel app folder structure is as follow in localhost
source /
├── app/
├── bootstrap/
├── config/
├── database/
├── public_html /
├── assets/
├── themes/ <-- Themes directory
│ │ ├── edugator/
│ │ └── index.blade.php
├── index.php/
├── resources/
│ ├── lang/
│ ├── views/
│ │
├── routes/
├── storage/
├── tests/
└── vendor/
in hostinger shared hosting server, as follow
public_html /
├── assets/
├── themes/ <-- Themes directory
│ │ ├── edugator/
│ │ │ └── index.blade.php
├── index.php/
source /
├── app/
├── bootstrap/
├── config/
├── database/
├── resources/
│ ├── lang/
│ ├── views/
│ │
├── routes/
├── storage/
├── tests/
└── vendor/
index.php is as follow
<?php
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
define('ROOT_PATH',__DIR__);
/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/
if (file_exists($maintenance = __DIR__.'/../source/storage/framework/maintenance.php')) {
require $maintenance;
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../source/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../source/bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle(
$request = Request::capture()
)->send();
$kernel->terminate($request, $response);
here is function.php for themes view
if ( ! function_exists('get_theme')) {
function get_theme(){
$theme_slug = get_option('current_theme', 'edugator');
$theme_path = public_path("themes/{$theme_slug}/");
$theme_url = asset("themes/{$theme_slug}");
$info = [
'name' => 'Warehouse',
'version' => '1.0.0',
'slug' => $theme_slug,
'view' => "themes.{$theme_slug}.",
'path' => $theme_path,
'url' => $theme_url,
];
return (object)$info;
}
}
/**
* @param null $view
* @return string
*
* Return current theme directory
*/
if ( ! function_exists('theme')) {
function theme($view = null){
return get_theme()->view . $view;
}
}
if ( ! function_exists('theme_asset')) {
function theme_asset($path = ''){
return get_theme()->url . '/assets/' . $path;
}
}
if ( ! function_exists('theme_url')){
function theme_url($path = ''){
return get_theme()->url . '/' . $path;
}
}
here is AppServiceProvider
<?php
namespace App\Providers;
use App\Option;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
if (file_exists(base_path('.env'))) {
try {
DB::connection()->getPdo();
/**
* Get option and set it to config
*/
$options = Option::all()->pluck('option_value', 'option_key')->toArray();
$configs = [];
$configs['options'] = $options;
/**
* Get option in some specific way
*/
$configs['options']['allowed_file_types_arr'] = array_filter(explode(',', array_get($options, 'allowed_file_types')));
/**
* Load language file from theme
*/
$configs['lang_str'] = [];
$theme_slug = array_get($options, 'current_theme');
if ($theme_slug) {
$local = app()->getLocale();
$language_path = public_path("themes/{$theme_slug}/languages/{$local}.php");
if (file_exists($language_path)) {
$configs['lang_str'] = include_once $language_path;
}
}
$configs['app.timezone'] = array_get($options, 'default_timezone');
$configs['app.url'] = array_get($options, 'site_url');
$configs['app.name'] = array_get($options, 'site_title');
$configs = apply_filters('app_configs', $configs);
config($configs);
/**
* Set dynamic configuration for third party services
*/
/**
* Set dynamic configuration for third party services
*/
$amazonS3Config = [
'filesystems.disks.s3' =>
[
'driver' => 's3',
'key' => get_option('amazon_key'),
'secret' => get_option('amazon_secret'),
'region' => get_option('amazon_region'),
'bucket' => get_option('bucket'),
]
];
$socialConfig['services'] = [
'facebook' => [
'client_id' => get_option('social_login.facebook.app_id'),
'client_secret' => get_option('social_login.facebook.app_secret'),
'redirect' => url('login/facebook/callback'),
],
'google' => [
'client_id' => get_option('social_login.google.client_id'),
'client_secret' => get_option('social_login.google.client_secret'),
'redirect' => url('login/google/callback'),
],
'twitter' => [
'client_id' => get_option('social_login.twitter.consumer_key'),
'client_secret' => get_option('social_login.twitter.consumer_secret'),
'redirect' => url('login/twitter/callback'),
],
'linkedin' => [
'client_id' => get_option('social_login.linkedin.client_id'),
'client_secret' => get_option('social_login.linkedin.client_secret'),
'redirect' => url('login/linkedin/callback'),
],
];
config($socialConfig);
config($amazonS3Config);
/**
* Email from name
*/
$emailConfig = [
'mail.from' =>
[
'address' => get_option('email_address'),
'name' => get_option('site_name'),
]
];
config($emailConfig);
date_default_timezone_set(array_get($options, 'default_timezone'));
require get_theme()->path . 'functions.php';
} catch (\Exception $e) {
//
}
}else{
if ( ! strpos(request()->getPathInfo(), 'installations')){
die("<script>location.href= '".url('installations')."' </script>");
}
}
}
}
the problem happen when hosted on shared hosting server, i changed folder structure according to this hosting service requirements, My laravel view not work as in local host, it cannot find themes/edugator directory in public_html folder. Can someone please help me to solve this problem,
the error is as follow
production.ERROR: View [themes.edugator.index] not found. {"exception":"[object] (InvalidArgumentException(code: 0): View [themes.edugator.index] not found. at /home/u373829038/domains/unilearn.site/source/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137)
Please or to participate in this conversation.