Andreas94

Experience

1,680

0 Best Reply Awards

  • Member Since 6 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

17th January, 2018

Andreas94 left a reply on Which Session Driver Do You Recommend? • 4 days ago

No idea?

16th January, 2018

Andreas94 left a reply on Which Session Driver Do You Recommend? • 5 days ago

I bring this discussion back to life a few weeks ago. I set 120 as suggested by @Snapey, unfortunately, however, users find themselves having to log in to the site several times a day ... how can I avoid this?

8th January, 2018

Andreas94 left a reply on Which Session Driver Do You Recommend? • 1 week ago

I'm not hiding anything... I simply do not understand why it saves every single session and page visited, these are some contents of the files:

a:3:{s:6:"_token";s:40:"l5bbPnKcUdloPAwKSyO0qMkgpdZK83KIGBFo8t8f";s:9:"_previous";a:1:{s:3:"url";s:63:"/trofei/viva-ferrari";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
a:3:{s:6:"_token";s:40:"Rp4wEKoHQiOh4E1chSWMxmufbVgJRQjRtxnoDbOS";s:9:"_previous";a:1:{s:3:"url";s:147:"nuovo-trailer-di-sid-meiers-civilization-vi-rise-and-fall";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}

Honestly, I do not even understand what it means:

s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}

Andreas94 left a reply on Which Session Driver Do You Recommend? • 1 week ago

No, In domain I have:

'domain' => env('SESSION_DOMAIN', null),

and in the env it is not reported, so it is null...

Now i have 9998 file for 2348450 bytes = 2,34 megabytes

7th January, 2018

Andreas94 left a reply on Which Session Driver Do You Recommend? • 2 weeks ago

In 5 hours, 3912 files... Is this normal?

Andreas94 left a reply on Which Session Driver Do You Recommend? • 2 weeks ago

@Snapey What are the file sessions to contain? only when a user logins in?

Because to me is also saved every page that the user visits, example:

a:3:{s:6:"_token";s:40:"2J2Y6YfFMO8ZuqWV64bnuw36L8Uymq4h78aBMn75";s:9:"_previous";a:1:{s:3:"url";s:28:"/rss.php";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
a:3:{s:6:"_token";s:40:"2mUfgeulnmhGN0eS1jAXxEYEZdV3aiLnnMRAARbl";s:9:"_previous";a:1:{s:3:"url";s:61:"giochi/the-witness-pc/gallery";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}

Why this thing? I just reactivated the Sessions with files and I already have 143 files...

@Shez1983 If the user deletes cookies it is because he wants to remove access ... But how come you say that they are few sure?

6th January, 2018

Andreas94 left a reply on Which Session Driver Do You Recommend? • 2 weeks ago

It is a site with about 4700 unique visits a day @gator, if I set "lifetime" in config/session.php, with an expiration of about 43200 minutes = 30 days, the storage/framework /session directory is emptied every month, but then all users every thirty days have to re-login.

Realize that I have converted my portal in Laravel for about 6 days ... In a week that folder weighed 10MB and inside there were more than 150k files... If I had to put it every 30 days the folder would explode...

But what are these files for? everything that users do on the site or just logins?

@shez1983 And selecting cookies, how do you save the same data I'm saving now with files?

Andreas94 started a new conversation Which Session Driver Do You Recommend? • 2 weeks ago

Hello everyone, at the moment I use the Session Drive "file", but unfortunately the folder / storage/framework/sessions now weighs more than 10MB and has in many files...

What do you recommend? which one do you use? Is it safe to use cookies?

2nd January, 2018

Andreas94 left a reply on Site Reachable With Both /public And Without • 2 weeks ago

nobody knows how to force the use of https without receiving this problem?

Can these package help me?

https://github.com/ecrmnn/laravel-https

1st January, 2018

Andreas94 left a reply on Site Reachable With Both /public And Without • 2 weeks ago

ok I found out that the culprit of everything was:

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

So now I miss it only to understand how to force the redirect 301 from http to https:

Reading many guides, they advise to put this in app\Providers\AppServiceProvider.php

    \URL::forceScheme('https');

But by doing so, I receive all the url of the page in HTTPS (css,js,image...), but the user continues to stay on an http page... How can I do?

Andreas94 left a reply on Site Reachable With Both /public And Without • 2 weeks ago

@Snapey Error 404

Andreas94 left a reply on Site Reachable With Both /public And Without • 2 weeks ago

@jlrdw I know very well that this topic can also be dealt with eight hundred times, I also searched on stackoverflow which have recommended different configuration... but the site works great for me, and the problem is only when a user visits the site without https that is brought to https://domain.ext/public/$1 instead of https://domain.ext/$1 but if one visits the site from https:// everything works fine

@GertjanRoke unfortunately if one enters from http it is routed to https with the public folder...

Andreas94 left a reply on Site Reachable With Both /public And Without • 2 weeks ago

I discovered that this problem is created when a user tries to enter the site without http. If a user visits the site with http://hello.com he is referred to http://hello.com/public To force the use of https I used:

# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Andreas94 started a new conversation Site Reachable With Both /public And Without • 2 weeks ago

Hi I have correctly configured laravel on my hosting, however the site is reachable both from:

https://hello.com https://hello.com/public

making it then become the url:

https://hello.com/article/... https://hello.com/public/article/...

How can I overcome this problem?

I tried with:

RewriteRule "^public\/(.+)" "https://hello.com/" [R,L]

but the redirect does not consider it...

28th December, 2017

Andreas94 left a reply on Recognize The Page Indicated In The Error Log • 3 weeks ago

No one has any idea how I can save the url of the page where there is an error in laravel.log

As the laravel.log is now realized, I can not know what is causing the error...

Andreas94 started a new conversation Recognize The Page Indicated In The Error Log • 3 weeks ago

Hi, I noticed that a mistake is reported in the error strange log,that I visit the pages not reflected.

is it possible to save the address of the page where the error is located in the log?

The error I receive is of a variable, here it is:

[2017-12-28 16:59:08] production.ERROR: ErrorException: Undefined variable: infogioco in /home/game/public_html/storage/framework/views/2aa2153dd4bd8ee731fa4fcff4e8167f6f788ab7.php:72
Stack trace:
#0 /home/game/public_html/storage/framework/views/2aa2153dd4bd8ee731fa4fcff4e8167f6f788ab7.php(72): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/home/game/...', 72, Array)
#1 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(42): include('/home/game/...')
#2 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/home/game/...', Array)
#3 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/View.php(137): Illuminate\View\Engines\CompilerEngine->get('/home/game/...', Array)
#4 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/View.php(120): Illuminate\View\View->getContents()
#5 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/View.php(85): Illuminate\View\View->renderContents()
#6 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Http/Response.php(38): Illuminate\View\View->render()
#7 /home/game/public_html/vendor/symfony/http-foundation/Response.php(200): Illuminate\Http\Response->setContent(Object(Illuminate\View\View))
#8 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(615): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View))
#9 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(572): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View))
#10 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#11 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#12 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#13 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#14 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(65): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#18 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#20 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#21 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#22 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#23 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#27 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#30 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(574): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#31 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(533): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#32 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(511): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#33 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#34 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#35 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#36 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#38 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#39 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#41 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#42 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#44 /home/game/public_html/app/Http/Middleware/CheckForMaintenanceMode.php(26): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#45 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#47 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#48 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#49 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#50 /home/game/public_html/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#51 {main}

27th December, 2017

Andreas94 started a new conversation Create Slug With ID Via Socialite-Twitter • 3 weeks ago

Hi I need to create a slug ID for each user who registers via Twitter.

This is my code:

RegisterController.php
    public function findOrCreateUser($user, $provider)
    {
        $authUser = User::where('provider_id', $user->id)->first();
        if ($authUser) {
            return $authUser;
        }
        return User::create([
            'username'     => $user->name,
            'email'    => $user->email,
            'provider' => $provider,
            'provider_id' => $user->id,
            'slug'  => $user->id.'-'.$user->name
        ]);
    }

As you can see, I put 'slug' => $user->id.'-'.$user->namebut in this way, he takes the ID of Twitter by creating a slug: 878784187-username and not 170-username.

How can I take my next ID?

21st December, 2017

Andreas94 left a reply on Exit From Maintenance Via Links • 1 month ago

Thanks @Yama,

I created middleware:

namespace App\Http\Middleware;

use Closure;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;

class CheckForMaintenanceMode
{
    protected $app;

    public function __construct(Application $app)
    {
        $this->app = $app;
    }

    public function handle($request, Closure $next)
    {
        if ($this->app->isDownForMaintenance() && !$this->isBackendRequest($request)) {
            $data = json_decode(file_get_contents($this->app->storagePath() . '/framework/down'), true);

            throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']);
        }

        return $next($request);
    }

    private function isBackendRequest($request)
    {
        return ($request->is('admin/*') or $request->is('login'));
    }
}

Kernel.php

    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        \App\Http\Middleware\CheckForMaintenanceMode::class,
    ];

web.php

  Route::group(['middleware' => 'auth', 'prefix' => 'admincp'], function () {
    Route::get('/down', function() {\Artisan::call('down');});
    Route::get('/up', function() {\Artisan::call('up');});
  });

Unfortunately, Laravel continues to be properly maintained, but unfortunately I can not get it out of maintenance because the 'Service Unavailable' page appears...

Where am I doing wrong?

Andreas94 left a reply on Exit From Maintenance Via Links • 1 month ago

I saw my approach was wrong, so I saw this discussion on stackoverflow:

https://stackoverflow.com/questions/21047573/maintenance-mode-without-using-artisan/29211512

The my.down file is created correctly, but I do not understand how to get the site maintenance by checking if the file exists.

With "Route::filter('applicationIsUp', function()" Laravel 5.4 gives me an error (1/1) InvalidArgumentException Attribute [filter] does not exist.

Andreas94 started a new conversation Exit From Maintenance Via Links • 1 month ago

Hello, I need to send the site in maintenance and exit through a link.

To get into maintenance I did:

  Route::get('/down', '[email protected]');
    public function down()
    {
        \Artisan::call('down');
    }

But why if the site is under maintenance and I go to link.ext/admin/up it does not work?

  Route::get('/up', '[email protected]');
    public function up()
    {
        \Artisan::call('up');
    }

8th November, 2017

Andreas94 left a reply on How Can I Manage Caches? • 2 months ago

no advice?

7th November, 2017

Andreas94 started a new conversation How Can I Manage Caches? • 2 months ago

Hi, I would set cache to lighten the load on the homepage, which is the page that takes us longer to load, about 950ms.

The original code is:

        $news_homepage  = "12";
        $articoli = Articoli::where('is_published', '0')->orderBy('created_at', 'desc')->limit($news_homepage)->get();
        $n_othernews    =   $articoli[0]->id - $news_homepage;
    $articoli_other = Articoli::where('is_published', '0')->where('id', '<', $n_othernews)->orderBy('created_at', 'desc')->limit('12')->get();
        $articoli_ajax = Articoli::where('is_published', '0')->where('id', '<', $articoli_other[11]->id)->orderBy('created_at', 'desc')->limit('6')->get();

        if ($request->ajax()) {
            $view = view('front.component.article.articoli_ajax',compact('articoli_ajax'))->render();
                    return response()->json(['html'=>$view]);
            }

I tried to handle the cache in this way:

        $articoli = \Cache::remember('article.first', 5, function()
            {
                return Articoli::where('is_published', '0')->orderBy('created_at', 'desc')->limit($news_homepage)->get();
            });

This works correctly, but how can I handle other queries correctly? is there a better way? unfortunately I'm stuck and I can not get it over...

23rd October, 2017

Andreas94 left a reply on Email Not Sended With Namecheap • 2 months ago

I'm trying it all locally with XAMPP, I configured it with mailtrap, I put that when one registers receives a welcome email, and the email is received correctly.

my code:

env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=d6d2dee51af1c3
MAIL_PASSWORD=c509ca11b7def1
MAIL_ENCRYPTION=tls

and for send the email, i have using in RegisterController:

Mail::to($user->email)->send(new Welcome);

but the reset password does not work... But this feature is to write to us, or is it already integrated into laravel's auth system?

22nd October, 2017

Andreas94 left a reply on Email Not Sended With Namecheap • 3 months ago

Sorry but I really do not understand, But then the password reset email system was not created, and should I create it manually?

Because although the guide is for Laravel 5.2, it works equally.

Andreas94 left a reply on Email Not Sended With Namecheap • 3 months ago

Thanks @tisuchi, I followed this guide:

http://www.w3ii.com/it/laravel/laravel_sending_email.html

The email is shipped correctly, even if it goes spam, while the email to retrieve password does not send it, even spam...

Andreas94 left a reply on Email Not Sended With Namecheap • 3 months ago

Hi, I'm using Laravel 5.4, i have installed guzzlehttp/guzzle and now with tinker the email is sent, but keep on using mailgun.org and not smtp...

What email code would you like to see? I'm using the laravel authentication system...

Andreas94 left a reply on Email Not Sended With Namecheap • 3 months ago

Thanks for the reply. I will follow your advice. But I noticed in the debugbar that when I try to apply for a new password, it signals this error: https://image.ibb.co/bUwMMR/error.png

21st October, 2017

Andreas94 started a new conversation Email Not Sended With Namecheap • 3 months ago

Hi, I installed laravel correctly in a namecheap shared-hosting, I'm trying to see if Laravel's password retrieves correctly, but I do not get the email.

This is my configuration in .env

MAIL_DRIVER=smtp
MAIL_HOST=mail.domain.ext
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=password

my mail.php:

    'driver' => env('MAIL_DRIVER'),
    'host' => env('MAIL_HOST'),
    'port' => env('MAIL_PORT'),
    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',

where am I wrong? I checked in the storage / log and I have no log...

17th October, 2017

Andreas94 left a reply on Why Cronjob Not Working? • 3 months ago

i tried, he created the test.dat file with inside "hellohello".

Andreas94 started a new conversation Why Cronjob Not Working? • 3 months ago

Hi I have problems configuring the cronjob command from my cpanel.

Kernel.php

    protected function schedule(Schedule $schedule)
    {
      $schedule->command('ActiveArticle:activearticles')->everyMinute();
    }

Console/Commands/ActiveArticle.php

  protected $signature = 'ActiveArticle:activearticles';

  protected $description = 'Attivo articolo';
[...]

If I did from the SSH terminal: php artisan schedule:run it's work:

[[email protected] www]$ php artisan schedule:run
Running scheduled command: '/opt/alt/php71/usr/bin/php' 'artisan' ActiveArticle:                                                                activearticles > '/dev/null' 2>&1

While cPanel does not work, I have set them:

          • php /home/calufngd/public_html/artisan schedule:run > /dev/null 2>&1

But nothing happens ... Where am I wrong?

2nd October, 2017

Andreas94 left a reply on Remove \' In A Query • 3 months ago

Thank you very much, your solution works properly, but I have another problem.

This project originally was born without the use of Laravel, so I have to rely on an already populated database of data.

I have noticed that data is not displayed because in DB the symbols are saved in html, example: "Ken Follett's The Pillars of the Earth".

so I have to convert all the symbols into db, or is there a faster solution?

Andreas94 started a new conversation Remove "\'" In A Query • 3 months ago

Hi, I have a problem with a live search, if I do a search such as: "Assassin's" becomes:

select * from `giochi` where `nome` LIKE '%assassin\'s%' order by `id` desc limit 5
Bindings    0. %assassin's%

How do I remove \ in order to show the results?

I try with:

$cerca = stripslashes($search);
$posts = Giochi::where('nome','LIKE',"%{$cerca}%")
->orderBy('id', 'Desc')
->limit(5)
->get();

But even with the stripslashes function continues to put the slash...

22nd September, 2017

Andreas94 started a new conversation Update Table From Migrate • 3 months ago

Hi, I have always used laravel in projects with existing databases, but now I'm creating a project using migrates.

I often create a migrate and run it, forgetting to enter a column, once it's done, how do I re-run it to add the missing column?

For example, if I have this migration already executed on db:

        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });

And I forgot the "avatar" column, it becomes:

        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password');
            $table->string('avatar')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });

how do I make it re-run? Artisan give me an error because the table already exists...

4th September, 2017

Andreas94 left a reply on How To Group By Desc Order With Laravel? • 4 months ago

I tried with the "WhereRaw", now I'm printing an array correctly

$topic = Forum_post::where('id_sezione', $sezione->id)->groupby('id_topic')->whereRaw('id = (select max(`id`) from forum_post)')->get();

Unfortunately, however, as you can see from the image, it only prints the first result, while I should print those highlighted in red...

https://i.imgur.com/IbtgOKF.png

Andreas94 left a reply on How To Group By Desc Order With Laravel? • 4 months ago

Thanks for the answer, I tried in two ways, this is the first:

$topic = Forum_topic::with('lastpost','autore')->where('id_sezione', $sezione->id)->groupby('id_topic')->orderby('ID', 'DESC')->max('id')->get();

but I get the error Call to a member function get() on integer, while this:

$topic = Forum_topic::with('lastpost','autore')->where('id_sezione', $sezione->id)->groupby('id_topic')->orderby('ID', 'DESC')->max('id');

it works, but it only prints the highest id:

29 (which is the highest id I have in db)

3rd September, 2017

Andreas94 left a reply on How To Group By Desc Order With Laravel? • 4 months ago

What do you mean @JackJones ? I was wrong to write the query, I corrected it, I had forgotten "groupby"

