llioor

llioor

Member Since 3 Years Ago

Experience Points 2,785
Experience
Level
Lessons Completed 22
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

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

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

24 Dec
1 year ago

llioor left a reply on Model::whereColumn($value) Is Possible?

Where I can find it in Docs?

10 Oct
1 year ago

llioor left a reply on Using Socialite/social Login With Laravel Passport

@ctf0 perfect solution for JWT. The most easiest way!

19 Dec
2 years ago

llioor left a reply on 5.1 Queue:worker MySQL Lock Timeout Issues

Having the same issue with 3 workers on my API server. The DB is RDS (aws) MySQL and it is a small DB resource.

23 Jun
2 years ago

llioor left a reply on Fillable, Hidden And Guarded

@Snapey The thing is that we did not ask if "a value that is not fillable can still be set directly"... I asked about that even in registration we can add specific action for changing password so why not to add passwords to "guarded" attribute..

llioor started a new conversation Fillable, Hidden And Guarded

Hello everybody, I'd like to know if someone can help me with a question.

We can find here explanation on mass assignment. The example is about guarding the "is_admin" property against user hacking and changing it to "1" from "0" without the permission for it. https://laravel.com/docs/5.1/eloquent#mass-assignment

So why here: https://github.com/laravel/laravel/blob/master/app/User.php "password" is under "fillable & hidden" attributes and not under "guarded" attribute if we wont to avoid from the user to change the password manually?

Thanks, Leo.

29 May
2 years ago

llioor started a new conversation Frontend, Backend, API On Different Servers

Hi everyone, I want to build a system with these projects: api.example.com admin.example.com payments.example.com example.com

I'm using AWS as my hosting. Each project needs to be hosted in a different server because I want to use "aws load balancer" for each project. The API will be called from an HAProxy server - http://www.haproxy.org because I'm using multiple domains with SSL but it is not supposed to make any problem.

What is the best why to handle it?

  1. Do I need to make one project and split the routes.php file to routes-admin.php, routes-api.php, routes-payments.php in order to avoid duplication of modeling?
  2. Do I need to split the projects, install laravel in any server and to duplicate models if needed?
  3. Do I need to keep all models in the API project and all the rest project will "call" the api in order to get/edit/delete? of course I will need to use authentication before the "edit/delete" calls...

What is recommended? Thank you very much in advanced!

14 Feb
2 years ago
08 Feb
2 years ago

llioor started a new conversation Export Lang Files To Excel/csv

Hi, I tried to work with https://github.com/ufirstgroup/laravel-lang-import-export but I receive an error message on artisan command: "[InvalidArgumentException] There are no commands defined in the "lang-export" namespace." I even open an issue on it: https://github.com/ufirstgroup/laravel-lang-import-export/issues/1

I tried https://github.com/tedslittlerobot/laravel-lang-tools and same here... I have an error. https://github.com/tedslittlerobot/laravel-lang-tools

Is there any other working package to export excel/csv of all langs under resources>lang>en

Thanks in advanced! Lio.

22 Nov
3 years ago

llioor left a reply on With() And Select() Not Working Together

Hi @kingpabel, thanks for your answer. You are right when we are talking about hasOne relation, you need to select the FK column. The things is that I don't have FK on the table because I have other table for many to many relation.

21 Nov
3 years ago

llioor started a new conversation With() And Select() Not Working Together

I have many to many relation like this:

On Campaign model:

public function categories() {
    return $this->belongsToMany('App\Categories_reseller', 'campaigns_categories', 'campaign_id', 'category_id')->withTimestamps();
    }

On Categories_reseller model:

 public function campaigns() {
    return $this->belongsToMany('App\Campaigns', 'campaigns_categories', 'category_id', 'campaign_id')->withTimestamps();
    }

When I do this I receive categories collection:

$campaign = \App\Campaign::getByToken($token)
            ->with('categories')
            ->firstOrFail();

When I do this, I receive empty collection in categories items relation:

$campaign = \App\Campaign::getByToken($token)
            ->select('id') // campaign ID
            ->with('categories')
            ->firstOrFail();

The getByToken function is a scope one:

 public function scopeGetByToken($query, $token) {
    return $query->where('token', $token)->where('status', 1);
    }

