bar2

bar2

Member Since 3 Years Ago

Experience Points
22,670
Total
Experience

2,330 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
219
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.

Level 5
22,670 XP
Dec
16
2 years ago
Activity icon

Replied to NGINX Setup For Multiple Projects

@hkadgar @bashy 's solution worked out well for me. Try the accepted answer as your boilerplate?

Jun
27
3 years ago
Activity icon

Started a new conversation Best And Most Reusable Approach To Filtering On Controllers And Views

Hi guys,

I am implementing a CRUD (admin) interface for my web app and right now i need to be able to filter and order my data, eg. filter results by category. What would be the best way to tackle filtering on both controller side and view ( passing filter input and syntaxing) side . Could you point me to some articles or tutorials?

Jun
15
3 years ago
Activity icon

Started a new conversation Smartest Way To Re-use JSON API Within Blade

Hi people,

I have prepared an API for mobile ends of my application that returns JSON-formatted data. Is there an easy way to re-use the API within the blade templating for the website?

Mar
27
3 years ago
Activity icon

Started a new conversation Displaying Pretty Names For :attributes On Validator

Hey all,

I have an easy question where I cannot find an answer so far. I am using the default Validator and localized my language files. Everything is fine except I stick to english within my app scope, which also means my attribute names are english as well. Is there an option in Validator to pass in attribute substitutes to be seen on errors?

I want to be able to keep the default Validator messages, I just want to be able to alter the attribute names.

Mar
18
3 years ago
Activity icon

Replied to NGINX Setup For Multiple Projects

@bashy thanks a lot for your help. After fixing the fastcgi_pass to correct php7.0-fpm.sock path on your suggestion, it all started to work :)

Mar
17
3 years ago
Activity icon

Replied to NGINX Setup For Multiple Projects

@bashy do you have a suggestion for a working subdirectory nginx setup? I have tried most of the things you posted.

Activity icon

Replied to NGINX Setup For Multiple Projects

@byjml since I am setting it up as the root directory for the project (/var/www/domain.net/laravel-api/public in this case) shouldn't it be OK with it?

Activity icon

Started a new conversation NGINX Setup For Multiple Projects

server 
{
    listen   443 ssl;

    root /var/www/domain.net/laravel-api/public;
    index index.php index.html index.htm;

    client_max_body_size 80m;

    ssl_certificate /root/apis.domain.net.crt;
    ssl_certificate_key /root/apis.domain.net.key;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    server_name apis.domain.net;
}

Above server configuration is working fine as it is. But I want to map more than 1 project to apis.domain.net such as

apis.domain.net/laravel-api-1
apis.domain.net/laravel-api-2

When I try to change the server_name to apis.domain.net/laravel-api-1 for this given project (/var/www/domain.net/laravel-api/public) laravel starts to return 404 for every page. How can I achieve this?

Feb
19
3 years ago
Activity icon

Replied to Integers Are Casted As Strings After Server Deployment

@jlrdw its said that its caused by PDO but there is no solution for it. And since its not only effecting outputs and messes up relationships too, casting, as suggested for solving this, is not an option here.

I'm stuck and I cannot find a proper solution to this...

Activity icon

Replied to Integers Are Casted As Strings After Server Deployment

i really need some help cause relationships are not working with corrupted cast...

Activity icon

Replied to Integers Are Casted As Strings After Server Deployment

@premsaurav I did check the post. There is no suggestions or sort of a check list. I just installed everything from scratch and its still the same.

I'm using default mysql drivers and settings on laravel.

mysql: 5.5.47-0ubuntu0.14.04.1 (Ubuntu) php5-fpm: PHP 5.6.18-1+deb.sury.org~trusty+1 (cli)

do you have a suggestion I can try?

Activity icon

Started a new conversation Integers Are Casted As Strings After Server Deployment

Hi,

So far I was working on my project within homestead. I just uploaded my project onto my server and now all integers for whole classes are seen as string within json responses.