Andreas94 started a new conversation How To Group By Desc Order With Laravel? • 4 months ago

Hi, I need to group some data, unfortunately though, I always get the lowest id, while I would like the highest one.

ID | id_topic
1   |    1
2  |    1
3  |    2

In this example, laravel prints to me:

ID | id_topic
3  |  2
1   |  1

while I would like:

ID | id_topic
3  |  2
2  |  1

My query is:

$topic = Forum_topic::with('lastpost','autore')->where('id_sezione', $sezione->id)->orderby('ID', 'DESC')->get();

Unfortunately, however, it seems that "orderby" does not work...

29th August, 2017

Andreas94 left a reply on Problem With The Redirect Of A Search Form • 4 months ago

Resolved with:

{{ $articoli->appends($_GET)->links() }}

Andreas94 left a reply on Problem With The Redirect Of A Search Form • 4 months ago

Ok, Thanks to everyone, it works now but I still have a problem with the pagination.

I am in: /ricerca/?q=Grand+theft, And research from its results, unfortunately, however, pagination does not work:

<li><a href="http://127.0.0.1:8000/ricerca?page=3">3</a></li>
<li><a href="http://127.0.0.1:8000/ricerca?page=2">2</a></li>

By changing the page, I obviously get the error "Undefined index: q".

