giorg

giorg

Member Since 9 Months Ago

Experience Points 1,930
Experience Level 1

3,070 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 6
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

18 Jun
6 days ago

giorg left a reply on Sending Emails In Production

actually I've just realized the email IS sent, but then instead of redirection with success message, I get this exact message:

504 Gateway Time-out

and this is nginx error log:

2019/06/18 15:22:53 [error] 21807#21807: *2217 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.1.120, server: intranet, request: "POST /preorders HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock", host: "intranet", referrer: "http://intranet/preorders/create

thanks

giorg started a new conversation Sending Emails In Production

hello, I'm working on iMac with valet and my laravel project, everything works perfectly. In production I did install sendmail, and this is the .env:

MAIL_DRIVER=sendmail MAIL_HOST=localhost MAIL_PORT=25 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null

if I telnet at port 25 I successfully send email to my gmail account, so sendmail is working. But when I try this:

$subject = 'Nuovo pre-ordine'; Mail::send('emails.preorder_notify', ['preorder' => $preorder], function ($message) use ($subject) { $message->from('[email protected]', 'Intranet SET'); $message->subject($subject); $message->to(''); });

I get a 504 gateway timeout. Any suggestion?

thanks a lot

14 May
1 month ago

giorg left a reply on Routes - Weird Behaviour

the get url brings me to a page where I can upload a file to import customers, from there I have the post url where I manilpulate the file importing customers... if this work locally why not in production... I also have another url which goes 404 only in production, but works perfectly locally. And I have like 300 urls in my route file, working on this project for months now, and got this error many times, always solved, I know what the error means, it just doesn't make any sense. It looks like it ignores this row:

Route::get('customers/import', '[email protected]');

thanks

giorg left a reply on Routes - Weird Behaviour

I don't want this as a post, must be a get, as it works perfectly on my local dev machine.

giorg started a new conversation Routes - Weird Behaviour

Hello, I have these customer's routes:

Route::get('customers', '[email protected]'); Route::post('customers', '[email protected]'); Route::get('customers/create', '[email protected]'); Route::get('customers/{id}/edit/{address_id}', '[email protected]'); Route::get('customers/{id}/delete', '[email protected]'); Route::patch('customers/{id}/update', '[email protected]'); Route::get('customers/{id}/addaddress', '[email protected]'); Route::post('customers/toggleLegalOffice', '[email protected]'); Route::post('customers/toggleFavorite', '[email protected]'); Route::post('customers/toggleCanOrder', '[email protected]'); Route::post('customers/getPayment', '[email protected]'); Route::get('customers/{id}/destinations', '[email protected]'); Route::get('customers/{id}/deleteaddress', '[email protected]'); Route::get('customers/{id}/editaddress', '[email protected]'); Route::patch('customers/{id}/saveaddress', '[email protected]'); Route::get('customers/import', '[email protected]'); Route::post('customers/import', '[email protected]');

when I browse customers/import on my local dev machine everything is fine, but when I try on production machine I get:

The GET method is not supported for this route. Supported methods: PATCH

how can this be? Thanks a lot

27 Feb
3 months ago

giorg left a reply on Email Attachment

Hi @mvd,

thanks for your answer. It does the same with other attachments and both with webmail and thunderbird...

thanks you

26 Feb
3 months ago

giorg started a new conversation Email Attachment

Hi, I'm writing an email this way in my controller:

Mail::send('emails.smartchange', ['manufacturer' => $manufacturer, 'subject' => $subject], function ($message) use ($manufacturer, $subject) {
                $message->from($manufacturer->pec_indirizzo, $manufacturer->nome);
                $message->subject($subject);
                $message->to('[email protected]');
                $message->attach(public_path() . '/storage/labels/ETICHETTE300518-876327252.txt', [
                    'as' => 'test.txt',
                    'mime' => 'text/plain'
                ]);

the email is sent but instead of the attachment, I see this in the body:

--_=swift_1551190146_2f993e7d31446485d662d662e585fc2d=_ Content-Type: text/plain; name=armando.txt Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=armando.txt UVAwNTE2MTM4N0E7U1RTMjIyMjcNClFQMDUxNjEyODJHO1NUUzIyMjI2DQpRUDA1MTYxNDEyTDtT VFMyMjIyOA0KUVAwNTE2MTQxM0s7U1RTMjIyMjk= --_=swift_1551190146_2f993e7d31446485d662d662e585fc2d=_--

what am I doing wrong? Thanks a lot

25 Feb
3 months ago

giorg started a new conversation Textarea Lines

Hi, I have a textarea like this:

Form::textarea('lista_seriali', null, ['class' => 'form-control', 'required' => 'required'])

where a user need to write 16-length digits per line. In my controller I need to cycle over each line, so I get the request:

var_dump(explode('\r\n', $request->get('lista_seriali')))

but what I get is: array(1) { [0]=> string(34) "0028569756548828 0028569756548829" } so a single string 2 chars more than expected. I tried exploding for 1 space, 2 spaces, \n, \r\n... nothing.

Any hint? Thanks a lot

21 Feb
4 months ago

giorg left a reply on Config Change At Runtime For Custom Smtp

You saved my day, thanks a lot!

giorg started a new conversation Config Change At Runtime For Custom Smtp

Hello, I need to send email using different smtp, so I'm trying to change .env data at runtime. This is what I've done so far:

$_ENV['MAIL_HOST'] = $smtp; $_ENV['MAIL_PORT'] = $smtp_port; $_ENV['MAIL_USERNAME'] = $address; $_ENV['MAIL_PASSWORD'] = $password; if ($ssl === '1') { $_ENV['MAIL_ENCRYPTION'] = 'tls'; }

but I receive

Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required

but if I write the values of those variables directly in the .env, it works like a charm.

Any hint? thanks a lot

07 Dec
6 months ago

giorg left a reply on Change Locale

@GLOBALS - thanks a lot!

giorg started a new conversation Change Locale

Hello, my default configured locale in app.php is en. Now in my controller I do:

App::setLocale('it');

which is working, because if I look at the page source I can see

then I created the resource/lang/it folder, with a messages.php file returning the translations, but it's not working. In my template I have:

{{ __('Round') }}

which remains Round even if in my messages.php I have:

return [ 'Round' => 'Giocata', ];

any hint? thanks a lot

24 Oct
8 months ago

giorg left a reply on Logout From Other Devices

I overrided authenticated function in my login controller this way:

protected function authenticated(Request $request, $user) { if (!Auth::logoutOtherDevices($request->get('password'))) { Log::warning('User logged in but logoutOtherDevices failed: ' . $user->name); } }

and it works, hope this is the right way to do it.

thanks a lot @martinbean

giorg left a reply on Logout From Other Devices

omg did not realize that. Then I have another problem, because I need that when a user logins, all other sessions have to be disconnected...

thanks a lot

giorg left a reply on Logout From Other Devices

hey @martinbean,

thanks for you answer. I just realized that this line:

Auth::logoutOtherDevices($user->getAuthPassword());

compromises the correct hashing of the password. If I register a user without that line, and copy the hashed password from the db to the console with tinker through Hash::check, the password is correct. If I uncomment that line, and re-do the whole process, the check function return false. How can this be?

thanks a lot

giorg started a new conversation Logout From Other Devices

Hello,

I've created a UserLoggedIn listener, where in the handle function I do:

$user = Auth::user(); if ($user) { Log::info('user logged in, trying to logout from other devices'); Auth::logoutOtherDevices($user->getAuthPassword()); }

I see the message in the log, but looks like this is not working for me, I was logged in with another browser and I expected to be logged out instead... what am I doing wrong?

Thanks a lot

giorg left a reply on Custom Logging

thanks a lot!

giorg started a new conversation Custom Logging

Hi,

in my .env I have:

LOG_CHANNEL=stack

and my config/logging.php starts with:

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single'],
        'path' => storage_path('logs/set.log'),
    ],

    'single' => [
        'driver' => 'single',
        'path' => storage_path('logs/laravel.log'),
        'level' => 'debug',
    ],
    .....

I expected to log in my custom set.log, but when I use log functions all goes still to laravel.log...

What am I missing?

Thanks a lot

giorg left a reply on Debug Auth

thanks a lot for your help. Actually the one stored in my db doesn't match, now I have to understand why...

giorg left a reply on Timestamp

thank you very much!

23 Oct
8 months ago

giorg started a new conversation Timestamp

Hi,

I would like to have, for a specific model, eloquent to manage created_At for me, but I need not to have updated_at. Is this possible?

Thanks a lot

giorg left a reply on Debug Auth

thanks for your answers. I have that function because otherwise if I save passwords from laravel-admin they are in clear...

giorg left a reply on Debug Auth

doesn't change anything... this is my model:

namespace App;

use Illuminate\Support\Facades\Hash; use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable { use Notifiable;

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = [
    'name', 'email', 'password', 'email_verified_at'
];

/**
 * The attributes that should be hidden for arrays.
 *
 * @var array
 */
protected $hidden = [
    'password', 'remember_token',
];

public function setPasswordAttribute($password){
    $this->attributes['password'] = Hash::needsRehash($password) ? Hash::make($password) : $password;
}

}

I had to add this function because otherwise inside laravel-admin passwords are being saved in clear.

thanks

giorg left a reply on Debug Auth

sure, it's the one created by make:auth artisan command:

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller { /* |-------------------------------------------------------------------------- | Login Controller |-------------------------------------------------------------------------- | | This controller handles authenticating users for the application and | redirecting them to your home screen. The controller uses a trait | to conveniently provide its functionality to your applications. | */

use AuthenticatesUsers;

/**
 * Where to redirect users after login.
 *
 * @var string
 */
protected $redirectTo = '/home';

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('guest')->except('logout');
}

}

