pirmax

pirmax

Member Since 2 Years Ago

Experience Points 1,100
Experience Level 1

3,900 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 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

02 Jan
6 months ago

pirmax started a new conversation Laravel 5.7 - Queues Jobs Are Too Slow

I use Laravel 5.7 and 3 queues jobs, the time between jobs is too long/slow.

I foreach items of RSS feeds in the first job, and I dispatch this item in second job, etc... I don't enter in details but there are some ridiculous little calculations that must not take time.

The problem is that every dispatch to a job takes a lot of time. Horizon and Telescope do not allow me to debug.

The machine I use has 32 GB of RAM, and there are several processes (15 each) that turn the tails.

[program:mywebsite_feeder]
command=/RunCloud/Packages/php72rc/bin/php artisan queue:work redis --queue=feeder --tries=3 --sleep=0
directory=/home/runcloud/webapps/mywebsite
redirect_stderr=true
autostart=true
autorestart=true
user=runcloud
numprocs=15
process_name=%(program_name)s_%(process_num)s
07 Oct
9 months ago

pirmax left a reply on Queues Aren't Fired On Laravel Forge

I solved the problem with production in Environment (Optional) on Laravel Forge Queue config.

pirmax started a new conversation Queues Aren't Fired On Laravel Forge

Hi,

I use Laravel Forge to deploy my Laravel website.

Configuration of my .env for Redis and Queues:

QUEUE_CONNECTION=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

I run Worker As Daemon from Laravel Forge. No entry in laravel.log.

The problem is queue aren't fired...

Thanks.

21 Sep
10 months ago

pirmax started a new conversation Small Topic For You How Do You Deploy Your Laravel Applications?

Hello,

Small topic for you how do you deploy your Laravel applications?

  • free if possible
  • FTP / SFTP / Git?
  • application
  • etc ...

Maxence.

19 Sep
10 months ago

pirmax started a new conversation Laravel 5.7 - Change .env File Location For Production

I use Dokku to host my Laravel 5.7 project.

  • I have a .env.production for production environment.
  • I have a .env.staging for staging environment.
  • I have a .env.local for local environment.

I can add Dokku config APP_ENV=production on server and I want Laravel know the file to use by APP_ENV.

18 Sep
10 months ago

pirmax started a new conversation Laravel API / Passport - Change Auth User

I use Laravel 5.7 with Passport and Vue component.

I have a Vue component with method to change Auth of user, this method call API by POST.

My API is protected by auth:api middleware.

The connexion to site is with PHP session. I don't want use JWT.

How I can change the account connected ?

public function switchAccount(Request $request, Team $team, User $user)
{
    Auth::guard('web')->login($user);
}
01 Sep
10 months ago

pirmax left a reply on Laravel 5.6 & Algolia Search Return Empty Result

With paginate to 5 items, I have this:

  #total: 15
  #lastPage: 3
  #items: Collection {#252 ▶}
  #perPage: 5
  #currentPage: 1
  #path: "http://appalternative.localhost:8000/search"
  #query: array:1 [▶]
  #fragment: null
  #pageName: "page"
}```

But nothing in items...
29 Aug
10 months ago

pirmax left a reply on Laravel 5.6 & Algolia Search Return Empty Result

Thanks @aurawindsurfing but if I use ->raw() instead of ->get(), I've data. On my dashboard, I've queries...

27 Aug
10 months ago

pirmax started a new conversation Laravel 5.6 & Algolia Search Return Empty Result

I'm using Algolia on Laravel 5.6. I follow the tutorial on Laravel doc.

$searches = Application::search($query)->get();

Collection {#243 ▼ #items: [] }

When I search an application, the result return me 0 item.

I type this command:

php artisan scout:import "App\Models\Application"

to send items on Algolia, and they are present on Algolia dashboard, I can see it.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;

class Application extends Model
{
    use Searchable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'title',
        'slug',
        'short_description',
        'long_description',
        'state',
    ];

    /**
     * @return string
     */
    public function searchableAs()
    {
        return 'applications';
    }

    /**
     * @return mixed
     */
    public function getScoutKey()
    {
        return $this->title;
    }
}
02 Nov
1 year ago

pirmax started a new conversation Lumen 5.5 Socialite Providers Doesn't Works With SetConfig()

I use Laravel Socialite Providers (https://socialiteproviders.github.io/) to login user on Lumen 5.5 API. setConfig() method, to force config, doesn't works for me...

Here below, my error and my code. The problem is that I do not know why I have this error.

Display Error:

Type error: Argument 1 passed to Laravel\Socialite\SocialiteManager::formatConfig() must be of the type array, null given, called in /home/vagrant/www/project1/api.website.app/vendor/laravel/socialite/src/SocialiteManager.php on line 125

PHP code:

$clientId = env('TWITTER_KEY');
$clientSecret = env('TWITTER_SECRET');
$redirectUrl = env('TWITTER_REDIRECT_URI');
$additionalProviderConfig = [];
$config = new SocialiteConfig($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);

return Socialite::with('twitter')->stateless()->setConfig($config)->redirect();
17 Sep
1 year ago

pirmax started a new conversation Use Laravel Controller With Auth:api Middleware

I have a controller in Laravel 5.5 to CRUD. I use VueJS 2 and I want use middleware to protect controller. How it works ?

03 Sep
1 year ago

pirmax left a reply on Laravel 5.4 - Add Mail Headers List-unsubscribe

Yes I use Mailgun but I maked my proper newsletter system.

pirmax started a new conversation Laravel 5.4 - Add Mail Headers List-unsubscribe

Hello,

I search to add headers in mail markdown to unsubscribe with List-Unsubscribe

Mail/Newsletter.php content :

    {
        return $this->markdown('emails.newsletter.main')
            ->subject($this->title)
            ->with([
                'name' => $this->name,
                'title' => $this->title,
                'message' => $this->message,
            ])
            ->withSwiftMessage(function ($message) {
                $message->getHeaders()
                    ->addTextHeader('test', 'test')
                    ->addTextHeader('List-Unsubscribe', '<link-here>');
            });
    }```