This is my new code

Controller:
    public function getSearch(Request $request)
    {
      $id = $request->input('q');
      $query = $request->all();
        
    $articoli = Articoli::where('titolo', 'like', '%'.$query['q'].'%')->orwhere('testo', 'like', '%'.$query['q'].'%')->orderBy('created_at', 'desc')->paginate(12);
    return view('front.pages.article.list', compact('articoli'));
    }

Route:

Route::get('ricerca', '[email protected]')->name('search.article');

Form Blade:

        <form method="get" action="{{url('ricerca/')}}" role="search">
            <div class="input-group custom-search-form">
              <input type="text" class="form-control" name="q" placeholder="Search...">
              <span class="input-group-btn">
                <button class="btn btn-default-sm" type="submit">
                  <i class="fa fa-search"></i>
                </button>
              </span>
            </div>
        </form>

Andreas94 left a reply on Problem With The Redirect Of A Search Form • 4 months ago

But doing this, I'm brought to the page "dog/indexadmin" example, and not in "dog/indexadmin/{query}"

or am I wrong?

Andreas94 started a new conversation Problem With The Redirect Of A Search Form • 4 months ago

Hi guys, I'm stuck in a very stupid problem... I've put a search on my page, But the redirect is incorrect...

The search page is: http://127.0.0.1:8000/articolo And when you click "send", You will be redirected to: http://127.0.0.1:8000/ricerca/Your+Query+exemple

