Yahav

Yahav

Member Since 4 Years Ago

Experience Points 9,120
Experience Level 2

880 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 117
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.

29 Jul
1 month ago

Yahav started a new conversation Carbon 2?

So, Laravel 5.8 suppose to have built-in support for Carbon 1 and 2 however i cannot find any documentation on how to actuall set it to use Carbon 2, all i can find is setting default laravel date to CarbonImmutable, however i don't want CarbonImmutable, i want to be able to use Carbon2 features.

Any ideas on this?

27 Jul
1 month ago

Yahav left a reply on Storing Date/Time As UTC, Problem With Daylight Savings Time

@ydid you ever find a solution? pretty much all those replies and none actually address the issue.

22 Apr
4 months ago

Yahav left a reply on Route-Model Binding Doesn't Work

@SNAPEY - You my good sir, are right :) Thanks

21 Apr
4 months ago

Yahav started a new conversation Route-Model Binding Doesn't Work

Hey guys

I have this really odd problem in which the the route-model binding doesn't seem to work while if i remove the model type hint from the controller and do find($id) instead it works like a charm. The Route: Route::get('stream/{channelStream}/edit', '[email protected]')->name('stream.edit'); The Model: class ChannelStream extends Model The DB Table name: channel_streams The controller method: public function edit(ChannelStream $stream)

However, i don't get 404, and a query isn't logged for this request.. When i dump $stream inside the controller i get the following:

debug
ChannelStream {#881 ▼
  #fillable: array:4 [▶]
  #hidden: []
  #with: []
  +sortable: array:2 [▶]
  #connection: null
  #table: null
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #withCount: []
  #perPage: 15
  +exists: false
  +wasRecentlyCreated: false
  #attributes: []
  #original: []
  #changes: []
  #casts: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #visible: []
  #guarded: array:1 [▶]
}

Basically, its empty, it doesn't fetch the db record.

Any ideas what can this be?

06 Feb
7 months ago

Yahav started a new conversation Laravel One To Many Polymorphic - One (model) To Many (many Types Of Models)

So, i've been searching for a long time now, none of the answers here match this query.

I have a channel, and each channel can have multiple types of streams, each type is a different model. each stream can only belong to one channel. https://i.stack.imgur.com/b7le7.png

So its a one to many relationship, one channel has many streams of different type but each stream belongs to only one channel.

I know polymorphic relationship is required to assert which stream model it is but, how on earth do i link the channel to each stream?

I can have channel_id field at each of the stream models tables, but then how would i get them all via the channel model? well, here's where the polymorphic relationship is required, but how it applied? the only way i can think of is a pivot table that will contain channel_id, stream_id, stream_type. https://i.stack.imgur.com/4wVTU.png However, this makes it a many to many relationship now doesn't it?! and how would i access it? $channel->stream->streamable or even worst, how would i set it? save streamable to the Stream and attach Stream to Channel and ?

Any ideas how's best to implement such thing?

17 Jan
7 months ago

Yahav left a reply on Multi Auth While One Guard Should Be Multi-tenant Plus Socialite

Thanks for the reply. why a pivot table is required though? each user(reader) only belongs to one blog.

so i'll create a model for readers and assign the authenticable trait and stuff.. the migration would have blog_id. but how would i go about authenticating the readers to that specific blog? my problem is how would the authentication work in this case of the blog_

Yahav started a new conversation Multi Auth While One Guard Should Be Multi-tenant Plus Socialite