response: [
{
id: "5312",
town_id: "6001",
neighborhood: "NY",
district: "Times ",
postcode: "6750",
city_id: "6"
},
...

as seen all integers are casted as strings. Yes I can cast them back to integer

protected $casts = ["id" => 'integer'];
...

but I'd rather not to it on each class. Do you guys have an idea what could've caused it, maybe pdo version of server or something like this?

Jan
21
3 years ago
Activity icon

Replied to Json Post Request To Laravel Issue

@premsaurav exactly :) and i'll just post my findings here for further reference :)

Activity icon

Replied to Json Post Request To Laravel Issue

@premsaurav now I tried posting this JSON with postman and it works as expected... confirmed its a client side issue...

Activity icon

Replied to Json Post Request To Laravel Issue

@premsaurav im using AFNetworking, so I doubt its the issue... but I guess I should be checking it out after all...

Activity icon

Replied to Json Post Request To Laravel Issue

@bobbybouwmann is there a proper way to post JSON to laravel using a POST request?

Activity icon

Replied to Json Post Request To Laravel Issue

@premsaurav its ok. Do you have any idea why this is happening?

Activity icon

Replied to Json Post Request To Laravel Issue

@bobbybouwmann yeah, thats what makes me confused. Im sending the first json to this function and getting the second one, which is not same with first one...

could it be converting the options objects into a regular array by itself?

Activity icon

Replied to Json Post Request To Laravel Issue

this is the laravel end

public function postCartWithOptions(Request $request)
{
    return $request->all();
}
Activity icon

Replied to Json Post Request To Laravel Issue

@premsaurav this is being sent over ios, so its actually an NSDictionary representation of JSON, thats why I told don't mind the snytax.

@bobbybouwmann im calling a POST method with cart and options parameters.

Activity icon

Started a new conversation Json Post Request To Laravel Issue

