laravel-5.2

Where are logs located?

不羁岁月 提交于 2019-11-28 09:35:00
I'm debugging a JSON endpoint and need to view internal server errors. However, my app/storage/logs dir is empty and it seems there are no other directories dedicated to logs in the project. I've tried googling the subject to no avail. How can I enable logging, if it's not already enabled and view the logs? Ensure debug mode is on - either add APP_DEBUG=true to .env file or set an environment variable Log files are in storage/logs folder. laravel.log is the default filename. If there is a permission issue with the log folder, Laravel just halts. So if your endpoint generally works -

Laravel 5.2 Missing required parameters for [Route: user.profile] [URI: user/{nickname}/profile]

自作多情 提交于 2019-11-28 08:24:47
I keep getting this error ErrorException in UrlGenerationException.php line 17: When ever any page loads and I'm logged in. Here is what my nav looks like @if(Auth::guest()) <li><a href="{{ url('/login') }}">Log In</a></li> <li><a href="{{ url('/register') }}">Sign Up</a></li> @else <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ Auth::user()->nickname }}<span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="{{ route('user.profile') }}">Profile</a></li> <li><a href="{{ route('user

Fatal error: Call to undefined method GuzzleHttp\Client::request() with Guzzle 6

拈花ヽ惹草 提交于 2019-11-28 07:29:02
问题 I'm using Guzzle 6 with Laravel 5.2. I'm trying to access a simple internal API: use GuzzleHttp\Client; $client = new Client(['base_uri' => getenv('URL_BASE').'api/v1/']); $response = $client->request('GET', 'tournaments'); And I get this message: Fatal error: Call to undefined method GuzzleHttp\Client::request() When I see the docs, it says: $client = new GuzzleHttp\Client(['base_uri' => 'https://foo.com/api/']); But PHPStorm cannot resolve GuzzleHttp What should I do to make it work??? 回答1:

required_if Laravel 5 validation

ε祈祈猫儿з 提交于 2019-11-28 07:14:15
I have form that a user can fill-out for selling their home. And for one of the in puts, a user must select weather it will be "For Sale" or "For Rent". If it is For Sale, two price input fields will appear, and if it is For Rent, then some other price input field will appear based off of jQuery. My problem is I want the price fields to be required, BUT for example if I'am selecting "For Rent", and then I submit my form, it will give me an error saying the price fields for the "For Sale" input fields are required, even though it is under the "For Rent" section. I know there is a required_if in

Resize image in Laravel 5.2

大城市里の小女人 提交于 2019-11-28 06:35:12
Can anyone help me how to implement resizing image in Laravel? I have this code only: if($request->hasFile('image')){ if (Input::file('image')->isValid()) { $file = Input::file('image'); $destination = base_path() . '/public/images/ServiceImages'; $extension = Input::file('image')->getClientOriginalExtension(); $fileName = rand(111,99999).'.'.$extension; if(!empty($data['Image'])){ unlink($destination.$data['Image']); } $file->move($destination, $fileName); $service->image=$fileName; } } mpalencia Laravel does not have a default resize of image. But most laravel developers use ' Image

Laravel SwiftMailer : Expected response code 250 but got code “530”, with message "530-5.5.1 Authentication Required

蹲街弑〆低调 提交于 2019-11-28 04:27:19
问题 I am using laravel 5.2, And the using Swift Mailer for password resetting. I have 2-step verification on my gmail. . As the google help says : If you've turned on 2-Step Verification for your account, you might need to enter an App password instead of your regular password. I have the following settings on mail.php : return [ 'driver' => env('MAIL_DRIVER', 'smtp'), 'host' => env('MAIL_HOST', 'smtp.gmail.com'), 'port' => env('MAIL_PORT', 465), 'from' => ['address' => 'meaprogrammer@gmail.com',

Connection could not be established with host mailtrap.io [php_network_getaddresses: getaddrinfo failed: No such host is known. #0]

拥有回忆 提交于 2019-11-28 03:53:02
问题 I am getting below error: Connection could not be established with host smtp.gmail.com [php_network_getaddresses: getaddrinfo failed: No such host is known. 0] My .env file looks like: MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=xxxxxxxxxxxxxx MAIL_PASSWORD=xxxxxxxx #MAIL_ENCRYPTION=null My mail.php file inside config looks like: /* |-------------------------------------------------------------------------- | Mail Driver |--------------------------------------------------------------

What is the concept of Service Container in Laravel?

让人想犯罪 __ 提交于 2019-11-28 03:48:49
I am starting to look into Laravel but I don't understand the concept of Service Container. How does it work and what do developers need to know to fully utilize this concept in Laravel? The Service Container in Laravel is a Dependency Injection Container and a Registry for the application The advantages of using a Service Container over creating manually your objects are: Capacity to manage class dependencies on object creation You define how a object should be created in one point of the application (the binding) and every time you need to create a new instance, you just ask it to the

How to use 'OR' middleware for route laravel 5

社会主义新天地 提交于 2019-11-28 03:06:11
问题 I've two types for user and I've created multiple middlewares. Some routes need to allow for both type of user. I've trying following code: Route::group(['namespace' => 'Common', 'middleware' => ['Auth1', 'Auth2']], function() { Route::get('viewdetail', array('as' => 'viewdetail', 'uses' => 'DashboardController@viewdetail')); }); But its not working :( 回答1: Middleware is supposed to either return a response or pass the request down the pipeline. Middlewares are independent of each other and

Laravel 5.2: Integrate entrust package, create role and permissions and access it

99封情书 提交于 2019-11-28 02:03:45
问题 I am totally new in laravel. I install laravel 5.2 . I have done with CRUD in laravel. Now i want to integrate laravel authentication package. so i choose zizaco\entrust. I follow each steps from doc link. but i don't understand what is wrong. In doc there is not mentioned that in which file i have to add following code. $owner = new Role(); $owner->name = 'owner'; $owner->display_name = 'Project Owner'; // optional $owner->description = 'User is the owner of a given project'; // optional