As I did instead, I'm redirected to: http://127.0.0.1:8000/articolo?cerca=your+query+example, Thus having problems as well with pagination since they point to /articolo?page=2...

How do I fix the redirect?

Route:

Route::group(['prefix' => 'ricerca'], function(){
    Route::get('{search}', ['as'=>'search.article','uses'=>'[email protected]']);
});

Blade:

{!! Form::open(['method'=>'get', 'class'=>'col-12'])  !!}
<div class="input-group custom-search-form">
  <input type="text" class="form-control" name="cerca" placeholder="Search...">
  <span class="input-group-btn">
    <button class="btn btn-default-sm" type="submit">
      <i class="fa fa-search"></i>
    </button>
  </span>
</div>
{!! Form::close() !!}

Controller:

public function getSearch($search) {
    $search = urldecode($search);
    $articoli = Articoli::where('titolo', 'like', '%'.$search.'%')->orwhere('testo', 'like', '%'.$search.'%')->orderBy('created_at', 'desc')->paginate(12);
    return view('front.pages.article.list', compact('articoli'));
}

21st August, 2017

Andreas94 left a reply on Timestamp Only In Created_at • 5 months ago

Fixed with:

      $articoli->save();
      $articoli->created_at = \Carbon\Carbon::now()->timestamp;
      $articoli->save();