Thanks to your help.
22 Jul
2 years ago

pirmax started a new conversation Laravel 5.2 - Socialite Providers Twitter Give Me Bad Authentication Data

I use Laravel 5.4 with Socialite Providers (http://socialiteproviders.github.io/providers/twitter/)

I want build an application with two Twitter services with no the same credentials.

I use this in services.php:

'twitter' => [
    'client_id' => env('TWITTER_KEY'),
    'client_secret' => env('TWITTER_SECRET'),
    'redirect' => env('TWITTER_REDIRECT_URI'),
],

I have this to my controller:

$config = new SocialiteProvidersConfig(
    env('TWITTER_CONSUMER_KEY_2'),
    env('TWITTER_CONSUMER_SECRET_2'),
    env('TWITTER_REDIRECT_URI_2')
);

return Socialite::with('twitter')->setConfig($config)->redirect();

I have my credentials to .env:

TWITTER_KEY=
TWITTER_SECRET=
TWITTER_REDIRECT_URI=

TWITTER_CONSUMER_KEY_2=xxx
TWITTER_CONSUMER_SECRET_2=xxx
TWITTER_REDIRECT_URI_2=http://localhost/twitter/login/callback

TWITTER_CONSUMER_KEY_3=xxx
TWITTER_CONSUMER_SECRET_3=xxx
TWITTER_REDIRECT_URI_3=http://localhost/twitter/login/callback

But, I have this error when I try to connect my Twitter account:

Received HTTP status code [400] with message "{"errors":[{"code":215,"message":"Bad Authentication data."}]}" when getting temporary credentials.

I have the impression that the configuration is not taken into account.

enter image description here

13 Jul
2 years ago

pirmax left a reply on Laravel 5.4 - Issue With Jobs After Move Model

Yes, I have already made this change.

pirmax left a reply on Laravel 5.4 - Issue With Jobs After Move Model

Thanks @Asonn.

I have already test this commands and have already this problem.

pirmax started a new conversation Laravel 5.4 - Jobs Are In Cache

I have an issue with Laravel 5.4 Jobs.

Jobs are in cache.

I tried:

  • php artisan clear-compiled
  • composer dump-autoload
  • php artisan queue:restart
  • php artisan cache:clear

My code isn't updated after this commands. I haven't idea why I have this problem.

pirmax started a new conversation Laravel 5.4 - Issue With Jobs After Move Model

I have this error on my console. I use Jobs from Laravel 5.4 and I have move the Feed Model in App\Models\Feed. Since two days, I have this error because Laravel doesn't find the Feed Model. I have restart my Jobs with php artisan queue:restart.

[2017-07-13 10:45:33] staging.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App\Feed' not found in /home/site_com/http/www/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php:45

<?php

namespace App\Jobs;

use App\Models\Feed;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class FetchFeeds implements ShouldQueue {
    protected $feed;
    public function __construct(Feed $feed)
    {
        $this->feed = $feed;
    }
}
02 Jun
2 years ago

pirmax left a reply on Homestead: How To Enable Html5 Mode Of AngularJS

I have the same problem.

31 May
2 years ago

pirmax left a reply on Laravel Eloquent Count Results Grouped By Days

I'm on MongoDB database, not MySQL. So I can't use the method table.

And day() is a MySQL function...

pirmax started a new conversation Laravel Eloquent Count Results Grouped By Days

I search to count results grouped by days with Laravel Eloquent on Collection/Connexion MongoDB.

_id | user_id | item_id | created_at

I have this code but it's doesn't works...

$readings = \DB::connection('mongodb')
    ->collection('readings')
    ->where('user_id', 1)
    ->where('item_id', '592694ea9f9d5153aa26c6e5')
    ->groupBy(function($item) {
        return Carbon::createFromFormat('Y-m-d', $item->date)->format('d');
    });

dd($readings);

I want group all results counted by day. Please help me ☺

29 May
2 years ago

pirmax left a reply on Laravel 5.4 MongoDB Error With Job Queues

Thank you but I found where the error came from.

In fact, jobs are cached, just run the command php artisan queue:restart

Thank you for your help.

27 May
2 years ago

pirmax started a new conversation Laravel 5.4 MongoDB Error With Job Queues

I use Laravel MongoDB, I have a Item model class with Jenssegers\Mongodb\Eloquent\Model, and I have a problem with Job Queues.

In Job Queue, the model Item class search in MySQL database and not in MongoDB database...

My Item class model:

<?php

namespace App;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;

class Item extends Eloquent
{
    protected $collection = 'items';
    protected $connection = 'mongodb';

    protected $fillable = [
        'user_id',
        'feed_id',
        'title',
        'slug',
        'link',
        'description',
        'thumbnail',
    ];

    protected $dates = [
        'created_at',
        'updated_at'
    ];

My Fetcher Job:

<?php

namespace App\Jobs;

use App\Feed;
use App\Item;
use Exception;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class FetcherFeeds implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $tries = 5;

    protected $feed;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(Feed $feed)
    {
        $this->feed = $feed;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $item = Item::where('user_id', $this->feed->user_id)
                    ->where('feed_id', $this->feed->id)
                    ->first();
    }

    public function failed(Exception $exception)
    {
        //
    }

My error in laravel.log:

Next Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site_com.items' doesn't exist (SQL: select * from items where user_id = 1 and feed_id = 6088 limit

  1. in /home/site_com/http/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:647

The system search on MySQL database, and not in MongoDB database... It's very strange!

26 May
2 years ago

pirmax left a reply on Error With Queue Job Dispatch And Laravel MongoDB

    'user_id' => $feed->user_id,
    'feed_id' => $feed->id,
    'title' => $itemTitle,
    'slug' => $itemSlug,
    'link' => $itemLink,
    'description' => $itemDescription,
])```

It's works!

But, in job queue, the model is connected on database I have the impression...

pirmax left a reply on Error With Queue Job Dispatch And Laravel MongoDB

Yes, I can of course, in MongoDB, not database. Database haven't item's table.

pirmax left a reply on Error With Queue Job Dispatch And Laravel MongoDB

Yes the collection exist on MongoDB. I can watch it with RoboMongo. And they are more of 2M lines in collection.

Model is connected for MongoDB.

pirmax started a new conversation Error With Queue Job Dispatch And Laravel MongoDB

Hi !

I use this package and queue of Laravel 5.4.

When I dispatch a job, I have an error :

Next Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site_com.items' doesn't exist (SQL: select * from items where user_id = 1 and slug = slug-slug-slug-slug-slug and feed_id = 1 limit 1) in /home/site_com/http/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:647

My Handle Job :

return Item::create([
                'user_id' => $this->feed->user_id,
                'feed_id' => $this->feed->id,
                'title' => $this->itemTitle,
                'slug' => $this->itemSlug,
            ]);

My Model :

<?php

namespace App;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;

class Item extends Eloquent
{
    protected $collection = 'items';
    protected $connection = 'mongodb';

    protected $fillable = [
        'user_id',
        'feed_id',
        'title',
        'slug',
    ];

Why ?

25 May
2 years ago

pirmax started a new conversation Laravel 5.4 With Moloquent Give Error When Insert Data

I have this error with moloquent/moloquent package.

composer require moloquent/moloquent

My Item class Model extended from Moloquent:

<?php

namespace App;

use Moloquent\Eloquent\Model as Eloquent;

class Item extends Eloquent
{
    protected $collection = 'items';
    protected $connection = 'mongodb';
...
}

My test to insert into items collection:

Item::create([
    'user_id' => 1,
    'title' => 'test',
    'slug' => 'test',
])

Result:

FatalThrowableError in Builder.php line 103: Type error: Argument 1 passed to Moloquent\Query\Builder::__construct() must be an instance of Moloquent\Connection, instance of Illuminate\Database\MySqlConnection given, called in /home/site_com/http/www/vendor/moloquent/moloquent/src/Eloquent/Model.php on line 560

19 May
2 years ago

pirmax left a reply on Laravel 5.4 - Error When Vendor:publish Executed Command

I added this class but it's always the same problem...

I can't publish vendor...

pirmax started a new conversation Laravel 5.4 - Error When Vendor:publish Executed Command

I just installed Laravel 5.4.* and I have error when I execute this command:

php artisan vendor:publish



  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Class 'League\Flysystem\MountManager' not found


[email protected]:~/projects/xxxx_com$```

Have you got an idea?
18 May
2 years ago

pirmax started a new conversation Use Braintree Instead Of Stripe On Laravel 5.3

Hello,

I use this : https://laravel.com/docs/5.3/billing (Braintree) but when I test payment, the system search the stripe_id column.

How to force use Braintree instead of Stripe ?

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'stripe_id' in 'field list' (SQL: update `users` set `updated_at` = 2017-05-18 23:01:28, `stripe_id` = cus_*** where `id` = 1)

26 Feb
2 years ago
13 Aug
2 years ago

pirmax started a new conversation SocialiteProviders : InvalidStateException In AbstractProvider.php Line 32

Hi, I use SocialiteProviders but to redirect (callback), I get this error : http://my.app/auth/linkedin/callback?code=...&state=...#!

InvalidStateException in AbstractProvider.php line 32```

Could you help me please ?