Laravel Community Tools by Tighten

Category "Configuration" tricks

45 tricks
Laravel MySQL in default returns "SQLSTATE[HY000]: General error: 1366 Incorrect string value" error in emoji save... this error is because Laravel in default uses utf8 charset in MySQL, change your `config/database.php` like below and reset your migration instead putting out that error...
tuytoosh 9 years ago 6876
Lumen is a micro-framework built on top of Laravel. The framework is ideal for small apps and services that are optimized for speed. The most important application of the framework is to build REST APIs. This tutorial explains how REST API can be created using Lumen. https://www.cloudways.com/blog/creating-rest-api-with-lumen/
olivedev 9 years ago 7118
5.0
This code allows you to register additional package providers and aliases for different environments, similar to how it used to work in L4. While the most of local configuration in L5 can be done by .env files, you can't really separate dev packages that way. If you install a package with `composer require --dev` it will not be available in the production and if you forget to remove the providers from the app.php it will break everything. With this code you can have local/app.php config with package providers and aliases that will be merged with the main config, but only if you are in local env. It will also support using separate config for production/app.php or test/app.php (or any other environment name you use).
ivanhoe011 9 years ago 7983
5.0
If you want to use(or work with) another database in a section of your project use following steps... step 1. Create another connection in config/database.php step 2. Insert new connection info in .env file... step 3. Tell to laravel to use this new connection
tuytoosh 9 years ago 7019
I was looking for a way to change the .env-values within a controller or from something else. I found nothing, so I created my own little method. It takes an array of new values. The array key must be the key from the .env. The script overwrites the old .env. Yet not perfect, but works for now. UPDATE: I am developing a package which will provide this functionality in a better way. The package will ship with some more features. UPDATE: Here is the Link to the Package: https://github.com/Brotzka/laravel-dotenv-editor. Give it a try ;) There will be more features in a few days.
Brotzka 9 years ago 32287
5.0
Simple ACL laravel 5.2 Providers->AuthServiceProvider Register any application authentication / authorization services.
hendrilara 10 years ago 32215
In this article I'm gonna show you how to setup Laravel with Redis cache. Cloudways offers Laravel Development Framework on its Managed Cloud Web Hosting Platform. You also have the option to use Redis Cache, which is different from Memcached in the sense that it has persistence. Further advantages of Redis over Memcached are that it works with more data types, and it uses less memory. Here are the article link: http://www.cloudways.com/blog/setup-laravel-redis-cache/
wajidstack 10 years ago 8576
4.1
In Laravel 5, by default you have CSRF in every single POST. If you are new to Laravel and you use the usual HTML code to create inputs and forms then you will definitely encounter that error. Also, if you are coming from Laravel 4, again you might not know how to solve this error since 'Illuminate\Html\HtmlServiceProvider' is not installed by default anymore and HTML inputs and form have to be used. There are 3 solutions in order to fix it. 1) If you want to keep the usual HTML code and not use 'Illuminate\Html\HtmlServiceProvider' (since it is not installed by default in Laravel 5), then you can delete this line of code '\App\Http\Middleware\VerifyCsrfToken::class,' in app/Http/Kernel.php. However this is not a good practice. You can still do that though, in case you are building something small or an API. 2) You can install 'Illuminate\Html\HtmlServiceProvider' and do it the old good Laravel 4 way, which uses tokens by default, thus you don't have to worry about it anymore. 3) The last solution is in case you want to code the front end with the usual HTML code then you can use this line in your layout or in case you don't have a layout then in every single page. <input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}" /> You can get Laravel 5 tutorials and projects for all levels (Beginners-Intermediate-Advanced) in this website www.codeexecutable.com/courses
codeexecut... 10 years ago 9823
Hello ! I'm trying to publish an application on an IIS server where my application is in a subfolder. However when trying to enter it's giving me the following error: NotFoundHttpException Application.php line in 1105 : I ran a dd () on routes and printed on the screen normally. I do not know what might be happening . Could someone help me ?
atilarampa... 10 years ago 14162
5.0