thanks

giorg left a reply on Debug Auth

I get no errors anywhere, simply I cannot login even if the email_verified_at is populated... I really expected this to work out of the box.

22 Oct
8 months ago

giorg started a new conversation Debug Auth

hello,

which can be the best way to debug why laravel's standard auth module is not authenticating my users (except at registration time)?

thanks a lot

giorg left a reply on Auth Credentials

that did the trick, thanks a lot! But I don't understand why when I do register as a new user then I'm automatically logged in, I should be waiting for the verification, doen't make much sense...

thanks again

giorg left a reply on Auth Credentials

I have a local installation of mysql, that is working for sure because I've created my own models, also installed laravel-admin and I can manage them in the backend:

https://ibb.co/cfLmff

thanks

giorg left a reply on Auth Credentials

sure, there we go:

APP_NAME=Laravel APP_ENV=local APP_KEY=base64:CQr6gUEGUoj+MKmVTqtQNRde/LsHrp3HfBr38i5N3DA= APP_DEBUG=true APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=setonline DB_USERNAME=setonline DB_PASSWORD=socame

BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379

MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null

PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

giorg left a reply on Auth Credentials

thanks again for your answer, unfortunately that didn't make it...

giorg left a reply on Auth Credentials

This is User.php inside app:

giorg left a reply on Unique Logged In User

thank you very much @tykus, you made my day :)

giorg left a reply on Auth Credentials

Please have a look here: https://ibb.co/jcNbwL

I tried this many times now: register a user, correctly logged in, then log out and try to login again with error message. I saw I'm not alone with this, happened to many people.

thanks

giorg left a reply on Auth Credentials

Hi,

thanks for your answer but no, I don't.

giorg started a new conversation Auth Credentials

Hello,

using default laravel 5.7 auth, after successful registration user cannot login again, getting These credentials do not match our records. Did not override/change any auth part, shouldn't this work out of the box?

Thanks

19 Oct
8 months ago

giorg started a new conversation Unique Logged In User

Hello, I'm using native laravel 5.7 auth. I need, if a user is logged in, that the same user cannot login from another pc. Is this possible and how?

thanks a lot

17 Sep
9 months ago

giorg left a reply on Haproxy - Ssl

ok I'm in a mixed content situation. assets loaded by laravel-admin are in https, so the browser block them. what's the correct way to fix this?

thanks a lot

giorg left a reply on Haproxy - Ssl

Hi,

thanks for your answer! yes I do see the cert:

https://games.setsnc.com/admin/auth/login

