P-Torres

P-Torres

Member Since 2 Years Ago

Experience Points
55,430
Total
Experience

4,570 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
547
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 12
55,430 XP
Sep
16
1 month ago
Activity icon

Replied to Laravel 6 New Error Page. Project-one.local - OK, Localhost:3000 - Not Working

For the ones like me...

webpack.mix.js

mix.browserSync({
    proxy: 'project-one',
    snippetOptions: {
        rule: {
            match: /<\/body>/i,
            fn: function (snippet, match) {
                return snippet + match;
            }
        }
    }
});

This works, make sure you: "yarn run watch" one more time.

Sep
14
1 month ago
Activity icon

Started a new conversation Laravel 6 New Error Page. Project-one.local - OK, Localhost:3000 - Not Working

Having on webpack.mix.js

mix.browserSync({ proxy: 'project-one.local' });

Visiting: project-one.local the error page shows up with no issues.

Visiting: localhost:3000 I get a page showing up...

Line one: \n"},a.fence=function(t,e,n,r,a){var s,c,u,l,f=t[e],p=f.info?o(f.info).trim():"",d="";return p&&(d=p.split(/\s+/g)[0]),0===(s=n.highlight&&n.highlight(f.content,d)||i(f.content)).indexOf(""+s+"\n"):"

Any suggestions?

Using Homestead

Thank you.

Activity icon

Commented on Ignition Is Laravel's Amazing New Error Page

Having on webpack.mix.js

mix.browserSync({ proxy: 'project-one.local' });

Visiting: project-one.local the error page shows up with no issues.

Visiting: localhost:3000 I get a page showing up...

Line one: \n"},a.fence=function(t,e,n,r,a){var s,c,u,l,f=t[e],p=f.info?o(f.info).trim():"",d="";return p&&(d=p.split(/\s+/g)[0]),0===(s=n.highlight&&n.highlight(f.content,d)||i(f.content)).indexOf(""+s+"\n"):"

Any suggestions?

Apr
06
6 months ago
Activity icon

Replied to How Can I Insert In The DB 100 Tickets Numbered From 001 To 100?

@SERGIU17 - I implemented option 2, it works as wanted... Thank you!

Activity icon

Replied to How Can I Insert In The DB 100 Tickets Numbered From 001 To 100?

@SERGIU17 - HI,

Thank you for your time... unfortunately, I get "Invalid argument supplied for foreach()".

My problem is on inserting the "100" records on to the DB.

Thanks...!

Activity icon

Started a new conversation How Can I Insert In The DB 100 Tickets Numbered From 001 To 100?

Hi,

Please, I need some advice. I'm building a raffle site.

I have two tables, "competitions" and "tickets" with a "One To Many" relationship.

The CMS allows the administrator to create the competitions, all good.

The CMS allows the administrator to select a competition and "generate" "x" number of tickets, here my problem.

How can I, eg. insert in the DB 100 tickets numbered from 001 to 100?

Please, any advice, starting point, idea, sample, etc is much appreciated, Thank you!

Currently, my controller looks like:

public function store(Request $request)
{

    //eg. 100 tickets coming from the form input
    $tickets_quantity = $request->input('tickets_quantity');

    //How to get the below automated implementing $tickets_quantity?
    $tickets = [
        ['competition_id'=>1, 'number'=>001, 'price'=>120, 'is_available'=>true, 'created_at'=>NOW(), 'updated_at'=>NOW()],
        ['competition_id'=>1, 'number'=>002, 'price'=>120, 'is_available'=>true, 'created_at'=>NOW(), 'updated_at'=>NOW()],
        //...
    ];

    Ticket::insert($tickets);

    return redirect()->route('tickets.index')->with('status', 'Success');
}
Mar
10
1 year ago
Activity icon

Started a new conversation Disabling Submit Buttons. What Shall I Return?

I get "Missing return statement" (PHPStorm).

I have a form with two submit buttons "Update & Reload" and "Update"

The following works (in edit form):

<div class="btn-group" role="group" aria-label="">
    <button type="submit" class="btn btn-info" name="update-and-reload" value ="update-and-reload">
        Update & Reload
    </button>
    <button type="submit" class="btn btn-primary" name="update" value="update">
        Update
    </button>
</div>
    

My Controller

public function update(ArticleRequest $request, $id)
    {
        ... some code...


        if (Input::get('update-and-reload')) {

            $article->update($request->all());

            return back();

        } else if (Input::get('update')) {

            $article->update($request->all());

            return redirect()->route('articles.index');

        }

    }

But, when implementing the following to disable the buttons once clicked, it fails...

After submitting I get a blank page!

<script>
        $('form').submit(function (event) {
            $(this).find(':submit').attr("disabled", true));
        });
</script>

Any suggestions are appreciated. Thank you.

Aug
01
2 years ago
Activity icon