So, i need to have a multi-auth system which is fairly straight forward (going to use the following just to make it easy on me: https://github.com/Hesto/multi-auth )

However the problematic part of all this is that one of them guards should be multi-tenant, i'll explain: the first guard is for users, simple and ordinary. each user has its own blog. each blog is a "separate website". the second guard is for readers, each reader should be able to signup to each blog individually, even with a different password. so the same email should be able to register multiple times granted its a different blog. not only that, readers should be able to signing using socialite which just make this even more complicated.

the problem is that i have no earthly idea how to achieve that logic using laravel, any advice?

25 Nov
9 months ago
23 Nov
9 months ago

Yahav started a new conversation Multi Auth While One Guard Should Be Multi-tenant

So, i need to have a multi-auth system which is fairly straight forward (going to use the following just to make it easy on me: https://packagist.org/packages/bitfumes/laravel-multiauth) However the problematic part of all this is that one of them guards should be multi-tenant, i'll explain: the first guard is for users, simple and ordinary. each user has its own blog. each blog is a "separate website". the second guard is for readers, each reader should be able to signup to each blog individually, even with a different password. so the same email should be able to register multiple times granted its a different blog. not only that, readers should be able to signing using socialite which just make this even more complicated. the problem is that i have no earthly idea how to achieve that logic using laravel, any advice?

22 Nov
9 months ago

Yahav left a reply on Creating A Helper Function That Fetches An Instance

and it will only be resolved one time? like a singleton? also, at some routes there wouldn't even be a Station at the container, would that cause the app to throw an error even when the function wasn't executed?

21 Nov
9 months ago

Yahav started a new conversation Creating A Helper Function That Fetches An Instance

So, i got the following routing:

Route::domain('{domain}')
             ->middleware(['web','domain.to.station'])
             ->namespace($this->namespace)
             ->group(base_path('routes/frontend.php'));

basically with the $domain i'll be able to get the right Station model which i'd like to be available at the controllers without the need to search for the station by the domain at each controller, so i have a middleware:

public function handle($request, Closure $next)
    {
        $station = []; // here i'll get the station model instance
        app()->instance('Station', $station);

        $request->route()->forgetParameter('domain');
        return $next($request);

now, in order to use this at the controllers i'll have to do: $station= resolve('Station'); i do however would like to be able to receive the Station instance without putting this line at each controller, i'd like to be able to do something like: station() to get the model instance. just like we do with auth() helper.

How can i create a helper that resolve the instance only one time and return the instance?

11 Aug
1 year ago

Yahav left a reply on Mix At Production

  1. yeah, its quite clear, so basically i should add the public assests dir to the gitignore file and compile at production. BUT i do want to have the files minified at production, and i can't have a different webpack.mix.js because this would break the git workflow unless i ignore it too but then i'll have to modify it at prod everytime i have some new assets added. if there was a way to specify at webpack.mix.js some condition like if (env=='production') minify()... it would be great option.

  2. turns out i have no need for webpack since i only use vanila JS.

also the mix documentation states:

"Similar to combining stylesheets with mix.styles(), you may also combine and minify any number of JavaScript files with the scripts() method:"

but scripts() won't minify the scripts at all..

Yahav left a reply on Mix At Production

"The process with assets like this should be development locally and compiling on the server. This way you don't have everything in your repository and you won't have merge conflicts with all the compiled files all the time. This also means you need to run node and npm on your server of course."

How would that work? can you elaborate?

"Note that you can still use Laravel Elixir if you wish: https://laravel.com/docs/5.3/elixir"

I would rather not used a deprecated software with no future support and updates.

"Any reason why Laravel Mix is nothing for you?"

Well, Elixir was really easy to handle, this whole webpack thing, i never got it to actually work for me, no matter how much i read about it, couldn't get it to work.

Yahav started a new conversation Mix At Production

So i'm just about ready to deploy my app, files and everything is on the prod server, running 'npm run prod' However, it doesn't seem to make much different from the development command result wise, i would expected some minification at least . I do not use the crappy webpack and i wish to god laravel would've still been using elixir and gulp but.. so here's the mix js file: https://paste.laravel.io/b03d0acc-a16e-4c65-88b2-0bb5e5fb3bf2#

so, basically there's no meaning to the run prod or dev in my case? should i specifically use the minify command? this would screw my git setup somewhat.

02 Aug
1 year ago

Yahav started a new conversation ErrorException: Error While Sending STMT_PREPARE Packet. PID=291 In /console/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:80

Heya

I have a queued jobs that can sometime be long running, i'm talking 12-18 hours in some cases, depends on the amount of data needs to be processed. this script process data received from an API and eventually store most of it at the database. When the job has a lot of data i get the following error:

ErrorException: Error while sending STMT_PREPARE packet. PID=291 in /home/yahav/www/console/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:80
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Error while sen...', '/home/yahav/www...', 80, Array)
#1 /home/yahav/www/console/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(80): PDO->prepare('insert into `co...', Array)
#2 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php(452): Doctrine\DBAL\Driver\PDOConnection->prepare('insert into `co...')
#3 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php(657): Illuminate\Database\Connection->Illuminate\Database\{closure}('insert into `co...', Array)
#4 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\Database\Connection->runQueryCallback('insert into `co...', Array, Object(Closure))
#5 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php(459): Illuminate\Database\Connection->run('insert into `co...', Array, Object(Closure))
#6 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php(411): Illuminate\Database\Connection->statement('insert into `co...', Array)
#7 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert('insert into `co...', Array)
#8 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2494): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `co...', Array, 'id')
#9 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1283): Illuminate\Database\Query\Builder->insertGetId(Array, 'id')
#10 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(794): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#11 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(759): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#12 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(622): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#13 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(755): Illuminate\Database\Eloquent\Model->save()
#14 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Support/helpers.php(1041): Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}(Object(App\Models\CommentableItem))
#15 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(756): tap(Object(App\Models\CommentableItem), Object(Closure))
#16 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1577): Illuminate\Database\Eloquent\Builder->create(Array)
#17 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1589): Illuminate\Database\Eloquent\Model->__call('create', Array)
#18 /home/yahav/www/console/app/Classes/Platforms/Processors/YoutubeProcessor.php(226): Illuminate\Database\Eloquent\Model::__callStatic('create', Array)
#19 [internal function]: App\Classes\Platforms\Processors\YoutubeProcessor->createCommentableItemRecordAndUpdateId(Array, 'GXuuVuKIEc4')
#20 /home/yahav/www/console/app/Classes/Platforms/Processors/YoutubeProcessor.php(145): array_walk(Array, Array)
#21 /home/yahav/www/console/app/Jobs/ProcessReportJob.php(165): App\Classes\Platforms\Processors\YoutubeProcessor->process()
#22 /home/yahav/www/console/app/Jobs/ProcessReportJob.php(108): App\Jobs\ProcessReportJob->processJob()
#23 [internal function]: App\Jobs\ProcessReportJob->handle()
#24 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#25 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#26 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#27 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#28 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#29 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\ProcessReportJob))
#30 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\ProcessReportJob))
#31 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#32 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\ProcessReportJob), false)
#33 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\BeanstalkdJob), Array)
#34 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(322): Illuminate\Queue\Jobs\Job->fire()
#35 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(272): Illuminate\Queue\Worker->process('beanstalkd', Object(Illuminate\Queue\Jobs\BeanstalkdJob), Object(Illuminate\Queue\WorkerOptions))
#36 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\BeanstalkdJob), 'beanstalkd', Object(Illuminate\Queue\WorkerOptions))
#37 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('beanstalkd', 'reportProcessin...', Object(Illuminate\Queue\WorkerOptions))
#38 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('beanstalkd', 'reportProcessin...')
#39 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#40 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#41 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#42 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#43 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#44 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Console/Command.php(184): Illuminate\Container\Container->call(Array)
#45 /home/yahav/www/console/vendor/symfony/console/Command/Command.php(251): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#46 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Console/Command.php(171): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#47 /home/yahav/www/console/vendor/symfony/console/Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#48 /home/yahav/www/console/vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#49 /home/yahav/www/console/vendor/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#50 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Console/Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#51 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#52 /home/yahav/www/console/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#53 {main}

Next Illuminate\Database\QueryException: Error while sending STMT_PREPARE packet. PID=291 (SQL: insert into `commentable_items` (`commentable_item_id`, `report_result_id`, `comments_count`, `url`, `title`, `published_at`, `thumbnail`, `view_count`, `like_count`, `dislike_count`, `favorite_count`, `updated_at`, `created_at`) values (GXuuVuKIEc4, 240, 40944, https://www.youtube.com/watchLOGAN PAUL WINS OVER KSI2018-07-31 17:36:17v=GXuuVuKIEc4, {"height":90,"width":120,"url":"https:\/\/i.ytimg.com\/vi\/GXuuVuKIEc4\/default.jpg"}, 4286747, 317075, 10847, 0, 2018-08-02 08:44:35, 2018-08-02 08:44:35, ?, ?)) in /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
Stack trace:
#0 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\Database\Connection->runQueryCallback('insert into `co...', Array, Object(Closure))
#1 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php(459): Illuminate\Database\Connection->run('insert into `co...', Array, Object(Closure))
#2 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Connection.php(411): Illuminate\Database\Connection->statement('insert into `co...', Array)
#3 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert('insert into `co...', Array)
#4 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2494): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `co...', Array, 'id')
#5 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1283): Illuminate\Database\Query\Builder->insertGetId(Array, 'id')
#6 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(794): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#7 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(759): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#8 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(622): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#9 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(755): Illuminate\Database\Eloquent\Model->save()
#10 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Support/helpers.php(1041): Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}(Object(App\Models\CommentableItem))
#11 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(756): tap(Object(App\Models\CommentableItem), Object(Closure))
#12 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1577): Illuminate\Database\Eloquent\Builder->create(Array)
#13 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1589): Illuminate\Database\Eloquent\Model->__call('create', Array)
#14 /home/yahav/www/console/app/Classes/Platforms/Processors/YoutubeProcessor.php(226): Illuminate\Database\Eloquent\Model::__callStatic('create', Array)
#15 [internal function]: App\Classes\Platforms\Processors\YoutubeProcessor->createCommentableItemRecordAndUpdateId(Array, 'GXuuVuKIEc4')
#16 /home/yahav/www/console/app/Classes/Platforms/Processors/YoutubeProcessor.php(145): array_walk(Array, Array)
#17 /home/yahav/www/console/app/Jobs/ProcessReportJob.php(165): App\Classes\Platforms\Processors\YoutubeProcessor->process()
#18 /home/yahav/www/console/app/Jobs/ProcessReportJob.php(108): App\Jobs\ProcessReportJob->processJob()
#19 [internal function]: App\Jobs\ProcessReportJob->handle()
#20 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#21 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#22 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#23 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#24 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#25 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\ProcessReportJob))
#26 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\ProcessReportJob))
#27 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#28 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\ProcessReportJob), false)
#29 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\BeanstalkdJob), Array)
#30 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(322): Illuminate\Queue\Jobs\Job->fire()
#31 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(272): Illuminate\Queue\Worker->process('beanstalkd', Object(Illuminate\Queue\Jobs\BeanstalkdJob), Object(Illuminate\Queue\WorkerOptions))
#32 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\BeanstalkdJob), 'beanstalkd', Object(Illuminate\Queue\WorkerOptions))
#33 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('beanstalkd', 'reportProcessin...', Object(Illuminate\Queue\WorkerOptions))
#34 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('beanstalkd', 'reportProcessin...')
#35 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#36 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#37 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#38 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#39 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#40 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Console/Command.php(184): Illuminate\Container\Container->call(Array)
#41 /home/yahav/www/console/vendor/symfony/console/Command/Command.php(251): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#42 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Console/Command.php(171): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#43 /home/yahav/www/console/vendor/symfony/console/Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#44 /home/yahav/www/console/vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#45 /home/yahav/www/console/vendor/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#46 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Console/Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#47 /home/yahav/www/console/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#48 /home/yahav/www/console/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#49 {main}

All the results i got at Google for this was for outdated releases of Laravel and not relevant anymore and i'm quite stuck. anyone have any idea on how to handle it?

30 Jul
1 year ago

Yahav started a new conversation Queue:work --memory Parameter

Heya guys

Trying to figure out what exactly is the --memory param at the queue:work command. the CLI -h states: "The memory limit in megabytes [default: "128"]" not very informative. not a mention at the laravel docs that i can find. what memory is it limit? and what happen when the limit is reached? does it limit the process memory? if so, what happen when it reached? does it terminate the worker? even if a job is currently running?

29 Jul
1 year ago

Yahav left a reply on Queue Worker Memory Limit Issue

bumping this out of interest.

17 Apr
1 year ago

Yahav started a new conversation Getting Laravel's Logger Instance

So, i have this library which accepts: Psr\Log\LoggerInterface $logger i would like to inject laravel's logger instance to it since it does comply with the PSR log interface. however, i'm not finding any suggestion on how do i recive the Laravel's logger instance in order to inject it.

Any hints?

29 Mar
1 year ago

Yahav left a reply on "Maximum Execution Time Of 30 Seconds Exceeded" In A Job

but then i won't be able to debug it at the browser wouldn't i?

Yahav left a reply on "Maximum Execution Time Of 30 Seconds Exceeded" In A Job

Ok the

set_time_limit ( int $seconds )

seem to have solved it, however now i get 500 HTTP error at the end and nothing at the laravel log nor the http error log. what on earth is going on

28 Mar
1 year ago

Yahav left a reply on "Maximum Execution Time Of 30 Seconds Exceeded" In A Job

I probably didn't explained it very well but it is required to be one job, as its one report that i'm generating. the queue is there for long and "heavy" processes.

also, i've set the

public $timeout = 0;

but still, same

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Maximum execution time of 30 seconds exceeded

Yahav left a reply on "Maximum Execution Time Of 30 Seconds Exceeded" In A Job

Well, its running using the SYNC driver, so i put it inside the job class: public $timeout = 0;

Yahav left a reply on "Maximum Execution Time Of 30 Seconds Exceeded" In A Job

Yamen: tried that, doesn't work. also, i think that t he default is 0. Helmchen: no can't do :( the job is making tons of requests to external API and receives tens of thousand of texts and analyzes them from different aspects.

Yahav started a new conversation "Maximum Execution Time Of 30 Seconds Exceeded" In A Job

Hey there

I'm running a job that will be queued at production, however during the development i'm running it with the SYNC driver. at the past before i changed some minor code at thejob it used to ran for an hour if needed without any issues. now when i'm running it i'm getting the following message:

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Maximum execution time of 30 seconds exceeded

The thing is, that the job runs for about 25 minutes before i get this message which means its not reallly the 30 seconds execution that is the problem.

can't find the issue at all. anyone got any ideas for me?

13 Feb
1 year ago

Yahav started a new conversation Once Again, Polymorphic Many To Many?

So, its been a few days that i try to solve this thing out. i read about polymorphic relationships as well as poly many to many and those doesn't seem to be the solution for my problem. So, i have this schema. https://i.imgur.com/F4fzHsT.png now, those orange tables, there are all "reports" models.. the blue report_jobs should have one or many reports models attached. each report item/dbrow will be unique to the reportJob, meaning a reportJob can have multiple reports (wordCloudConfigs and KeywordSearchConfig and SomeOtherConfig), but each of those, can be only belong to that one reportJob.

How would you make this work at eloquent?

12 Feb
1 year ago

Yahav left a reply on Can't Get The Hang Out Of The Whole Many To Many Polymorphic Relations Thing

You're right, i barely explained it well enough. so ReportJob could have multiple jobs (WordSearchJobsModel, KeywordCloudJob etc..) in addition to the single Platform. my problem is with the Jobs implementing. also, that video is dealing with one to many morph, which i kinda understand.

11 Feb
1 year ago

Yahav started a new conversation Can't Get The Hang Out Of The Whole Many To Many Polymorphic Relations Thing

So, i'm trying to understand the whole M2M Polymorphic relations and how to setup the models and migrations. This is my schema

report_jobs

id job_name platform_type platform_id

youtube_platform

id status next_run_date

twitter_platform

id status next_run_date

word_search_job

id status next_run_date number_of_searchers

keyword_cloud_job

id status next_run_date keywords

Now, each ReportJobModel should have one platform attached (YoutubePlatformModel or TwitterPlatformModel) and could have multiple jobs (WordSearchJobsModel, KeywordCloudJob etc..) so i set a one to many morph at the report_jobs migration: $table->morphs('platform'); hence the platform_type, platform_id fields. still haven't tested it but it should work as far as i understand. However my biggest problem is the many to many morph i need for the multiple jobs thing. now, i really tired understanding how to set it up but still cannot. Can anyone please give me some hints?

05 Feb
1 year ago

Yahav started a new conversation Laravel 5.5: Whopps Only Display Some Of The Details

hey guys

I'm using laravel 5.5 and i've noticed that at some scenarios whoops will only show some details: https://i.imgur.com/Yq1pP2f.png Most of the text is missing, any ideas what is going on?

Yahav left a reply on PHP Classes And Good Practice Question

Thanks Is it up to me or there is the "good" way and the "bad"way?

04 Feb
1 year ago

Yahav started a new conversation PHP Classes And Good Practice Question

So, this question is about structure and good practice.

say i have a class named: "YouTubeProcessor" which object is to fetch videos by channel and analyze them. So, at the constructor i''m passing the configs required to the class:

$youtube = new YouTubeProcessor($YouTubeConfigurationObject);

now, inside the class i have a private var ($YouTubeConfiguration) which i set at the constructor:

public function __construct(YouTubeConfiguration $YouTubeConfigurationObject)
{
$this->YouTubeConfiguration = $YouTubeConfigurationObject;
}

So far i assume its all good practice?

now, i need to create a new google api client and here's my question: do i create it at the constructor and pass it to other functions or create a class variable and put the created object in there? so basically its:

public function __construct(YouTubeConfiguration $YouTubeConfigurationObject)
    {
        $this->YouTubeConfiguration = $YouTubeConfigurationObject;

        $client = new Google_Client();
        someFunction($client);
    }

or

private $googleClient;
....
public function __construct(YouTubeConfiguration $YouTubeConfigurationObject)
    {
        $this->YouTubeConfiguration = $YouTubeConfigurationObject;

        $this->googleClient = new Google_Client();
        someFunction();
    }
protected function someFunction()
{
    /// using $this->googleClient;
}

which one is better/considered better practice? does it even matter?

26 Dec
1 year ago

Yahav left a reply on Advise On How To Approach A Situation (Jobs, Scheduler, Multi Workers )

@somnathsah yeah, thats what i thought, will it be considered good practice? will the cronjob script look for a due job record at the DB and then fire a Queued Event with that record information to be executed at the background? Or, the cronjob script will itself look for a due job record and do the actual processes?

Yahav left a reply on Advise On How To Approach A Situation (Jobs, Scheduler, Multi Workers )

What i'm asking is, what is the best way of achieving the scenario i presented laravel wise?

16 Dec
1 year ago

Yahav started a new conversation Advise On How To Approach A Situation (Jobs, Scheduler, Multi Workers )

Hey

So i'm about to start a project in which i'm going to have the following situation which i'm not sure how to properly handle with laravel: basically, users will be scheduling a recurring "report generation jobs" either monthly, weekly or daily. (by job i mean literally a job, not the "job" phrase associated with Laravel) each "job" will have a "next-run" date value, and i need a system that will continually fetch due jobs and execute them, in the background of course. i imagine that multiple jobs will need to run simultaneously so it will need to have multiple "workers".

any thoughts on how to achieve this?

Thanks

07 Aug
2 years ago

Yahav started a new conversation Events Vs Jobs, Am I Join It Right?

Hey guys

So, by now i've read plenty about jobs and events but still struggle a bit to decide what is the right way of constructing the following: lets say i have a form submitted, inside the controller i created the model and everything else, now i want to:

  1. send confirmation email.
  2. send a notification email to another person regarding the following submission.
  3. create a pdf document
  4. send the above pdf document within an email.

what would be the right laravel way of doing this? i thought of something like that:

0. QUEUED EVENT, trigger the event and get things running in background, 
within the event the following jobs will be dispatched:
        1. QUEUED JOB Send confirmation mail with invoice
        2. QUEUED JOB send an email to the latest bidder saying he's been outbid by this fella.
        3. QUEUED JOB create the certificate, inside this job, 
        within the job, the following job will be dispatched 
            3.2 QUEUED JOB mail the certificate

am i doing it all wrong or i got the concept of events and jobs?

31 Aug
3 years ago

Yahav left a reply on Laravel 5.3 Example

Thank you very much mate, this is great!

30 Aug
3 years ago

Yahav left a reply on Laravel 5.3 Multy Authentication

Thanks, i just found out that my use case will be quite different, because i will use the secondary authentication with social login (hybridauth or laravel socialite) in which case, the authentication will be handled by the provider, however, i will still have to have the user stored somehow. which i have no idea how to achieve.

Yahav left a reply on Two Authentication Systems?

Well, now after further research i'm not sure how much i'll need two authentication systems. the readers authentication will be done with the social gateway, the only challenge is to store those authenticated readers..any hints?

29 Aug
3 years ago

Yahav left a reply on Laravel 5.3 Multy Authentication

@Hesto I'm highly interested in your package as well, how would we know when you're finished?

28 Aug
3 years ago

Yahav left a reply on Two Authentication Systems?

can you expend more on guards? i any meaningful resource about them.

Yahav left a reply on Two Authentication Systems?

@Ruffles well, you're wrong. those are two separate authentication for different sections of the app, more then that, i need readers to be able to register to multiple stations, and i need the users (news desk staff) to be able to register to news desks as well.

Yahav started a new conversation Two Authentication Systems?

Hey fellas

I need a little advice. im working on a multi news desk website that require two kinds of authentication systems: the first type will be the users, those are actually the news desk staff, writers, managers, editors etc. for this i'll probably use the laravel ACL with roles and permissions. now, the second is the readers, the readers will be social users: facebook, twitter, google accounts that will sign using something like the HybridAuth package.now, the thing is that a reader will be able to register to multiple news desk using the same social account.

now, my question is, how do i go about having two types of authentications? i mean, laravel ships with authentication system, but how can i use it for two different types of users?

27 Mar
3 years ago

Yahav left a reply on Dep Injection?! Why?

class RegisterUsers { ... public function __construct(Mailer $mailer) { ... }

}

Yahav started a new conversation Dep Injection?! Why?

Was watching the following vid https://laracasts.com/series/laravel-5-from-scratch/episodes/16 at the start of the video Jeff gives the same example he gave at the video about Dep injection. the construct mailer instance injection. my question is, why does he inject or need to inject a mailer instance instead of just initiating it inside the RegisterUser class? this has puzzled me since i learned the concept of Dep Injection, although i get why it is necessary in some cases, i don't get why in such example it would be needed instead of just initiating it inside the class.

22 Mar
3 years ago

Yahav started a new conversation Progress And Priority For Laravel Videos

Hello

I don't quite know how to put it, but it seem that the laravel related series's (mainly, Laravel From Scratch) are taking real long time between each episode. while episodes related to many different subject is released at the same frequency as the laravel related ones, i assume Jeff is trying to keep it balanced. I beg to differ on this approach . see, Laravel itself is changing pretty much from release to release, i've gone through almost the whole Laravel 5 Fundamentals series, however, then the new laravel is released, new year has come, and new series has begin, the purpose of this cycle is so that the Laravel tutorials will reflect the latest version changes etc. now, this combined with the fact the most subscribers comes to LaraCasts in order to learn Laravel makes it quite logical that the focus of the creation of episodes should be on the Laravel. I'm not saying that Vim, Vue, and other misc serieses aren't helpful, infact i've been exposed to phpStorm here at laracasts and i think those extras are wonderful however, those aren't changed at the frequency as laravel nor has the same importance and necessity by the subscribers. my honest opinion is that the more logical think to do considering all of the above and the fact that some subscribers might be "stuck" waiting on them laravel episodes will be finishing Laravel related serieses first, and then, until next year (or next release major) giving the focus to those "extra" misc serieses.

Now, this came of like a rant, which it absolutely is not! i grateful and really appreciate Jeff, his efforts and what he's doing. LaraCasts is the best thing that ever happen to me as a php developer. i just thought i'd sound my thought.

Regards Yahav

23 Feb
3 years ago

Yahav started a new conversation PHP Interfaces, What Are They Really Good For?

Hello,

Just finished watching the OOP Bootcamp Interfaces chapter for the 3rd time. I don't seem to get it, what is it good for that Abstract Class can't do? except that you can only extend one abstract class (which is quite stupid if you ask me). Say the logger example he used, first of, why do i need to have the actually class require a logger class at the construct, say every single classes i have require a logger, would i have to attach a logger class to each any single one of them? why it would be wrong to make the logger static? I can't understand any of it..Interfaces just seem pointless to me, as i don't need a contract between my classes. but this seem to be a really main thing in OOP, what can i do?

07 Nov
3 years ago

Yahav started a new conversation Traits Or Abstract Classes

Hey

Been watching the videos on Traits and Abstract classes and they seem to me quite alike. only difference i notice is that you can only extend one abstract class while you can use multiple traits. is that it? So when would you use abstract instead of a trait? When would you use trait instead of abstract? and is there any difference that i didn't notice?