tzookb

tzookb

Member Since 5 Years Ago

Experience Points 14,455
Experience Level 3

545 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 201
Lessons
Completed
Best Reply Awards 1
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

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

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

31 Jul
2 years ago

tzookb left a reply on Laravel Elixir Rollup With React

Great thanks!

but they dont want to use webpack for some reason :/

so I need to find a way with rollup or go back to browserify :/

tzookb left a reply on Laravel Elixir Rollup With React

mmmm take a look at the terminal response:

[15:16:34] Using gulpfile ~/www/react-boilerplate/gulpfile.js [15:16:34] Starting 'all'... [15:16:34] Starting 'babel'...

Compatibility Alert!

'mix.babel()' was removed in Laravel Elixir 6.0. You'll want to instead call 'mix.rollup().'

even in the laravel latest docs, babel is not there anymore :/ https://laravel.com/docs/master/elixir#working-with-scripts

tzookb started a new conversation Laravel Elixir Rollup With React

Just noticed that babel is depracted with elixir 6.3

any ideas how to implement rollup with react in elixir?

keep failing.... :/

26 Jul
2 years ago

tzookb started a new conversation Vuejs Input, Textarea @mention Functionality

Browsed the web and found no plugins, only things jquery dependent or angular etc.

Somebody used one with Vue?

Tried to implement, but there are a lot of pits to fall in, and I don't like reinventing stuff.

I noticed we have it here but could not find what was used....

02 May
3 years ago

tzookb left a reply on Vue Add A "service" To The App Or Component

Yes of course, bu t how do I insert them in to the component?

Do I make them global?

tzookb started a new conversation Vue Add A "service" To The App Or Component

I want to create a dedicated js service for handling http requests, instead of dirtying my components with:

this.$http.get

stuff, I would us this with a dedicated service, and the components will use it instead, any ideas how do I implement that?

in angular it was called "services" for example...

19 Jun
3 years ago

tzookb left a reply on Laravel Testig Request Setting Header

I found the problem the app ran twice...

once when I used the JWTAuth facade, so it was created by an empty request and again when did the put test call.

So even though it looks bad, I do this steps:

  • create the user
  • create token based on the user
  • reset the application
  • create again the user (as this is in tests, he will still be the first user)
  • run the put request test
  • now when the controller that handles the test request gets first the request, and when it tries to use the JWTAuth facade, the object is created with the request that was created by the test.

** hope somebody understood, but it is surely an edge case

   $user = factory('App\User')->create();
    $token = JWTAuth::fromUser($user);

    $this->refreshApplication();

    $user = factory('App\User')->create();

    $server = [
        'HTTP_Authorization' => 'Bearer '.$token
    ];

    $res = $this->put('/api/posts?boom=tzook', [], $server);
    $res->seeStatusCode(200);

tzookb started a new conversation Laravel Testig Request Setting Header

Im trying to test the jwt authentication,

so I have a test that sets a request with a token in the header, but I simply cant place the token in the header.

this is what I need:

 Authorization: Bearer {yourtokenhere}

this is from this package

https://github.com/tymondesigns/jwt-auth/wiki/Authentication

17 Jun
4 years ago

tzookb left a reply on Deploy With Rsync

Thanks @fideloper !

great to get a response from you, the one I learned rsync and many cool server stuff!

now I use this:

 rsync LOCAL_PROJECT REMOTE_PROJECT -alz --delete --exclude-from=excludesFile

and this is my excludesFile:

bootstrap/cache/* .env .idea .git* node_modules storage/framework/cache/* storage/framework/session/* storage/framework/views/* storage/logs/* storage/app/*

14 Jun
4 years ago

tzookb started a new conversation Deploy With Rsync

does somebody here deploys with rsync?

if so how is your script "excludes"

how do I handle the storage/logs, storage/app/cache etc folders

07 Jun
4 years ago

tzookb left a reply on Strange Relationship Suggestion With Eloquent

yes, a game can be played by two teams only, and I stored them inside the game table as: home_team_id, away_team_id

do you have a better suggestion?

tzookb started a new conversation Strange Relationship Suggestion With Eloquent

Hello all, I have this design of soccer app.

  • teams table that consists a team name, id etc
  • games table that contains: id, home_team_id, away_team_id

so now I would like to have the eloquent relationship between those two tables.

  • one way of Game to teams is easy:

    class Game extends Model {

    public function home_team() { return $this->belongsTo('App\Team', 'home_team_id', 'id'); }

    public function away_team() { return $this->belongsTo('App\Team', 'away_team_id', 'id'); } }

so there is no problem to access the teams from the game model,

but now I want to get the games of a team model, but I cant use the casual way of relationship as a team could have a game in away and as home

22 May
4 years ago

tzookb left a reply on Mcrypy On Your Mac

wow you are the master!!

I did:

brew install mcrypt

thanks!

tzookb started a new conversation Mcrypy On Your Mac

I just got my new mac, and I installed composer perfectly, but now I need mcrypt.

How do I install mcrypt on my mac?

and I already installed with homebrew,

but I still get this error:

 - laravel/framework 5.0.x-dev requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
29 Apr
4 years ago

tzookb left a reply on Mocking And Testing With Eqlouent Inside

Forgot about this already, but when I get my computer I'll try to look at it again

23 Mar
4 years ago

tzookb left a reply on Laravel User Messaging Package

Of course it is good for one one first.

You can check our site http://bloompy.co but it is not a demo site, so not to much test messages ;)

04 Mar
4 years ago

tzookb started a new conversation Laravel Blog Package Help

I am creating a small package for a laravel blog.

I know there are some projects like "october cms" that provide a blog, but this is a full featured CMS.

I want something simple but still good for all my other sites.

So could provide them a blog with articles, tags and categories.

I already structured the models, migrations and relationships, I would now need some help on simple CRUD, so it would be easy to create, update and delete.

here is a link to the repo: https://github.com/tzookb/tbblog

it is really in the start, so if there somebody out there that needs a blog, or just want to learn and help, please contact me :)

27 Jan
4 years ago

tzookb left a reply on Laravel 5 Location Of Your App Mini Project

thanks @pmall, what do you say if it is a bit smaller box like "payemnts" and in payments I'll have:

Payments
    Contracts
    Services
    Models
    Events
    Console
    ServiceProvider.php

where would it be, as it relevant for "Api", and "Store"

tzookb started a new conversation Laravel 5 Location Of Your App Mini Project

Up until on in L4 we created a directory inside our "app" for most examples here :

app/Laracasts

now in L5

the whole "app" folder is under namespace, so where do I put my mini projects.

I mean I have an app withe several services like: store front, store api, store reports.

So I dont want to put all service providers, events, etc... all toghther.

I want to have a folder for each one like this

  front/
        providers
        events
  api/
       providers
   controllers
   reports
       console
       providers
21 Jan
4 years ago

tzookb left a reply on Macbook Pro Vs Any Other Laptop With Ubuntu

hhhh not even one for not macbook, I currently work on it on my job, and in my home I have a pc with ubuntu on.

The only reason I am not taking the macbook is that I dont want to get swallowd by only mac products...

tzookb started a new conversation Macbook Pro Vs Any Other Laptop With Ubuntu

Im soon to purchase a new laptop, and I'm delegating between a mac or any other laptop that I'll install ubuntu on.

I would be happy to hear what you work with, and your suggestions.

Price could be from 1500 - 2000 usd

08 Jan
4 years ago

tzookb started a new conversation Laravel Routes And One Base Variable

hello all, provide a saas platform for many users and we provide api for each customer like this:

Route::group(array('domain' => '{client}.ourdomain.com/api/', function() {
    Route::get('/player/{playerId}', array(
         'as' => 'getOrderStatus',
         'uses' => 'ApiController@getPlayer'
    ));
}

now as you can see here, this route is for controller ApiController and getPlayer like this

 class ApiController extends Controller {
       public function xxxx($client, $playerId) { stuff }
 }

my questions is how can I save myself the headace of adding the $client for each method.... simply adding to the constructor or something, as this is one for all, and than for each method I go check if the id is ok....

07 Jan
4 years ago

tzookb started a new conversation Laravel User Messaging Package

sorry but I'm very proud and had to share my package: https://github.com/tzookb/tbmsg

it is for creating user messaging system, with group messages private conversations and more.

The most important thing, I added tests so now it is much more lfun and less risky to add and refactor stuff :)

05 Jan
4 years ago

tzookb started a new conversation Laravel Database And Eloquent Connection

this question is for the masters of laravel DB and eloquent objects. In a brief I use for tests a sqlite in memory DB, so I create the laravel DB but than the eloquent objects dont use the same connection.

This is for my laravel messaging package, you could view the files in my github: https://github.com/tzookb/tbmsg/tree/dev/tests

and here is my stackoverflow question with a bit more explenation: http://stackoverflow.com/questions/27786967/phpunit-testing-with-sqlite-and-laravel-eloquent

29 Dec
4 years ago

tzookb left a reply on Rollback Migrations Of Package

yes of course.... and as I said it worked for the migrate, it doesn't work for the rollback.

tzookb started a new conversation Rollback Migrations Of Package

I had build this package for laravel messaging:

https://github.com/tzookb/TBMsg

Now I have an issue with rolling back migrations, as it gives error.

I tried this:

 php artisan migrate:reset

this gives class not found error

so I tried to hack it and did:

php artisan migrate:reset --package=tzookb/tbmsg

and --package is not available with reset

so any ideas how to do it? or maybe my code is wrong... (it works great with simple migrate)

18 Dec
4 years ago

tzookb started a new conversation Phpstrom Reformat Code, Possible?

I love the phpstorm reformat code, but I have this code:

    $this->id                   = $row->id;
    $this->orderNumber = $row->OrderNumber;
    $this->lineNumber    = $row->LineNumber;

and it looks great, but when I reformat it goes back to

    $this->id = $row->id;
    $this->orderNumber = $row->OrderNumber;
    $this->lineNumber = $row->LineNumber;

is it possible to tell phpstorm, that the first option is the desired one?

23 Nov
4 years ago

tzookb left a reply on I Need To Mock A Php Function

thanks just found this exact answer as well, great!

tzookb started a new conversation I Need To Mock A Php Function

have my class that inside it's method it uses php function:

shell_exec($cmd)

now I want to override it's implementations so I could mock and test my class, somebody here done something like this?

05 Nov
4 years ago

tzookb started a new conversation Laravel Mailer Add Amazon SES

I now need to add amazon SES api to our laravel project,

so I used ssssss

and created this class: (below)

you can see that in the send method I create a config for the SesClient but this config gives error, as the $message object is not fully filled

this function gives me null: getReplyTo getSender getReturnPath

so I need those objects in the config or the SesClient request will give an error, any ideas how to handle this?

<?php

namespace Base\Infrastructure\Mailer;

use Aws\Ses\SesClient;
use Swift_Events_EventListener;
use Swift_Mime_Message;
use Swift_Transport;

class SesMailerTransport implements Swift_Transport
{

    /**
     * @var SesClient
     */
    protected $sesClient;

    public function __construct(SesClient $sesClient)
    {
        $this->sesClient = $sesClient;
    }

    /**
     * Send the given Message.
     *
     * Recipient/sender data will be retrieved from the Message API.
     * The return value is the number of recipients who were accepted for delivery.
     *
     * @param Swift_Mime_Message $message
     * @param string[] $failedRecipients An array of failures by-reference
     *
     * @return int
     */
    public function send(Swift_Mime_Message $message, &$failedRecipients = null)
    {
        $config = array(
            // Source is required
            'Source' => 'support@oursite.com',
            // Destination is required
            'Destination' => array(
                'ToAddresses' => $message->getTo(),
                'CcAddresses' => $message->getCc(),
                'BccAddresses' => $message->getBcc(),
            ),
            // Message is required
            'Message' => array(
                // Subject is required
                'Subject' => array(
                    // Data is required
                    'Data' => $message->getSubject(),
                    //'Charset' => 'string',
                ),
                // Body is required
                'Body' => array(
                    'Text' => array(
                        // Data is required
                        'Data' => $message->getBody(),
                        //'Charset' => 'string',
                    ),
                    'Html' => array(
                        // Data is required
                        'Data' => $message->getBody(),
                        //'Charset' => 'string',
                    ),
                ),
            ),
            'ReplyToAddresses' => $message->getFrom(),
            'ReturnPath' => $message->getSender(),
        );

        $result = $this->sesClient->sendEmail($config);

    }


    /**
     * {@inheritdoc}
     */
    public function registerPlugin(Swift_Events_EventListener $plugin)
    {
        //
    }

    /**
     * {@inheritdoc}
     */
    public function isStarted()
    {
        return true;
    }

    /**
     * {@inheritdoc}
     */
    public function start()
    {
        return true;
    }

    /**
     * {@inheritdoc}
     */
    public function stop()
    {
        return true;
    }
}
04 Nov
4 years ago

