uxweb

Member Since 4 Years Ago

Web Developer at México

Experience Points 78,700
Experience Level 16

1,300 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 706
Lessons
Completed
Best Reply Awards 40
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.

15 Jun
1 year ago

uxweb left a reply on Change Database Name Of Connection On The Fly

@tsipis Sure, i'll be glad to help you!.

02 May
2 years ago

uxweb left a reply on UTF-8 Sqlserver

@miguelcamargo9

Is that query running on a Linux or windows box?

01 May
2 years ago

uxweb left a reply on How To Safely Consume API For Web?

@chuck In my opinion, if you have both on the same app, you are already protected by the web middleware, no need to complicate things.

If an external client needs to consume your API, then you can wrap the API routes with the api middleware.

19 Jan
3 years ago

uxweb left a reply on Problem With Uploading Larger Files

@eriktobben

Hi Eric, are setting the request form like this?

<form method="POST" action="/files" enctype="multipart/form-data" accept-charset="UTF-8">

To upload files the enctype="multipart/form-data" attribute must be set :).

07 Jan
3 years ago

uxweb left a reply on What IDE/Editor Is Everyone Using These Days

I've been using sublime text 3 for the last 5 months, before that I was using PHPStorm. Installing some packages in ST is almost possible to have some features storm have.

I love both!

15 Dec
3 years ago

uxweb left a reply on How To Test Social Login In Laravel?

@toniperic Yes, then mocking Twitter is how it can be done?, i have no experience with mocking, but will read bout it and see if i can make a test :).

Thank you guys!

uxweb left a reply on How To Test Social Login In Laravel?

@bobbybouwmann Thanks man, looks like this is a little complex to test :s.

@toniperic That's where i'm stucked :), When clicking the Twitter link, it will go to /auth/twitter, then it redirects to the provider auth url, then after the user has logged in, the auth provider page redirects to /auth/twitter/callback, in that route i get the user and then is logged in and redirected to '/'.

My question is, how would be possible to interact with the auth provider page to log in and then be redirected :s.

I just ... don't know.

uxweb started a new conversation How To Test Social Login In Laravel?

Hi :)

I was able to build an app that uses Laravel/Socialite to integrate Twitter authentication.

The only thing is that i want to have at least one test for the twitter auth,

Is there a way to build a test for this?

My test looks like this right now:

public function testUserCanRegisterUsingTwitter()
{
    $this->visit('/auth/login')
               ->seePageIs('/auth/login')
               ->click('Twitter')
               ->seePageIs('/');

But it fails with :

A request to [https://api.twitter.com/oauth/authenticate?oauth_token=UTOS_wAAAAAAjMu5AAABUacuqXw] failed. Received status code [404]

If i manually test that in the browser it's ok, no error.

am i missing something?

Thanks for your answers!

uxweb left a reply on Is There Abetter Way For Uploading Large Videos To YouTube With Laravel5?

Thanks for reply @bashy ! :).

I'm little familiar with php-fpm pools, but i know that laravel homestead (which i'm using) comes with a default pool where all apps run under.

I have a question about the subdomain, if i'm using homestead, how can i create a subdomain? and further, when the subdomain is created how is the process to map that subdomain to a php-fpm pool within my application? (if what i'm writing here is wrong, please let me know).

I'm sorry to ask for things i should already know (maybe?), i really appreciate your time, if it's limited, can you point me to some resources to learn about this?

Thank you so much.

uxweb left a reply on Is There Abetter Way For Uploading Large Videos To YouTube With Laravel5?

Here is the code from the method that uploads the video to YouTube:

public function store(Requests\UploadVideoRequest $request, YouTube $youtube)
{
        $video = $youtube->uploadUnlistedVideo(
            $request->file('video')->getPathname(),
            $request->title,
            $request->description,
            explode(',', $request->get('tags')),
            YouTube::VIDEO_CATEGORY_SPORTS
        );

        if (! $video->wasUploaded()) {
            \Flash::error('There was an error uploading your video, please try again later.');

            return back();
        }

        $video = Video::createFromYouTube($video);

        if (auth()->check()) {
            $video->uploadedBy(auth()->user());
        }

        \Flash::success('Your video was uploaded successfully.');

        return redirect()->home();
    }

uxweb started a new conversation Is There Abetter Way For Uploading Large Videos To YouTube With Laravel5?

Hi friends!

I'm working on a simple app that uploads videos to YouTube using the YouTube API.

To be able to do this i'm using Google's PHP Api library.

I have integrated it in my Laravel 5.1 app and i'm able to upload videos to my channel.

But i'm having trouble with large videos (60mb and up), they take longer to upload and the server gives this response:

504 Gateway Time-out

nginx/1.8.0

I'm not storing the video files on the server, it just sends them to YouTube.

Is there a way to queue this process?, is it a good idea to queue it? or is there abetter approach to do this?, maybe changing some PHP's .ini settings?

I would appreciate all the help and advice you can give me :).

Thanks!

19 Nov
3 years ago

uxweb left a reply on [L5.1 And VueJS 1.08] Using VueJS With Laravel For Authentication

@olimorris

Maybe you are getting a redirect response when auth data is wrong, that doesn't mean the error callback of the ajax request is going to be called.

That's why the success callback is executed, redirecting the user to '/'.

I guess you need to override the postLogin method in the AuthController to return a JSON response with the right http status.

13 Nov
3 years ago

uxweb left a reply on How Do I Create Multiple Vue Instances On The Same .js File?

@jillztom

You can check if the element exists before create the vue instance:

if (document.querySelector('#step1')) {
    //  create vue
}

uxweb left a reply on What Is The Meaning Of This?

@ericahernandez573

It is the definition of a foreign key constraint.

I think it has nothing to do with soft deletes.

It states that whenever a row in the parent table is deleted, all rows related to that in this table will be deleted as well.

This keeps referential integrity at the database level ;)

uxweb left a reply on Error Connecting To SQLServer

@Munene

Try by creating a new sql server login :)

10 Nov
3 years ago

uxweb left a reply on Laracasts New Layout Is Awesome.

@JeffreyWay

Here i have an issue in safari, when an archived series is not completed.

http://imgur.com/Xh6ACCh

09 Nov
3 years ago

uxweb left a reply on [L5.1 And Vue.js] Error Handing With Laravel And Vue.js 1.0

@olimorris Yes, it is in here:

http://vuejs.org/guide/components.html#Props

It should work like this for passing the registerForm object as Vue.js 1.0:

<spark-errors v-bind:form="registerForm"></spark-errors>

// or with the shorthand:

<spark-errors :form="registerForm"></spark-errors>

I saw a tweet today from @TaylorOtwell saying that he's updating spark to Vue.js 1.0. :)

uxweb left a reply on [L5.1 And Vue.js] Error Handing With Laravel And Vue.js 1.0

Hi @olimorris Where is the template for the cardForm?

Also, change this markup:

<spark-errors form="@"></spark-errors>

for this:

<spark-errors form="registerForm"></spark-errors>

// here the "form" attribute is a Vue.js prop for parent-child component communication :)

Spark is passing the main register form to a component called spark-errors, this component immediately shows any errors set on the registration form through a prop.

06 Nov
3 years ago

uxweb left a reply on API Authentication: Browser Vs Mobile App

Hi @gn0rt0n

If your API is simple, you can use JWT Authentication (JSON Web Token), this will let your clients access the API using a token. There is this great package for laravel: https://github.com/tymondesigns/jwt-auth.

If your API is non trivial, i suggest take a look to oAuth, also there is a package for Laravel: https://github.com/dingo/api. This is more robust package with lots of options and even if you are not going to use it, i suggest you to read its docs to better understand about this theme.

:)

uxweb left a reply on $dates With Format Ymd Incorrectly Parsed

@sarahkemp

What is the format you are getting with this configuration? :)

uxweb left a reply on Bower, Bootstrap, Less And Elixir

@strategicsdemexico try with:

__dirname + '/vendor/bower_componentsfont-awesome/less'

:)

27 Oct
3 years ago

uxweb left a reply on Relationship Doubt

@gesher

Glad i could help!

uxweb left a reply on Which Frontend Framework For Laravel App

@maxyblack

If still in doubt, check this frontend framework/library comparison made by vue.js author, it is great and gives you enough insight to decide :)

http://vuejs.org/guide/comparison.html

uxweb left a reply on Relationship Doubt

@geshner

Ok, i'm getting it, then what you need is to relate your order_items table with a record in your price_product table.

orders id date ...

order_items id order_id product_id price_id ...

If you want to relate an order item with a price_product, the price_product primary key must be a composed by (product_id and price_id) to uniquely identify a product price.

And for the record, if a price used by many order items is changed over time, this will affect all the order items related to it, so i think that a price field could be created on the order_items table to keep the price history.

Not sure if that's a good database design for what you a re trying to do, but keep telling us more to be able to get to a solution :)

uxweb left a reply on Bloated Model, Where Do I Put This?

@Swaz

You can keep refactoring it and extract that getProducts method to a trait, that way, your controller will be more simple and clear too :)

uxweb left a reply on Metrics Dashboard Using Vue And Laravel?

@handy_man

I have an idea!,

