laravel-5.2

Multiple Laravel 5 projects on the same domain

随声附和 提交于 2019-11-28 02:01:52
问题 I got several Laravel 5 projects running on subfolders, on the same domain. Each Laravel application is generating it's own session cookie, and sometimes it generates so much that we get http 400 errors on the entire domain. Should I share the storage folder between all those projects, or there's any settings to prevent that to happen? 回答1: Each Laravel installation should be located in its own directory. Then an alias needs to be defined which points the domain sub-folder to the "child"

How to put route in anchor tag in laravel 5.2

时间秒杀一切 提交于 2019-11-28 01:02:05
问题 I've gone through many of the articles below, which explains generating link from named route, but unable to solve my problem. Tutorial 1 Tutorial 2 Tutorial 3 Following is the defined routes: Route::get('/nitsadmin/dashboard', function () { return view('nitsadmin.dashboard'); }); And I'm calling link in anchor tag: <a id="index" class="navbar-brand" href="{{Html::linkRoute('/nitsadmin/dashboard')}}"> <img src="../img/admin/nitseditorlogo.png" alt="Logo"> </a> I'm getting following error: 回答1

I'm getting error “Class 'Predis\\Client' not found” in Laravel 5.2

血红的双手。 提交于 2019-11-27 21:49:28
I want to using Redis in laravel 5.2 however, I'm getting error such a Class 'Predis\Client' not found, How I can solve it. First download the REDIS to your system (if you haven't already installed it). Go to the folder where you have downloaded the redis and run this command: cd your-redis-folder-name make Go to your project directory and install composer: composer require predis/predis Go to your .env file and add Queue driver: QUEUE_DRIVER=redis use Mail::queue() to send mail via queue. See Doc . And in your terminal run: php artisan queue:listen to send. Write in console in project folder:

Laravel : How to hide url parameter?

风流意气都作罢 提交于 2019-11-27 16:45:45
问题 Here the scenario is I want to pass a variable which will be send from one page to another and in next page it's gonna store through a form. So I have passed the variable from first page to second page through the URL. But I want to hide the parameter in the URL. How do I do it? Here is my route : Route::get('/registration/{course_id}',[ 'uses'=>'AppController@getregistration', 'as'=>'registration' ]); And Controller : public function getregistration($course_id) { return view('index')->with(

Laravel 5.2: Auth::logout() is not working

纵饮孤独 提交于 2019-11-27 16:05:38
问题 I'm building a very simple app in Laravel 5.2, but when using AuthController 's action to log out, it just simply doesn't work. I have a nav bar which checks for Auth::check() and it doesn't change after calling the log out action. I have this route inside the routes.php file: Route::get('users/logout', 'Auth\AuthController@getLogout'); and it's outside the Route::group(['middleware' => ['web']], function () statement. I did also try to add the follow action at the end of the AuthController

FatalErrorException in HtmlServiceProvider.php line 36: laravel

大城市里の小女人 提交于 2019-11-27 16:05:28
问题 I am using laravel 5.2 and I am getting following error FatalErrorException in HtmlServiceProvider.php line 36: Call to undefined method Illuminate\Foundation\Application::bindShared() my app.php file is <?php return [ 'env' => env('APP_ENV', 'production'), 'debug' => env('APP_DEBUG', false), 'url' => 'http://localhost', 'timezone' => 'UTC', 'locale' => 'en', 'fallback_locale' => 'en', 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', 'log' => env('APP_LOG', 'single'), 'providers' => [ /* *

Validating multiple files in array

江枫思渺然 提交于 2019-11-27 15:53:05
问题 I need to validate multiple uploaded files, making sure they are of a specific type and under 2048kb. The below doesn't appear to check all files in the array 'files' and just presumes the posted files of invalid mime type as it seems to be checking the array object and not its contents. public function fileUpload(Request $request) { $validator = Validator::make($request->all(), [ 'files' => 'required|mimes:jpeg,jpg,png', ]); if ($validator->fails()) { return response()->json(array( 'success'

Laravel 5.2 CORS, GET not working with preflight OPTIONS

一个人想着一个人 提交于 2019-11-27 14:19:48
The dreaded CORS Error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/mysite/api/test . (Reason: CORS header 'Access-Control-Allow-Origin' missing). Laravel route: $router->group(['prefix' => 'api', 'middleware' => 'cors'], function ($router) { $router->get('/test', 'MyController@myMethod'); }); Laravel Cors Middlware: public function handle($request, Closure $next) { header('Access-Control-Allow-Origin: *'); // ALLOW OPTIONS METHOD $headers = [ 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control

Laravel 5.2 | Testing UploadedFile Misses the $test Value after Post. Bug?

核能气质少年 提交于 2019-11-27 13:33:52
Update 2016/04/26 11:30 GMT+2 Workaround Since Laravel 5.2.15, the $test parameter is removed, but there is no clear reason, because Symfony's UploadedFile still has the $test parameter. A workaround is to use Laravel 5.2.14 provisionally. Update 2016/04/26 11:00 GMT+2 Laravel's own UploadedFile doesn't pass the $test parameter. See these resources: https://github.com/laravel/framework/issues/12620 https://github.com/laravel/framework/commit/5062a9b42632e55ee90b7397141c0b12622447e1 I know, there's another question: How to test file upload in Laravel 5.2 , but the marked answer doesn't work for

Laravel 5.2 - pluck() method returns array

眉间皱痕 提交于 2019-11-27 12:53:23
问题 I'm trying to upgrade my project L5.1 -> L5.2. In upgrade guide there's one thing which isn't clear for me: The lists method on the Collection, query builder and Eloquent query builder objects has been renamed to pluck . The method signature remains the same. That's ok, rename refactoting from lists() to pluck() isn't a problem. But what with useful pluck() method which was in L5.0 and L5.1? From the 5.0 documentation: Retrieving A Single Column From A Row $name = DB::table('users')->where(