tzookb left a reply on Where Are You All From?

First one from Israel, Tel aviv :)

03 Nov
4 years ago

tzookb left a reply on Servers Deploy, Composer, Bower Etc

Yes of course it is minified, but for example we have bootstrap fonts and they must be in public production.

How do you handle it?

02 Nov
4 years ago

tzookb started a new conversation Servers Deploy, Composer, Bower Etc

We have several servers for our project and I got use to

composer install

now we started using bower, and as @JeffreyWay suggests we should .gitignore that as well. So now I need to

bower install 

on all my servers as well, that means that I need to install npm and bower for all the servers.

I that the right way to perform deploys?

git pull 
composer install
bower install
etc.....

or is there any other (better) way? (rsync maybe...)

30 Oct
4 years ago

tzookb started a new conversation Adding Test To My Package With DB

I have a package for laravel for user-messaging.

It creates several tables with migrations, and I want to add tests to my package.

In my laravel projects I use sqlite, so it's not a problem.

But this package is not in a laravel project, it is only a package, so how can I test it? any ideas?

28 Oct
4 years ago

tzookb left a reply on Laravel Scheduler

when you register your commands, maybe in some service provider you created, than you should check conditions in db or config and if they are good you add the command.

21 Oct
4 years ago

tzookb left a reply on Acceptance Tests While Setting The Environment Name