If this data is related to stats, you can make a class called SiteStats that has all the methods needed to provide this metrics.

Then you can have one controller to provide all the metrics you want from the SiteStats class, i think this will simplify the access to this data, the access to the resource urls (/stats/users, /stats/servers, /stats/tickets), i think this will simplify the frontend too is you define some sort of common response from the stats endpoint.

What do you think?

uxweb left a reply on Relationship Doubt

@geshner

Could you provide the table fields?, that will help us to understand more :).

Thanks

uxweb left a reply on Mixing A Model Method With A Scope

@stueynet

I think it can be done by knowing how the hasRole is implemented. Does that hasRole method comes from a trait of some package?.

The isDoctor will work only on any single instance of the model, but to filter within the scope i think you need to access to a "roles" relationship to filter by it.

uxweb left a reply on Bloated Model, Where Do I Put This?

@Swaz I think it could look like this:

public function index(Request $request)
{
    $products = $this->getProducts($request);

    return view('products.index')->withProducts($products);
}

public function getProducts($request)
{
    $query = Product::query();

    if ($request->has('sort')) {
        $sort = explode('-', $request->get('sort'));
        $query->orderBy($sort[0], $sort[1]);
    } else {
        $query->orderBy('created_at', 'desc');
    }

     // Price
     if ($request->has('price')) {
        $range = explode(',', $request->input('price'));

        $min_price = $range[0];
        $max_price = $range[1];

        $query->where('price', '>=', $min_price);
        $query->where('price', '<=', $max_price);
    }

        // Tags
     if ($request->has('tag')) {
         $query->whereIn('tag_id', $request->input('tag'));
     }

     // Type
     if ($request->has('type')) {
         $query->whereIn('type_id', $request->input('type'));
     }

     // Size
     if ($request->has('size')) {
         $query->whereIn('size_id', $request->input('size'));
     }
    
    return $query->get();
}
09 Oct
3 years ago

uxweb left a reply on How To Create This HasManyThrough Relationship?

Thanks @bestmomo it solved my issue :)

uxweb started a new conversation How To Create This HasManyThrough Relationship?

Hi everybody, i'm having trouble with an eloquent relationship i want to do:

Currently, i have these 3 tables:

Locations
id
name

Stocks
id
location_id
product_id
on_hand

Products
id
name

Tried to create a hasManyThrough relationship on Location through Products, to get "the products in stock for a location", but it is not working because the query is taking the primary key of the intermediate model (Stock) to join with the primary key of the related model (Product).

select
    [products].*, 
    [stocks].[location_id]
from
    [products] 
inner join
    [stocks]
on
    [stocks].[id] = [products].[id]  // <---- here is the problem
// it should be [stocks].[product_id] = [products].[id]
where
    [stocks].[location_id] in (26)

Is there a way to achieve this with eloquent?, also, is it possible to add the "on_hand" field from every product stock?

Thanks!

uxweb left a reply on Vuejs - Map Validation Errors From Backend To Single Array

@christiangerdes

Hi, you can by doing it like:

this.errors = _.flatten(_.toArray(errors));

Just pull the underscore library :)

08 Oct
3 years ago

uxweb left a reply on Best Way To Handle Single And Multiple Uploads For A Model

@thomvincent

Thanks for the info!, so, first a brief with the basic information is created? and then redirected to the edit page of that brief where you can add the attachments?

uxweb left a reply on Best Way To Handle Single And Multiple Uploads For A Model

@thomvincent

Hi, im curious about on how did you solved saving the brief data and the bulk of attachments at the same time using dropzone.js.

I am using dropzone but I know that when you drop a file on it will try to upload the file immediately, at that time there is no brief created at the database, so there is no way to relate the attachment with the brief.

Thanks!

07 Oct
3 years ago

uxweb left a reply on Homestead Serve Command Error

@simondavies

What is the use case of doing it like that? is a different homestead version?

Docs says that you just need to add your site to the Homestead.yaml then do a vagrant provision and finally add the name of the site to your hosts file.

uxweb left a reply on Dynamic Routing For Pages Module

@hightechredneckwoman

Currently, i don't know of other way of doing it, i know it can be done by a route parameter or by passing the id by the query string:

locations/123

staff/345

staff/fargo?id=123

location/fargo?id=345

The way of solving it by using the closure is good, but you'll need to manually bind all pages to routes, that will be a pain in the neck if you end up having 100+ pages.

uxweb left a reply on Homestead Serve Command Error

@simondavies

Are you adding the new site inside your Homestead.yam file?

uxweb left a reply on Dynamic Routing For Pages Module

@hightechredneckwoman

Even slugs like:

locations/fargo-1

staff/fargo-2