I am making this post request to laravel (don't mind the syntax)

{
    cart =     {
        "company_id" = 1;
        quantity = 3;
        "service_product_id" = 1;
    };
    options =     (
                {
            "company_id" = 1;
            "service_product_option_id" = 1;
            "service_product_option_value_id" = 2;
        },
                {
            "company_id" = 1;
            "service_product_option_id" = 2;
            "service_product_option_value_id" = 3;
        }
    );
}

when I return the request, this is the result; ( return $request->all() )

{
    cart =     {
        "company_id" = 1;
        quantity = 3;
        "service_product_id" = 1;
    };
    options =     (
                {
            "company_id" = 1;
        },
                {
            "service_product_option_id" = 1;
        },
                {
            "service_product_option_value_id" = 2;
        },
                {
            "company_id" = 1;
        },
                {
            "service_product_option_id" = 2;
        },
                {
            "service_product_option_value_id" = 3;
        }
    );
}

even though the option array being passed to consist two inner objects, it is being processed as 6 different object on laravel end. How can I fix this?

Jan
15
3 years ago
Activity icon

Replied to JWT Authorization Header In Web

Hi @dixitchopra,

Currently I am facing the exact same issue you tackled upon. I integrated JWTAuth for the mobile application and now I am trying to build an admin panel with html and blade, just like you tried and asking the exact questions you asked.

Can you tell me how you resolved this issue? How did you passed around the acquired token on headers?

Many thanks.

Jan
10
3 years ago
Activity icon

Replied to Eager Loading Query Building

I was able to solve it by this code, but im pretty sure there is much more elegant ways of doing this.

foreach ($companies as $company)
    $company->serving = $company->servingAt[0];
Activity icon

Replied to Schedule Timezone Behaviour

@Swaz I don't know which one it is, laravel's own timezone makes more sense, but I guess you can find it out by changing the laravel timezone by config and running a command to see which one it uses.

Activity icon

Started a new conversation Eager Loading Query Building

Hi guys,

What I am trying to achieve below is get a single Territory model with eager loading but since Company and Territory has a many to many relationship, serving_at property returns as an array (collection). But in this case i'm looking for a single territory-company relationship, thus not an array but an object in my json.

$companies = Company::find($targetCompanies);
    $companies->load(['servingAt' => function($query) use ($territory_id)
    {
        $query->where('territory_id', '=', $territory_id);
    }]);

I tried

$query->where('territory_id', '=', $territory_id)->first();

but I was still getting an array in my response. How do I achieve this?

Dec
30
3 years ago
Activity icon

Replied to JWTAuth - Changing Route Middleware's Error And Exception Handling

@tymondesigns oh, hi! Great job by the way. But what happens in case we update the library? wouldn't BaseMiddleware be overwritten?

Dec
29
3 years ago
Activity icon

Started a new conversation JWTAuth - Changing Route Middleware's Error And Exception Handling

Hi guys,

I integrated tymon/jwt-auth into my app. After setting the route middleware, everything was fine except jwt-auth has its own error handling implementation in their BaseMiddleware.

I have implemented a trait to handle exceptions/errors properly within app, and currently I am using it in 2 spots. First of them is in my ApiController, which is the base class for all my controllers. And the second one is my ExceptionHandler, where I can override my syntax for caught exceptions. My question is how can I define what happens when a middleware throws an exception.

Note: I just changed JWTAuth’s BaseMiddleware to fit my needs, and return the an error with my syntax. But I want to know if there is a way of doing it without changing external source-code.

Dec
27
3 years ago
Activity icon

Replied to Logout Won't Work, Laravel 5.2

since you are trying to work your way through Laravel, I think you can use the designated version of laravel within your scope of tutorials, right?

Here is how;

composer create-project laravel/laravel=5.1.* your-project-name --prefer-dist

or even better for your current situtation

composer create-project laravel/laravel=5.0.* learning-laravel-5 --prefer-dist

Activity icon

Replied to 4-way Pivot Table

@premsaurav For a debug seeding with a single company, single service group, 7 day of week, 15 territories being served, and for each (12) of service periods, the lookup table grows into ~1.3k.

With real data, it can grow up to millions of rows. Quick Math: 500 company x 2 service group x 7 day x 20 territory x 12 service period = ~ 1.6M

should I be worried regarding my solution?

Activity icon

Replied to 4-way Pivot Table

@premsaurav awesome solution! Will try it right away. And for the sake of completeness, if I were to lookup a quota value within the company model, how would I achieve it? (of course given other 3 parameters, or maybe a collection with 2)

Activity icon

Replied to Hey Guys, Newbie Here! Quick Question For Ya

I am not a server-side expert, but from what I understand, you are trying to load the projectonedatabase database onto your server, is it right?

Activity icon

Replied to 4-way Pivot Table

Companies are require to define a quota for their services, with these parameters;

company_id, id of their company

service_period_id, predefined value of a period of serving time,

territory_id, the territory that the company will serve,

service_group_id, group of the specified service.

Given these 4 parameters, which are all many-to-many, a company can enter a quota for limiting their service traffic. I don't believe polymorphic relations suit this need.

Activity icon

Started a new conversation 4-way Pivot Table

Hey guys,

My first post on the forum (and my first laravel experience), and since its partially/mostly Laravel related, I wanted to get some help from fellow developers here, so bear with me.

Models and relations are like this;

Company, a basic company model, ServicePeriod, time periods such as 14PM - 16PM that company serves in between, Territory, territory that company serves in, ServiceGroup, a group of services that the company provides.

Now I need to define a 4-way pivot table for these 4 models, and provide a quota for the given company, on a specific service period, for the territory, regarding the service group.

If I were to create a 4-way pivot table for these 4 tables/models, would I be able to set or get the values for the quota?

If so, how would my models would be attached to each other in terms of relations?

Activity icon

Replied to Hey Guys, Newbie Here! Quick Question For Ya

You need to provide username/password combination for a mysql command. If you are using homestead setup, by default, your mysql username will be "homestead" and "password" will be secret.

In which case you would try

mysql storage/projectonedatabase.mysql -u homestead -p

and after you are prompted for the password, enter secret.