Replied to Is It Possible To Run Blade Directives Which Are Stored In The Content From Database?

Hi,

This is not working... any advice?

//AppServiceProvider.php

    public function boot()
    {
        Blade::directive('openContainer', function () {
            return '<div class="container">';
        });

        Blade::directive('closeContainer', function () {
            return '</div>';
        });
    }



//Controller

    public function home()
    {
        $title_menu = 'Home';

        $page = Page::all()->where('title_menu', '=', $title_menu)->first();

        return view('frontend.pages.home', compact('page'))->render();
    }



//Form to submit the content

<div class="form-group">
    <label for="content">Content:</label>
    <textarea name="content" cols="50" rows="20" class="form-control">{!! old('content', $page->content) !!}</textarea>
    <p class="help-block">The content of the page. Implements Bootstrap.</p>
</div>



//HTML Content

@openContainer

<h1>Test</h1>

@closeContainer



//View

{!! $page->content !!}



//On the browser I get
@openContainer
Hello Planet 2
@closeContainer

Jul
28
2 years ago
Activity icon

Started a new conversation Bootstrap Or Bulma Grid System WordPress Style Shortcodes.

Hi,

I'm looking for some advice.

I'm preparing a new project that will involve a CMS that will allow users to manipulate the content.

I need to allow users to submit WordPress style shortcodes that will be translated to bootstrap or Bulma grid system.

For example:

A form with a text input where users will do something like this:

[container]
  [row]
    [col-md-6]
      <h3>Title</h3>
      <p>Text</p>
    [/col-md-6]
    [col-md-6]
      <h4>Title</h4>
      <p>Text</p>
    [/col-md-6]
  [/row]
[/container]

How can I achieve this?

Can anyone help me to find information on how to translate:

[container]
[/container]

To normal HTML:

<div class="container">
</div>

Thanks!

Jun
14
2 years ago
Activity icon

Started a new conversation Mailgun, How To Implement Mailgun Response - Pagination On A Blade View?

Hi,

I'm working with Mailgun's API, I'm trying to implement pagination when displaying the received data.

I have the following response from Mailgun.

{#383 ▼
  +"http_response_body": {#381 ▼
    +"items": array:10 [▶]
    +"paging": {#382 ▼
      +"first": "https://api.mailgun.net/v2/lists/[email protected]/members/pages?page=first&limit=10"
      +"last": "https://api.mailgun.net/v2/lists/[email protected]/members/pages?page=last&limit=10"
      +"next": "https://api.mailgun.net/v2/lists/[email protected]/members/pages?page=next&address=email-address-a%40domain.com&limit=10"
      +"previous": "https://api.mailgun.net/v2/lists/[email protected]/members/pages?page=prev&address=email-adress-b%40domain.com&limit=10"
    }
  }
  +"http_response_code": 200
}

On my controller I have the following:

public function members($address)
    {
        # Instantiate the client.
        $mgClient = new Mailgun(env('MAILGUN_SECRET'));

        # Issue the call to the client.
        $result = $mgClient->get("lists/$address/members/pages", array(
            'limit'      =>  10
        ));

        return view('dash.members.show', compact('result'));
    }

My view looks like this:

<div class="table-responsive">
    <table class="table table-striped table-hover dev-table-row-vertical-middle">
        <thead>
        <tr>
            <th>Name</th>
            <th>E-mail Address</th>
            <th>Subscribed</th>
        </tr>
        </thead>
        <tbody>
            @foreach($result->http_response_body->items as $obj)
                <tr>
                    <td>{{ $obj->name }}</td>
                    <td>{{ $obj->address }}</td>
                    <td>
                        @if($obj->subscribed==true)
                            Yes
                        @else
                            No
                        @endif
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
</div>

<ul class="pagination">
    <li><a href="{{ $result->http_response_body->paging->first }}">First</a></li>
    <li><a href="{{ $result->http_response_body->paging->previous }}">Previous</a></li>
    <li><a href="{{ $result->http_response_body->paging->next }}">Next</a></li>
    <li><a href="{{ $result->http_response_body->paging->last }}">Last</a></li>
</ul>
    

Can anyone guide me on how the code needs to be in order for the pagination to work?

I have tried many different approaches, I feel first I need to understand what needs to happen, anyone?

Thank you.

Jun
02
2 years ago
Activity icon

Replied to Mailgun, How To Echo Mailgun Response On A Blade View. Nested Array

Just in case someone is interested... Thanks @cmgmyr