hosting is OVH.

thanks a lot

giorg started a new conversation Haproxy - Ssl

hello,

I've successfully set up ubuntu/haproxy with letsencrypt, which forwards requests to a lxd container with my app. My problem now is the app is serving http instead of https, how can I force it? I tried already:

set the ip into the $proxies variable if the TrustProxies midlleware
created my own middleware handling the request:

if (!$request->secure() && App::environment() === 'production') { return redirect()->secure($request->getRequestUri()); }

        return $next($request); 

put this in boot function of AppserviceProvider:

URL::forceScheme('https');

without luck. Any further hint?

thanks a lot

14 Sep
9 months ago

giorg started a new conversation Laravel-admin Requirements

Hi, doing these steps in my valet environment:

  • composer create-project --prefer-dist laravel/laravel
  • php artisan migrate
  • composer require encore/laravel-admin
  • php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
  • php artisan admin:install

everything is perfect. Doing the same steps on the server where the production will be, I cannot login. After some debugging, I found the middleware Authenticate: here, inside the function

public function handle($request, Closure $next)

this:

return $next($request);

in my valet returns the redirect to the admin dashboard, on the production server back to the login form. How to debug further? What can be different in the two environments?

Thanks a lot

giorg started a new conversation Laravel 5.7 - Js

Hi there, I installed a module:

npm install phaser

but now I cannot understand how to include it in my blade template. Thanks

giorg left a reply on Cannot Login

Hi, yes I do see files in there, and I also used Session object. weird thing: in my local environment I dd('test') inside the postLogin function of AuthController, right after the definition, and it dies. In production it dies not.

thanks a lot

13 Sep
9 months ago

giorg left a reply on Cannot Login

thanks for pointing that out, I would never give 777 to whole folder :) I tried giving 777 to cache and storage but no luck.

giorg left a reply on Cannot Login

Ok I did a little debug: echoed $request->session and this is the result

Store {#568 ▼ #id: "iuidcLkL5f8DLW14jqYLYfxVTCXBEDoDkWqP5Dsi" #name: "shitter_session" #attributes: array:5 [▶] #handler: FileSessionHandler {#567 ▶} #started: true }

weird thing: in my local environment I dd('test') inside the postLogin function of AuthController, right after the definition, and it dies. In production it dies not.

thanks!

giorg left a reply on Cannot Login

yes locally I do see errors. Nice one, how do I check sessions? This is what I did to go online:

  • git clone
  • composer install (to install dependencies)
  • php artisan migrate
  • exported db from local and imported in production

missing something? thanks!

giorg left a reply on Cannot Login

Hi,

thanks for your answer. yes, as I said I did export my local db to production! Any hint?

thanks a lot

giorg started a new conversation Cannot Login

Hi,

using laravel-admin. I deployed my site in production, exported my DB to production, locally I can login in admin but in production cannot. No errors given anywhere. How to understand what is happening here?

thanks a lot

giorg started a new conversation 403 In Production

Hi, using Valet here. On my local environment everything works fine. Trying to put all on production now, the home is working, /about page is working as well, but for example this

/games/magicd/

gives 403. Here is my nginx conf:

server { listen 80; listen [::]:80;

    server_name games.setsnc.com;

    root /var/www/shitter/public;
    index index.php index.html;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";
    charset utf-8;
    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }
    error_page 404 /index.php;

    location / {
            try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }

    location ~ /\.ht {
            deny all;
    }

    location ~ /\.(?!well-known).* {
            deny all;
    }

}

what am I doing wrong?

thanks

06 Sep
9 months ago

giorg left a reply on Undefined Offset 0

damn I am sooo tired lol. thanks guys!

giorg started a new conversation Undefined Offset 0

Hi,

in my controller doing this:

public function store() { $input = Request::all();

$game = new Game;
$game->name = $input['name'];
$game->enabled = ($input['enabled' === 'on']) ? 1 : 0;

$game->save();

}

at the enabled row I get undefined offset 0, tried also

if ($input['enabled' === 'on']) $game->enabled = 1

same error. Point is in the form I have a checkbox, while in the database I have a boolean. Any hint?

thanks