It's not the nicest method, but it works...

Andreas94 started a new conversation Timestamp Only In Created_at • 5 months ago

Hi, I'm converting a project to Laravel 5.4 and unfortunately I have some limitations...

I have the articles table, which is composed as follows:

ID - body - created_at - updated_at - published_at

Unfortunately, the database contains more than 10,000 articles and I would not know how to convert all dates...

My problem is that created_at unlike updated_at and published_at has the date in timestamp(1503351199), While the other two columns have the date in datatime (2017-08-21 21:32:54)

I tried in my controller:

$articoli->created_at = \Carbon\Carbon::now()->timestamp;

And kept putting the date in datatime ... So I put it in the models public $timestamps = false;

But doing so, the date in created_at created it in timestamp, but the other columns left them "null"...

Do you have any suggestions? How can I use timestamp only in created_at? Or do I need to convert all dates from timestamp to datatime? If so, how do I do it?

18th August, 2017

Andreas94 left a reply on Change Password Not Work • 5 months ago

In User.php i have:

    protected $fillable = [
        'id', 'username', 'email', 'password', 'slug',
    ];

    protected $hidden = [
        'password', 'remember_token',
    ];

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

Can the error be this setPasswordAttribute?

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

Andreas94 left a reply on Change Password Not Work • 5 months ago

@thomaskim I'm fine... in fact I explained in the next post... But if you want, I can replicate:

By tinker I generate a new password by following this method:

>>> $user->password = bcrypt("12345678");
=> "$2y$10$p1lfiQwAHNxK96LGcnCI3us35.NqkCNKrRITt634tcnpeFd.YbDnO"
>>> $user->save();

In db is generated:

$2y$10$6OYjZg7X9xNA6esgShczquzh7LhUk1WQ7/jvm8/M2TnFhXG4/yMA6

In the login, of course, I put my password: 12345678

but it does not work. But if I copy the string that printed tinker in the terminal "$2y$10$p1lfiQwAHNxK96LGcnCI3us35.NqkCNKrRITt634tcnpeFd.YbDnO" In the password column, and I try to sign in with 12345678, it works.

I do not understand why the password is not stored correctly in db automatically

Andreas94 left a reply on Change Password Not Work • 5 months ago

Thanks for the reply @TheDarkITA, I checked out my Authenticatable and in fact password is not fillable...

So how do I change my password correctly?

Andreas94 left a reply on Change Password Not Work • 5 months ago

Is there a way to see the password that generates me? Unfortunately the password I put in the table does not work

But if I put it manually the password that prints tinker, it works ... what can it be?

The structure of my table is:

password    varchar(191)    utf8mb4_unicode_ci  

Andreas94 left a reply on Change Password Not Work • 5 months ago

Unfortunately it does not work, I also noticed that if I change my password using tinker, using:

c:\xampp\htdocs\lv>php artisan tinker
Psy Shell v0.8.11 (PHP 7.1.1 — cli) by Justin Hileman
>>> $user = User::find(1);
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
=> App\Models\User {#915
     id: 1,
     username: "Tom",
     email: "[email protected]****.com",
     created_at: "2017-06-27 20:42:10",
     updated_at: "2017-08-18 11:22:18",
     slug: "utente",
   }
