tubbrez

tubbrez

Member Since 2 Years Ago

Web Developer at Global Edge Software Ltd

Experience Points 500
Experience Level 1

4,500 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 0
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.

26 Apr
1 year ago

tubbrez left a reply on New Changes Not Being Detected

Yes, they are! And the funny thing is that even if i delete the file from the server, somehow it is till being executed as if it is still there.. so weird

tubbrez started a new conversation New Changes Not Being Detected

Hi Guys!

I got a very weird bug. I made a small change in my laravel model file and uploaded it on the server but it is not being executed. it's like it is still executing the file but without my changes. Earlier everything was fine but now suddenly its only that one specific model that is giving me this bug. Even if i delete the file from server, it is still being executed. If i change its class name, it starts working again but, i am not allowed to change its name, so if any of you guys have any idea of what may be causing this, please let me know how this can be fixed. Thanks!

11 Oct
1 year ago

tubbrez left a reply on Where Are You All From?

Mauritius

28 Jun
2 years ago

tubbrez left a reply on Braintree - Configuring Third Party Credentials In Laravell

you need to add this line in your code:

`` use Braintree\ClientToken;

and then change this line: $clientToken = Braintree_ClientToken::generate(array('customerId' => ""));

into this: $clientToken = ClientToken::generate(array('customerId' => ""));

24 May
2 years ago

tubbrez left a reply on Ajax + Laravel 5.2 + Add An Attribute To Each Of The Buttons, Buttons Are Generated By @foreach Loops

No worries, i found the solution. It is as follows:

My view:

@foreach ($social_networks as $social_network)

    <button type="button" class="btn btn-primary btn-rounded provider-btn" data-network="{{ $social_network->name}}">

        <img src="/images/social-logos/{{ $social_network->iconUrl}}" class="fa resize-social-logo"> {{ $social_network->displayName}} 

</button>

@endforeach 

    [..........]

<script src="{{ URL::asset('js/connection.js') }}"></script>


My js:

$(document).ready(function() {
  $('.social-network').on('click', '.provider-btn', function( e ) {
    $.ajax({
      // The URL for the request
      'url': '/addconnection?name='+$(this).data('network'),
      // The type of data we expect back
      'dataType': 'json'
    })
     // Code to run if the request succeeds (is done);
     // The response is passed to the function
     .done(function(json) {
         if (json.status == 'ok') {
             window.location=json.url;
        }
    });
  });
});


My Model:

    public static function getSocialNetworkByName($name) 
    {
        $socialNetwork = parent::all();
        var_dump($socialNetwork);
        exit;
        return $socialNetwork->items[0]->attributes['provider_link'];
    }

My Route:

    Route::get('/addconnection', '[email protected]');
    Route::post('/addconnection', '[email protected]');

My Controller:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\Response;

class AddConnectionController extends Controller
{
    public function getSocialLink(Request $request)
    {
        $params = $request->all();
        $name = $params['name'];
        
        $socialData = DB::table('social_networks')->where('name', '=', $name)->get();
        return Response::json(array('status'=>'ok', 'url'=>$socialData[0]->provider_link));
        
    }
}




23 May
2 years ago
22 May
2 years ago

tubbrez left a reply on Ajax + Laravel 5.2 + Add An Attribute To Each Of The Buttons, Buttons Are Generated By @foreach Loops

I have 2 questions regarding your last answer:

1st: Could you give me an example of what would the route be?

2nd: Could you explain how will i add an attribute to each of the buttons. I need to attach the URL in a data element and use a JS handler function to load this URL. Here we have to note that each buttons should have a different url (data)

tubbrez left a reply on Ajax + Laravel 5.2 + Add An Attribute To Each Of The Buttons, Buttons Are Generated By @foreach Loops

I totally get your point but i have been ordered not to do it the old way and that i should try to do it using ajax. Do you know how this can be achieved by using Ajax?

tubbrez left a reply on Ajax + Laravel 5.2 + Add An Attribute To Each Of The Buttons, Buttons Are Generated By @foreach Loops

Yes, i did that, and it worked too. But now i've been asked not to do it this way and to do this another way using ajax. More precisely like my previous reply

tubbrez left a reply on Ajax + Laravel 5.2 + Add An Attribute To Each Of The Buttons, Buttons Are Generated By @foreach Loops