I used the same env for my acceptance as in my unit.

Sqlite in memory, and laravel module added to codeception.

But now I look for removing the laravel module as it outputs blank screenshots

20 Oct
4 years ago

tzookb left a reply on Injection When Class Is Bind To A Name

I think this is for laravel 5 only, any suggestions for laravel 4?

tzookb left a reply on Injection When Class Is Bind To A Name

bumping this up again, as I see the same problem with the laravel built in logger object:

I want to inject the larvel log object to my controller instead of using the facade. But I cant typehint it as it is binded to the container with

 this->app->instance('log', $logger);

ps - @JeffreyWay maybe you could help, as I learned this from you :)

15 Oct
4 years ago

tzookb left a reply on Injection When Class Is Bind To A Name

Hi @JoshWillei, I didn't mention but yes the constructor gets several configs.

So I just rebind it my self like @tag said

tzookb left a reply on Injection When Class Is Bind To A Name

thanks for your replies.

I dont do it, I want to use an external package: https://github.com/Intervention/image/blob/master/src/Intervention/Image/ImageServiceProvider.php

you can look at line 103, where the class is binded in to the App container, now I want to use this specific object.

I could simply use the Facade they provide: "Image" or I could use the --> $app->make('image')

but I prefer to inject it directly and use facade or inject the whole app to my classes.

tzookb started a new conversation Injection When Class Is Bind To A Name

I use the dependency injection to my constructor, but now I have a specific package that binds it's class like this:

$app->bindShared('image', function() { return  new ImageClass(); });

now I have a class that I want to use this class, and inject it to my constructor like this:

class MyClass {

    /** ImageClass */
    protected $image;

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

but this code will not work because "image" is not a namespace,

I could paste instead of it "ImageClass" and it will work, but than I will create a new instance every time, and I want to use the same object every time as it may get config and stuff there.

any ideas how?

13 Oct
4 years ago

tzookb started a new conversation Laravel Sqlite Database With Codeception Acceptance

I am creating great unit tests that work with an sqlite database, that on each test the sqlite database (in memory) gets a migrations and seeds.

the code:

class TestCase extends Illuminate\Foundation\Testing\TestCase {

protected $withDb = false;
/**
 * Creates the application.
 *
 * @return \Symfony\Component\HttpKernel\HttpKernelInterface
 */
public function createApplication()
{
    $unitTesting = true;

    $testEnvironment = 'testing';

    return require __DIR__.'/../../bootstrap/start.php';
}

public function setUp()
{
    parent::setUp(); // Don't forget this!

    $this->prepareForTests();
}

private function prepareForTests()
{
    if ($this->withDb) {
        Artisan::call('migrate');

        Artisan::call('db:seed', ['--class' => 'TestingDatabaseSeeder']);
    }

    Mail::pretend(true);
}

}

now I would like to use the in memory sqlite and use the migration for my accetance testing with codeception, any ideas how?

02 Oct
4 years ago

tzookb started a new conversation Laravel Unit Testing Fails On Multipile Methods

this is my simple tests, with nothing on it:

<?php
class BooTest extends TestCase {

    /** @test */
    public function order_exception_was_returend()
    {
    }

    /** @test */
    public function order_exception_changes_order_status_and_gets_ok()
    { 
    }
}

and the testcast is laravel default:

<?php

class TestCase extends Illuminate\Foundation\Testing\TestCase {

/**
 * Creates the application.
 *
 * @return \Symfony\Component\HttpKernel\HttpKernelInterface
 */
public function createApplication()
{
    $unitTesting = true;

    $testEnvironment = 'testing';

    return require __DIR__.'/../../bootstrap/start.php';
}

}

nothing really changed....

now when I run phpunit like this:

phpunit app/initial/Order/tests/BooTest.php

it fails with:

 Invalid argument supplied for foreach()

 /Users/tzookb/Sites/lps.core/vendor/laravel/framework/src/Illuminate/Support/Arr.php:71

and when I run one by one like this:

phpunit --filter order_exception_was_returend app/initial/Order/tests/BooTest.php

phpunit --filter order_exception_changes_order_status_and_gets_ok app/initial/Order/tests/BooTest.php

each one alone succeeds....

25 Sep
4 years ago

tzookb started a new conversation Codeception Acceptance With Sqlite

I followed this cast: https://laracasts.com/lessons/test-databases-in-memory

But it is for unit testing or functional.

I would like to use the idea with acceptance tests . somebody tried it?

15 Sep
4 years ago

tzookb started a new conversation Please Someone With Envoy Experience

How do I install it and use it?!

https://github.com/laravel/envoy

I don't understand where and how to set the paths, I managed installing composer, codeception, and much more

only this envoy installation is not working for me...

somebody have done it successfully?

12 Sep
4 years ago

tzookb left a reply on Access Specific Id Inside Collection

:))

And I read the regular collection api 100 times!!

tzookb started a new conversation Access Specific Id Inside Collection

I want to access a specific object inside a collection I got, for example:

$users = User::whereIn('id', [4,9, ..., 14]);

so as we know it will return a collection with n items of users.

but now I would like to access a specific one with the id 9, I dont really know it is in the second location so I cant do this

$users[1];

or what I would have desire is to simply do this

$users[9];

but the array inside the collection it's keys are 0,1,2,.... no matter the object id's

any idea how to access a specific idea?

11 Sep
4 years ago

tzookb started a new conversation Laravel And Exceptions Handling

I noticed many annoying xxxx

and I dont want it to dirty my errors log, I want to place it in another log that will display that relevant data for pages tried to be accessed.

I did this for now:

App::error(function(Exception $ex, $code)
{
     $reflect = new ReflectionClass($ex);
     if ($reflect->getShortName() === 'NotFoundHttpException') {
         $uri = Request::path();
         Log::error('uri:'.$uri.' msg:'.get_class($ex).'-'.$ex->getMessage().' file: '.$ex->getFile().' line: '.$ex->getLine());
     } else {
        Log::error($ex);
    }

    if ( !Config::get('app.debug') )
         return Response::view('static/error', array(), $code);
 });

I m sure there is a better and smarter way.....