Any Idea what I'm doing wrong? Is it not possible to select specific values from campaigns table when using "with()"?

Thanks

03 Nov
3 years ago

llioor left a reply on Cannot Override Model::create Function

Thank you @thomaskim for your answer! The event listener is a nice way to handle it! thanks!

Any opinion on my factory DP?

02 Nov
3 years ago

llioor started a new conversation Cannot Override Model::create Function

I want to override the Model "create" function,

In my newModel extends Model I wrote:

public static function create($request) {
    // do something here
    return parent::create($request->all());
}

I received this error:

Declaration of App\Campaign::create() should be compatible with Illuminate\Database\Eloquent\Model::create(array $attributes = Array)

Why from the controller I can do:

$_campaign::create($request->all());

But from the override function not? Any why to override it?

Thanks!

llioor left a reply on How Do I Add Sentinel Providers To My Laravel 5.1 Installation?

On your composer: "cartalyst/sentinel": "2.0.*",

On your Config/app.php:

providers: Cartalyst\Sentinel\Laravel\SentinelServiceProvider::class,

aliases: 'Activation' => Cartalyst\Sentinel\Laravel\Facades\Activation::class, 'Reminder' => Cartalyst\Sentinel\Laravel\Facades\Reminder::class, 'Sentinel' => Cartalyst\Sentinel\Laravel\Facades\Sentinel::class,

On you controller do like this: use Sentinel;

llioor started a new conversation Factory Model Return An Instance Of Other Model

Hi everybody,

I have class CampaignsController extends Controller. I have class Campaign extends Model.

In "CampaignsController" I create new Campaign like this: public function store(Request $request) { $campaign = Campaign::create($request->all()); ... }

Now I have 2 types of Campaigns, let's say a digital and a physical. I want to create a model by the type (digital or physical) and to override the "create" function for each campaign type but still to use the parent "create" function.

I want to do it in a Factory design pattern. Something like this:

First to create the tow classes and to extend the Campaign class.

Digital: namespace App\Http\Campaigns;

class Digital extends \App\Campaign {

public function __construct(array $attributes = array()) {
parent::__construct($attributes);

$this->type = \App\Campaign_Factory::DIGITAL;
}

}

Physical: namespace App\Http\Campaigns;

class Physical extends \App\Campaign {

public function __construct(array $attributes = array()) {
parent::__construct($attributes);

$this->type = \App\Campaign_Factory::PHYSICAL;
}

}

I created a "Campaign_Factory" class in order to initialize the classes like this:

public static function init($type) {

switch ($type) {
    case static::DIGITAL:
    return new Http\Campaigns\Retail;
    break;
    
    case static::PHYSICAL:
    return new Http\Campaigns\Remote;
    break;

    default:
    abort('401', 'Not a valid type');
    break;
}

}

MY questions are:

  1. Is it going to work? public function store(Request $request) { $type = $request->input('type'); $_campaign = Campaign_Factory::init($type); // this will return a $campaign = $_campaign::create($request->all()); ... }

  2. Is it the right way to do it? Basically I will override more functions so it classic to make 2 classes and and to extend from one base model the problem is that I'm pretty new to laravel and I want to know if this is the right way.

Thanks in advance!

Thanks.

25 Jul
3 years ago

llioor left a reply on Using Homestead\Vagrant With Symbolic Links

If you want to create a symbolic link for the public folder in order to avoid duplication between the public folder on Laravel project and the public folder on you "www" or public_html folder you need to do this: Out project name is : test1-core

So if you went throw this guide: https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e you need to have 1 laravel project folder under (1 level up) your "www"/public_html folder. Let's say the name of our laravel project is test1-core. Now By the guide you need to copy the public foler from test1-core to the www folder.

What we need to do is to create a symbolic link with linux to avoid the duplication. Next time you are doing git pull you will not need to copy the public folder to your www folder. First "cd" to your www fodler: cd ~ cd www

Second make the link: ln -s ../test1-core/public

If you are on shared hosting and you have multiple folders on your www folder I recommend to named the link: ln -s ../test1-core/public test1

Link this you will have test1 "linked folder" and you can redirect a domain to it.

Godd luck.