i want to write some javascript that attaches to the social buttons. Something like this:

    $('.social-network').on('click', '.provider-btn', function( e ) {
        $.ajax({ 
            'url': 'addconnection', 
            'data': {network: this.data('network')}, 
            'dataType': 'json' 
        }).done(function(json) { 
            if (json.status='ok') { 
                window.location=json.url; 
            } 
         }); 
    }); 
});```

And then on the server side, i need a piece of code that will execute and make sure that the response does something like this:

```function handleAddConnection($network) 
{ 
    $social_network = DB::table('social_networks')->where('name', $network)->first(); 
    $url = $social_network->apiUrl; 
    $response = array('status' => 'ok', 'url' => $url); 
}```

tubbrez left a reply on Ajax + Laravel 5.2 + Add An Attribute To Each Of The Buttons, Buttons Are Generated By @foreach Loops

i want to write some javascript that attaches to the social buttons. Something like this: ''' $(document).ready(function() { $('.social-network').on('click', '.provider-btn', function( e ) { $.ajax({ 'url': 'addconnection', 'data': {network: this.data('network')}, 'dataType': 'json' }).done(function(json) { if (json.status='ok') { window.location=json.url; } }); }); }); '''

And then on the server side, i need a piece of code that will execute and make sure that the response does something like this:

''' function handleAddConnection($network) { $social_network = DB::table('social_networks')->where('name', $network)->first(); $url = $social_network->apiUrl; $response = array('status' => 'ok', 'url' => $url); } '''

tubbrez left a reply on Ajax + Laravel 5.2 + Add An Attribute To Each Of The Buttons, Buttons Are Generated By @foreach Loops

i want to write some javascript that attaches to the social buttons. Something like this:

$(document).ready(function() { $('.social-network').on('click', '.provider-btn', function( e ) { $.ajax({ 'url': 'addconnection', 'data': {network: this.data('network')}, 'dataType': 'json' }).done(function(json) { if (json.status='ok') { window.location=json.url; } }); }); });

And then on the server side, i need a piece of code that will execute and make sure that the response does something like this:

function handleAddConnection($network) { $social_network = DB::table('social_networks')->where('name', $network)->first(); $url = $social_network->apiUrl; $response = array('status' => 'ok', 'url' => $url); }

tubbrez started a new conversation Ajax + Laravel 5.2 + Add An Attribute To Each Of The Buttons, Buttons Are Generated By @foreach Loops

My view:

@foreach ($social_networks as $social_network)

{{ $social_network->displayName}} @endforeach

My Controller:

$social_networks = DB::table('social_networks')->get();

    if(Auth::user()->admin)
    {
        return view('adminDashboard')
                ->with('social_networks', $social_networks)
                ->with('i', ($request->input('page', 1) - 1) * 9);
    }
    return view('dashboard')
                ->with('social_networks', $social_networks)
                ->with('i', ($request->input('page', 1) - 1) * 9);

My route:

Route::resource('dashboard','DashboardController');

Basically, what i need is, to try and add a url link to each of the buttons that get generated. And each of the buttons link will be different.

I need to add an attribute to each of these buttons. Let's call it data-url. In there I put the URL of the network And i need to attach a handler that fires when the button is clicked so that the URL is followed.

17 May
2 years ago

tubbrez left a reply on Laravel 5.2 + How To Add Different Href Links To Each @foreach Datas

@shakti I know that, i was asking if any of you out there knows any altertnate way to do this without using the database

tubbrez started a new conversation Laravel 5.2 + How To Add Different Href Links To @foreach Datas

My Controller:

public function index(Request $request) { $datas = DB::table('city')->get();

    return view('dashboard')
                ->with('datas', $datas)
                ->with('i', ($request->input('page', 1) - 1) * 9);
}

My view:

@foreach($social_networks as $social_network)

                                        <button type="button" class="btn btn-primary btn-rounded provider-btn"><i class="fa"></i>
                                            <span>
                                                <img src="/images/social-logos/{{ $social_network->iconUrl}}" class="fa resize-social-logo">
                                                {{ $social_network->displayName}}  
                                            </span>
                                        </button>
                                        
                                        @endforeach 
12 May
2 years ago

tubbrez left a reply on Laravel 5.2 + Password Reset

but can't we still use the e-mail but just don't let it appear on the form?

tubbrez started a new conversation Laravel 5.2 + Password Reset

Hi!

I have a working password reset functionality in my laravel 5.2 project. By default when i make a password reset request, i get an e-mail with the password reset link which when clicked upon brings me to my webpage to reset my password and over here there are three fields, namely; "e-mail", "password" and "confirm password". I wanted only the "password" and "confirm password" fields to appear and not the "e-mail" field so i removed it from my view but then the password does not reset. I was wondering if there is a way to work this out

Thanks in advance for your insights!

11 May
2 years ago

tubbrez left a reply on Laravel 5.2 + Socialite + Update Status

Thanks for the insight! :)

09 May
2 years ago

tubbrez left a reply on Laravel 5.2 + Pagination + Multiple DB Table

I see what you mean

Thank You!

tubbrez left a reply on Laravel 5.2 + Redirect Admin

I found the solution, its very simple, in our controller, we'll need to use:

if(Auth::user()->admin) { // }

tubbrez started a new conversation Laravel 5.2 + Pagination + Multiple DB Table

Hi!

Does anybody have an idea of how to do pagination on a page whereby in a data table, i'm displaying data from multiple tables?

I've pasted below, the algorithms that i'm using and please note that it is working fine but now i want to add pagination to that page, so does anybody know how i could modify my controller or view so that i can achieve that?

Thank you in advance!

In my controller:

namespace App\Http\Controllers;

use Illuminate\Http\Request; use App\Http\Controllers\Controller; use DB;

class DashboardController extends Controller {

public function index(Request $request) { $dataFirst = DB::table('firsts') ->join('account_connections', 'firsts.ftId', '=', 'account_connections.ftId')->get();

$dataSecond = DB::table('seconds')
    ->join('account_connections', 'seconds.trId', '=', 'account_connections.trId')->get();

$dataThird = DB::table('thirds')
    ->join('account_connections', 'thirds.geId', '=', 'account_connections.geId')->get();

 return view('dashboard')
            ->with('dataFirst', $dataFirst)
            ->with('dataSecond', $dataSecond )
            ->with('dataThird', $dataThird )
            ->with('i', ($request->input('page', 1) - 1) * 9);

}

}

In my view:

                    <thead>
                        <tr>
                            <th>No</th>
                            <th>My Team</th>
                            <th>Website</th>
                        </tr>
                    </thead>
                    
                    @foreach($dataFirst as $dataFirst)
                    @if(Auth::user()->id == $dataFirst->user_id)
                    
                    <tbody>
                        <tr>
                            <td>{{ ++$i }}</td>
                            <td>{{ $dataFirst->first_name}} {{ $dataFirst->last_name}}</td>
                            <td>{{ $dataFirst->website}}</td>
                        </tr>
                    </tbody>
                    
                    @endif
                    @endforeach
                    
                    @foreach($dataSecond as $dataSecond )
                    @if(Auth::user()->id == $dataSecond ->user_id)
                    
                    <tbody>
                        <tr>
                            <td>{{ ++$i }}</td>
                            <td>{{ $dataSecond ->first_name}} {{ $dataSecond ->last_name}}</td>
                            <td>{{ $dataSecond ->website}}</td>
                        </tr>
                    </tbody>
                    
                    @endif
                    @endforeach
                    
                    @foreach($dataThird as $dataThird)
                    @if(Auth::user()->id == $dataThird->user_id)
                    
                    <tbody>
                        <tr>
                            <td>{{ ++$i }}</td>
                            <td>{{ $dataThird->first_name}} {{ $dataThird->last_name}}</td>
                            <td>{{ $dataThird->website}}</td>
                        </tr>
                    </tbody>
                    
                    @endif
                    @endforeach 
                    
                  
13 Apr
2 years ago

tubbrez started a new conversation Update Social Network Status + Laravel 5.2 + Socialite + Hybridauth

I was wondering if anyone could point me to a tutorial of how to use "socialite" or "hybridauth" in "Laravel 5.2" for the purpose of

first: to log the user in my website via their social network accounts ( Facebook, Twitter, Pinterest, LinkedIn, Instagram and Google+ )

second (and most important): to give my user the ability to update his status on those social networks via my own website

third: the user can even schedule his status to be posted in the future

fourth: the user can remove his social network account or add multiple social network accounts to the same social network.

I would be very grateful if anyone could help me out here, i've been doing so much research on this and tried so many things in Laravel, but till now i wasn't able to achieve what i wanted to do.

tubbrez left a reply on Laravel 5.2 + Socialite + Update Status

Thanks!

But i was wondering if you could point me to a tutorial of how to use "socialite" or "hybridauth" in "Laravel 5.2" for the purpose of

first: to log the user in my website via their social network accounts ( Facebook, Twitter, Pinterest, LinkedIn, Instagram and Google+ )

second (and most important): to give my user the ability to update his status on those social networks via my own website

third: the user can even schedule his status to be posted in the future

fourth: the user can remove his social network account or add multiple social network accounts to the same social network.

I would be very grateful if you could help me out here, i've been doing so much research on this and tried so many things in Laravel, but till now i wasn't able to achieve what i wanted to do.

12 Apr
2 years ago

tubbrez started a new conversation Laravel 5.2 + Socialite + Update Status

Hello everyone!

Well, for quite some time now, i've been doing some research on which plugin to use in Laravel 5.2 for the purpose of authenticating users in my website via their social networks accounts.

I wanted to use Hybridauth, but it is not compatible with Laravel 5.2, it is compatible only with Laravel 4.2. So, i was thinking of using Socialite, but the thing is that i want to give my user the ability to post his social network status via my own website.

So, is there a way that i could give my user this ability using Socialite?