frutos93

Experience

270

0 Best Reply Awards

  • Member Since 3 Weeks Ago
  • 1 Lesson Completed
  • 0 Favorites

19th September, 2017

frutos93 left a reply on How To Broadcast To Certain Users Within A Channel? • 3 days ago

Anyone? Another way to see it is How can I another user, within the thread, join a channel whenever ThreadPosted is broadcasted? I tried putting the Echo.join inside the listen method but I would also like to do an action when a user(that has authorization) joins(push the thread to the array thread)

18th September, 2017

frutos93 left a reply on How To Broadcast To Certain Users Within A Channel? • 4 days ago

@Jaytee The problem is not to verify if a user is authorized to access a channel, the problem is how can I notify and make other users join a channel whenever a thread is posted.

example: User A creates a Thread in which user B is a participant. -ThreadPosted Event is fired. -How or in which channel should the event be broadcasted so that user B can be notified of the new thread without user C getting the notification.

frutos93 started a new conversation How To Broadcast To Certain Users Within A Channel? • 4 days ago

Developing a chat widget using Laravel 5.5, vue.js and pusher.

If a user creates a new conversation(new channel) how can I broadcast, or notify, the other users in the conversation that there is a new conversation.

At the moment I make every user that enters the page join a default channel and listen to the event that a conversation(thread) is posted. Every user gets the conversation and when the users, that do not belong to the chat, refresh the page the conversation disappears(this is a validation in which you do a GET request to retrieve the conversations you belong to).

I would like a way to, instead of every user, just make the correct users listen to that event.

Echo.join('chat')
        //.here()
        //.joining()
        //.leaving()
        .listen('ThreadPosted', (e) => {
            console.log(e);
            this.threads.push(e.thread);
        });

Another question I have: Is it better to join every channel, of every conversation, once the app is created OR whenever you change the conversation you are viewing exit the last channel and join the new channel of the conversation. Aaaand can a channel listen to several events?

12th September, 2017

frutos93 started a new conversation Retrieve User Name In Vue.js • 1 week ago

I have an vue component in which I would like to send the logged user name and it's structured this way:

export default {
        data(){
            return{
                messageText: ''
            }
        },
        methods:{
            sendMessage(){
                this.$emit('messagesent', {
                    message:this.messageText,
                    user: {
                    name: Auth()::user()->name
                            }
                });
                this.messageText = '';
            }
        }
    }

Auth user doesn't work, it throws an error.

Auth()::user()->name

How can I retrieve the logged user name in a vue method?

28th August, 2017

frutos93 started a new conversation No Query Results For Model [RampUp\Skills]. • 3 weeks ago

Whenever I try to access /skills/add I get No query results for model [RampUp\Skills].

Tried using dd("test") but won't even appear

This are my routes for skills/add

Route::put('/skills/add', '[email protected]');

Route::get('/skills/add', '[email protected]');

Here are my functions in SkillsController

public function addIndex() {
        if (Auth::check()) {
            return view('skills.add');
        } else {
            return redirect('/home');
        }
    }

and

public function add(Request $request) {
        /*Sets validation rules for Skill object*/
        $skillRules = [
            'name' => 'required|max:25|regex:/[1-9a-zA-Z ]\w*/',
        ];
        if (Skills::where('name', '=', $request->name)->count() > 0) {
            return redirect('/skills')->with('message', "EXISTS");
        }

        $validator = Validator::validate($request->all(), $skillRules);
        if ($validator == null) {
            $newSkill = new Skills;
            $newSkill->name = strtolower($request->name);
            $newSkill->save();
            return redirect('/skills')->with('message', "CREATED");
        }
    }

the skills.add view is this

@extends('layouts.app')

@section('content')

<div class="container">
    <h1>Edit Skill</h1>
    <form method="POST" action="/skills/add">
        {{method_field('PUT')}}
        {{csrf_field()}}
        <div class="row">
            <div class="col-lg-5">
                <div class="form-group">
                     Name:
                    <input name="name" class="form-control">
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-2">
                <div class="form-group">
                <button type="submit" class="btn btn-primary">Add Skill</button>
                <a href="/skills"><button type="button" class="btn btn-danger">Cancel</button></a>
                </div>
            </div>
        </div>
    </form>
    @if (count($errors))
            <div class="form-group">
            <div class="alert alert-danger">
                <ul>
                    @foreach($errors->all() as $error)
                        <li>{{$error}}</li>
                    @endforeach

                </ul>
            </div>
            </div>
        @endif
</div>
@endsection
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.