<h3>Domain Verification & DNS</h3>
<dl class="dl-horizontal">
    <dt>MX Records</dt>
    <dd>
        <div class="table-responsive">
            <table class="table table-striped table-hover dev-table-row-vertical-middle">
                <thead>
                    <tr>
                        <th>Valid</th>
                        <th>Type</th>
                        <th>Priority</th>
                        <th>Value</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($result->http_response_body->receiving_dns_records as $obj)
                        <tr>
                            <td>
                                @if($obj->valid=='valid')
                                    <span class="label label-success">
                                        <i class="fa fa-check" aria-hidden="true"></i>
                                    </span>
                                @else
                                    <span class="label label-danger">
                                        <i class="fa fa-times" aria-hidden="true"></i>
                                    </span>
                                @endif
                            </td>
                            <td>{{ $obj->record_type }}</td>
                            <td>{{ $obj->priority }}</td>
                            <td>{{ $obj->value }}</td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </dd>
</dl>
Activity icon

Started a new conversation Mailgun, How To Echo Mailgun Response On A Blade View. Nested Array

Hi, I've got the following response from Mailgun.

{#345 ▼
  +"http_response_body": {#339 ▼
    +"domain": {#334 ▶}
    +"receiving_dns_records": array:2 [▼
      0 => {#340 ▼
        +"cached": array:2 [▼
          0 => "10 mxb.mailgun.org"
          1 => "10 mxa.mailgun.org"
        ]
        +"priority": "10"
        +"record_type": "MX"
        +"valid": "valid"
        +"value": "mxa.mailgun.org"
      }
      1 => {#341 ▶}
    ]
    +"sending_dns_records": array:3 [▶]
  }
  +"http_response_code": 200
}

I want to be able to echo in a view something like:

Type: TXT

Priority: 10

Value: mxa.mailgun.org

Type: TXT

Priority: 10

Value: mxb.mailgun.org

The following code prints "10 10". Anyone any advice... much appreciated, thank you.

@foreach($result->http_response_body->receiving_dns_records as $obj)
    {{ $obj->priority }}
@endforeach
May
10
2 years ago
Activity icon

Replied to Bootstrap.js Loads Latest JQuery, How To Downgrade To V2.2.4

The jQuery version is working fine...

My webpack.mix.js looks like below, I'm having app.js BEFORE app.min.js

I have checked the all.js file that Laravel Mixer generates. I found that jQuery is AFTER my admin-lte .js file.

mix.js([
    'resources/assets/js/app.js',
    'node_modules/admin-lte/dist/js/app.min.js'
], 'public/js/all.js');

As all we know app.js on line 8 require('./bootstrap'); and bootstrap.js loads the jQuery. So, it should appear first on my all.js

Anyone any suggestions?

Activity icon

Replied to Bootstrap.js Loads Latest JQuery, How To Downgrade To V2.2.4

Hi @al0mie,

I did change the jQuey form "jquery": "^3.1.1", to "jquery": "2.2.4",

Then I did: yarn upgrade, it did not work, is this the correct line I need to run?

Activity icon

Replied to Bootstrap.js Loads Latest JQuery, How To Downgrade To V2.2.4

On my package.json I have:

"devDependencies": {
    "admin-lte": "^2.3.11",
    "animate.css": "^3.5.2",
    "axios": "^0.15.3",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^3.2.3",
    "fastclick": "^1.0.6",
    "font-awesome": "^4.7.0",
    "html5shiv": "^3.7.3",
    "jquery": "^2.0.0",
    "jquery-slimscroll": "^1.3.8",
    "laravel-mix": "0.*",
    "lodash": "^4.17.4",
    "respond.js": "^1.4.2",
    "vue": "^2.1.10"
  }
Activity icon

Started a new conversation Bootstrap.js Loads Latest JQuery, How To Downgrade To V2.2.4

Hi,

Laravel 5.4 resources/assets/js/bootstrap.js loads the latest version of jQuery, how can I get jQuery v2.2.4 instead?

Thank you.

/**
 * We'll load jQuery and the Bootstrap jQuery plugin which provides support
 * for JavaScript based Bootstrap features such as modals and tabs. This
 * code may be modified to fit the specific needs of your application.
 */

try {
    window.$ = window.jQuery = require('jquery');

    require('bootstrap-sass');
} catch (e) {}
Apr
18
2 years ago
Activity icon

Started a new conversation Laravel Forge - Unable To Login (18 April 2017)

Hi,

When trying to login Forge it asks for the login credentials, then Two Factor Authentication. All it does is redirect to the home page.

Does anyone else have the same issue?

Any advice?

Mar
22
2 years ago
Activity icon

Replied to Laravel Forge Is Down. 22 March 2017

Shall we update our Ubuntu servers?

sudo apt-get dist-upgrade

sudo reboot

Activity icon

Replied to Laravel Forge Is Down. 22 March 2017

Fixed... (London) GMT 14:15.

Activity icon

Replied to Laravel Forge Is Down. 22 March 2017

Same problem, if log out Forge you are not able to sign in back!

Is there any official place to find out what is happening?

Activity icon

Started a new conversation Laravel Forge Is Down. 22 March 2017

Please post here if you have any information.