Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to load class when on live environment in laravel
    primarykey
    data
    text
    <p>I am new to the Laravel framework so please be easy on me!</p> <p>I have developed an application where I use a Helper class for some handy functions such as generating a slug from a string. I have created a helper.php class in a classes folder in my app directory, then in my global.php file I have added the classes folder to the "ClassLoader". </p> <p>You can see my setup as follows:</p> <p>Site Structure</p> <pre><code>-site -app -classes -helpers.php -controllers </code></pre> <p>global.php</p> <pre><code>ClassLoader::addDirectories(array( app_path().'/commands', app_path().'/controllers', app_path().'/models', app_path().'/database/seeds', app_path().'/classes', )); </code></pre> <p>helpers.php <pre><code>class Helpers { public static function slug($url_to_encode) { $slug = urlencode($url_to_encode); $slug = preg_replace('~[^a-z0-9]++~i', '-', $slug); $slug = trim($slug, '-'); return $slug; } } </code></pre> <p>Everything works fine on my local Mac testing environment and I can call my "slug" helper function with no problems.</p> <pre><code>$slug = Helpers::slug($article-&gt;name); </code></pre> <p>The problem I have is when I move my site onto my live server, everything part of my application works great apart from pages where I call my "Helpers" class. </p> <p>The site breaks and I receive the following error message:</p> <pre><code>Symfony \ Component \ Debug \ Exception \ FatalErrorException Class 'Helpers' not found </code></pre> <p><img src="https://i.stack.imgur.com/TP9IG.gif" alt="enter image description here"></p> <p>I am a little confused as to why this isn't working.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload