I am using Laravel 5 and I am confused about where to place traits files in the Laravel 5 directory structure. Should they exist in public, resources or any other directory?
In terms of placement you should treat traits like classes. That means put them inside the app
directory. Where you place your traits in there depends on your preference and on the actual purpose of the trait.
Important is that you adjust the namespace of the trait to the directory structure. For example if your trait has something to do with your controllers and you decide to put it inside the app/Http/Controllers
folder, then make sure it has the correct namespace, which would be:
namespace App\Http\Controllers;