>>> $user->password = Hash::make('12345678');
=> "$2y$10$i4JkmeegcjFnBYtLIovkDONNuQj2LUnuyiQz4hg6qN3etlBBsx3s6"
>>> $user->save()
=> true

When I go to login by entering my password 12345678, it will not work, But if I copy it manually"$2y$10$i4JkmeegcjFnBYtLIovkDONNuQj2LUnuyiQz4hg6qN3etlBBsx3s6" In the password, login with password 12345678 works...

Andreas94 left a reply on Change Password Not Work • 5 months ago

Route:

    Route::get('impostazioni/password', function() {return view('front.pages.user.password'); });
    Route::post('impostazioni/password', 'Auth\[email protected]');

Auth\UpdatePasswordController.php

namespace App\Http\Controllers\Auth;

use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;

class UpdatePasswordController extends Controller
{
  public function __construct() {
    
    $this->middleware('auth');
    
  }
  public function update(Request $request)
  {
    $this->validate($request, [
      'old' => 'required',
      'password' => 'required|min:6|confirmed',
    ]);
    
    $user = User::find(Auth::id());
    $hashedPassword = $user->password;
    dd($hashedPassword);
    if (Hash::check($request->old, $hashedPassword)) {
      //Change the password
      $user->fill([
        'password' => Hash::make($request->password)
        ])->save();
        
        $request->session()->flash('success', 'Your password has been changed.');
        
        return back();
      }
      
      $request->session()->flash('failure', 'Your password has not been changed.');
      
      return back();
    }
    
  }

front\pages\user\password.blade.php

            @if (Session::has('success'))
              <div class="alert alert-success">{!! Session::get('success') !!}</div>
            @endif
            @if (Session::has('failure'))
              <div class="alert alert-danger">{!! Session::get('failure') !!}</div>
            @endif
            <form action="" method="post" role="form" class="form-horizontal">
              {{csrf_field()}}

              <div class="form-group{{ $errors->has('old') ? ' has-error' : '' }}">
                <label for="password" class="col-md-4 control-label">Vecchia Password</label>

                <div class="col-md-6">
                  <input id="password" type="password" class="form-control" name="old">

                  @if ($errors->has('old'))
                    <span class="help-block">
                      <strong>{{ $errors->first('old') }}</strong>
                    </span>
                  @endif
                </div>
              </div>

              <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                <label for="password" class="col-md-4 control-label">Password</label>

                <div class="col-md-6">
                  <input id="password" type="password" class="form-control" name="password">

                  @if ($errors->has('password'))
                    <span class="help-block">
                      <strong>{{ $errors->first('password') }}</strong>
                    </span>
                  @endif
                </div>
              </div>

              <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                <label for="password-confirm" class="col-md-4 control-label">Conferma Password</label>

                <div class="col-md-6">
                  <input id="password-confirm" type="password" class="form-control" name="password_confirmation">

                  @if ($errors->has('password_confirmation'))
                    <span class="help-block">
                      <strong>{{ $errors->first('password_confirmation') }}</strong>
                    </span>
                  @endif
                </div>
              </div>

              <div class="form-group">
                <div class="col-md-6 col-md-offset-4">
                  <button type="submit" class="btn btn-primary form-control">Cambia Password</button>
                </div>
              </div>
            </form>

At the moment I tried to do the same as the guide, but the password that is generated and stored in db, does not work, Every time I have to manually generate the password via tinker...

17th August, 2017

Andreas94 started a new conversation Change Password Not Work • 5 months ago

Hi, I'm trying to enter the password change, to do this, I followed this guide: http://paulcracknell.com/9/create-a-change-password-page-laravel-5-3/

I use Laravel 5.4, but I do not think that change...

When I enter my old password and the new one, I get the notification: "Your password has been changed" Check out phpmyadmin, and the password is correctly generated... But when I leave my account and try to get back with the new data, It tells me that the password is not valid...

I tried to use it too:

'password' => bcrypt($request->password)
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.