are SEO friendly, here we are just adding a number to make them different and be able to easily cache them and find them.

If you think that this will give you any performance issues by touching the database to search for it, Laravel has Caching facilities, so don't worry! :).

Of course, when using caching with Laravel, it will need you to provide a "cache key" to identify the cached data, then this is why having non repeating slugs important.

It is as easy as:

public function show($slug)
{
    $minutes = Config::get('cache.pages_caching_minutes');

    $page = Cache::remember($slug, $minutes, function() {
        Page::where('slug', $slug)->firstOrFail();
    });

    return view('pages.show')->withPage($page);
}

This will fetch a page from the db if it does not exists in cache, but if it exists in cache it will fetch it from there.

This is just 1 query to get a page, so i think there is no overhead :).

This is a link to the Cache documentation http://laravel.com/docs/5.1/cache.

Check it out!, it's really easy :).

uxweb left a reply on Anyone Know Of Any Issues With OS X El Capitan GM?

I had an issue with the installed php that comes with OS X, after install El Capitan, it erased my /etc/php.ini file and it deleted my php extensions located at /usr/lib/php/extensions/no-debug-non-zts-20121212.

When i tried to copy the erased extensions again to that directory, it won't let me do that, even using sudo.

This is a new behavior of El Capitan called: System Integrity Protection (rootless) and it is activated by default.

This will prevent you from writing to the /usr (with the exception of /usr/local) /System and /sbin even using sudo command.

If you really need to do something inside these directories, you can disable it:

http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/

I didn't want to disabled it and my solution was to change the php's directory extension to /usr/local/php/ext, that way i can put there extensions not shipped with PHP on OS X

uxweb left a reply on Dynamic Routing For Pages Module

@hightechredneckwoman

Ok, then, does it makes sense to pass the id in the route?, like:

locations/fargo/432

staff/fargo/568

Or maybe you can assign a more specific slug, something like:

locations/fargo-432

staff/fargo-568

uxweb left a reply on Eloquent Relation With Multiple Tables

@blava

I can see your relationships are good.

You don't need to create all relationships over all your models, just create those you're gonna use or those who makes sense to the problem you are solving.

uxweb left a reply on How Authenticate Auth.php Driver (eloquent And Ldap )

@omontes

Are you using a third party package to integrate ldap authentication with laravel?

If you do, then the auth()->attempt() method will work only with ldap.

I'm not sure if laravel can work with both ldap and database drivers at the same time. It gives you one out of the box and you can change the driver.

So, you can use ldap as the default and do manual database check to authenticate a user:

// this will authenticate over ldap
if ($this->auth->attempt($arCredentials)) {
    $clave = $this->auth->user()->getAuthPassword();
    $detalles = $this->auth->user()->getAutDetail();
} else {
    // if ldap auth fails, then try with database
    $user = User::where('username',$request->input('username'))->first();
    $pass = $request->input('password')

     if (Hash::check($pass, $user->password)) {
            Auth::login($user);  // also you can use Auth::loginUsingId($user_id);
        }
}

uxweb left a reply on Dynamic Routing For Pages Module

@hightechredneckwoman

If 2 or more pages share the same slug but they are in a different category, you can do something like:

Route::get('{category}/{slug}', 'PagesController@show');

Then in your PagesController's show method:

public function show($category, $slug)
{
    $page = Page::where('category', $category)->where('slug', $slug);

    return view('pages.show')->withPage($page);
}

Is this what you are trying to achieve?, maybe i get it wrong.

uxweb left a reply on Edit Homestead .bash_profile

@andrew.malinnikov You can share the file's container folder within your Homestead.yaml:

folders: - map: ~/Projects to: /home/vagrant/Code

- map: ~/HomesteadFiles
  to: /home/vagrant

This way you can access .bash_profile from host OS and any change you make to this files will be synced to the guest (homestead).

24 Sep
3 years ago

uxweb left a reply on Any Good Platform For .NET C# Video Tutorials?

@jillztom yes!, check www.learnvisualstudio.net, Bob Tabor is an excellent teacher too!

23 Sep
3 years ago

uxweb left a reply on What Tool That Jeffrey Way Uses In Command Line

@shanely I didn't know about it, but there is a new windows shell that wraps cygwin and it comes with oh-my-zsh as default shell, check it out!:

http://babun.github.io/

22 Sep
3 years ago

uxweb left a reply on What Tool That Jeffrey Way Uses In Command Line

@shanely, yes!, you can install it if you use cygwin https://www.cygwin.com/

uxweb left a reply on What Tool That Jeffrey Way Uses In Command Line

@shanely He uses mostly iTerm with oh-my-zsh shell.