Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

Published on

bootstrap/../vendor/autoload.php. Failed to open stream: No such file or directory. The “vendor” folder does not exist. Which OS you are using ? For Windows : Go to Command Prompt set path to www/{ur project} For me : www/laravel5 Then type this command : composer install It will automatically install all dependency in vendor/ ————————/OR/—————————- Run … Continue reading Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

FatalErrorException in TaskQueue.php line 13 in Laravel 5

Published on

FatalErrorException in TaskQueue.php line 13 in Laravel 5. The class “TaskQueueInterface” had not be found. The following is my solution: open the folder: /vendor/guzzlehttp/promises/src edit TaskQueue.php modify “class TaskQueue implements TaskQueueInterface” to “class TaskQueue” After doing the above, stay tuned for the official release.

How to check if related model exists in Laravel

Published on

since @TheShiftExchange did not take the advice, there we go with generic solution working on all the relation types: if (count($model->relation)) { // exists} This will work for every relation since dynamic properties return Model or Collection. Both implement ArrayAccess. So it goes like this: single relations: hasOne / belongsTo / morphTo / morphOne // … Continue reading How to check if related model exists in Laravel

How to Redirect All Requests To HTTPS in Laravel

Published on

Using App::before You might be able to take advantage of the App::before() block in the app/filters.php file. Change the block to include a simple check to see if the current request is secure, and if not, redirect it. App::before(function($request) { if(! Request::secure()) { return Redirect::secure(Request::path());}}); Using Filters Another option might be to create a filter … Continue reading How to Redirect All Requests To HTTPS in Laravel

How to place HTTPS on my app in laravel 5 rather than .htaccess

Published on

Make it works with a Middleware class. Let me give you an idea. namespace MyApp\Http\Middleware; use Closure; class HttpsProtocol { public function handle($request, Closure $next) { if (!$request->secure() && env(‘APP_ENV’) === ‘prod’) { return redirect()->secure($request->getRequestUri());} return $next($request);}} Then, apply this middleware to every request adding setting the rule at Kernel.php file, like so: protected $middleware … Continue reading How to place HTTPS on my app in laravel 5 rather than .htaccess

TokenMismatchException in VerifyCsrfToken.php Line 67

Published on

Add this in your HTML meta tag area : <meta name=”csrf-token” content=”{{ csrf_token() }}”> Then under your JQuery reference, add this code : <script type=”text/javascript”> $.ajaxSetup({ headers: { ‘X-CSRF-TOKEN’: $(‘meta[name=”csrf-token”]’).attr(‘content’) } }); </script> If you are using the HTML form submit (not AJAX) then you need to put : {{ csrf_field() }} inside your form … Continue reading TokenMismatchException in VerifyCsrfToken.php Line 67

Uncaught ReflectionException: Class log does not exist Laravel 5.2

Published on

The reason why I say my problem is because the Exception is very mis-leading. Uncaught ReflectionException: Class log does not exist This exception simply means Laravel tried to log an error but couldn’t instantiate Laravel’s Logclass. This is not due to the Log class going walk-abouts or hiding. This is because Laravel is still going … Continue reading Uncaught ReflectionException: Class log does not exist Laravel 5.2

How to create a RESTful Resource Controller in Laravel 5.2?

Published on

Try getting help on the command php artisan help make:controller If you see a –resource flag in the help options you are probably on 5.2 and can add that flag to the command to get a resource controller. php artisan make:controller –resource SomeResourceController For Laravel 5.0 and 5.1 the make:controller command would make a resource … Continue reading How to create a RESTful Resource Controller in Laravel 5.2?