frutos93

Experience

600

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

17th November, 2017

frutos93 left a reply on How Many Javascript Frameworks Should I Learn That Is "enough"? • 6 days ago

I'd say to start is completely fine, but as time goes you will learn and have to use other front and back end frameworks. To the list I would also add database(if going with laravel then mysql) That should give you a good headstart

Of course there are a lot of things to consider like if you're going to be working as a freelancer, in a company, what type of projects will you be doing and more. But for basics I think it's really good to master those mentioned.

13th October, 2017

frutos93 left a reply on Modal Subcomponent In List • 1 month ago

Does it really needs to be a modal? Because If you want a desktop notification this could be helpful:

if (!('Notification' in window)) {
                        alert('Web Notification is not supported');
                        return;
                    }

                    Notification.requestPermission(permission => {
                        let notification = new Notification('New post alert!', {
                            body: "YOUR TEXT GOES HERE", // content for the alert
                        });
});

If you do really need a modal, I would recommend, instead of using the v-showput the modal HTML within the main component and enable show the modal whenever the Event is listened using $('#myModal').modal('show'); and just display the data with the corresponding data.

frutos93 left a reply on Passing Data To Components • 1 month ago

As @jbloomstrom said, formatt the code with 3 blackticks at the beggining and at the end

{{ tipo.descricao }}

<app-formulario :campos="lista[index].tipo_registro_campos"></app-formulario> ` will produce

<tr v-for="(tipo, index) in listaOrdenada"> 
    <td @click="selected">{{ tipo.descricao }}</td>
</tr>

<app-formulario :campos="lista[index].tipo_registro_campos"></app-formulario>

Concerning your question:

send the @click="selected" the object you are using, or just the parameter you need, like this:

<tr v-for="(tipo, index) in listaOrdenada"> 
    <td @click="selected(tipo.tipo_registro_campos)">{{ tipo.descricao }}</td>
</tr>

that will send to the function the required item you need. Note that you are sending the item to the function, not to <app-formulario>

11th October, 2017

frutos93 left a reply on Laravel Real-time Chat Package • 1 month ago

@sutherland

Will change it later today then.

I will also check into tests, not sure how to implement them but will read docs. Thanks, and yeah, you're right, it would be better if they were interchangeable, but first I will complete it with pusher and after it is complete with more features I'll add Socket.io

frutos93 left a reply on Laravel Real-time Chat Package • 1 month ago

@tisuchi As I said, this is my first package and I do have several questions. Not sure if you could help me or not:

Why in the package it appears composer create-project frutdev/laravchat instead of composer require frutdev/laravchat ?

frutos93 left a reply on Laravel Real-time Chat Package • 1 month ago

@tisuchi Considered pusher because of the accessibility it has with Laravel as well as the free plan that it has.

But it is indeed an option to make it work with socket.io, might do another package later for whichever the user would like to use.

frutos93 left a reply on Generating CSS From From SASS Based On Variables Values From Database • 1 month ago

One possible way you could do this is retrieve the class in the controller and within the blade use <style></style> instead of importing a .css so you could use {{$blue->color}}

frutos93 started a new conversation Laravel Real-time Chat Package • 1 month ago

Just created a Laravel package that is a real-time chat for users within the app. There are still a lot of things to improve and add.

This is my first package so if you have any suggestions feel free to tell me. I'm all ears. Hope you like it and that you don't find the installation so tedious.

9th October, 2017

frutos93 started a new conversation Laravel- Web Middleware Not Authenticating/Auth Middleware Not Working • 1 month ago

Developing a Laravel packages and in the routes I have this routes

Route::middleware(['web'])->group(function () {
    Route::get('/pckOne', 'Frutdev\LaravPck\Controllers\[email protected]');

    Route::get('/pckZone', 'Frutdev\LaravPck\Controllers\[email protected]');
    Route::post('/pckZone', 'Frutdev\LaravPck\Controllers\[email protected]');
    Route::get('/pckUsers', 'Frutdev\LaravPck\Controllers\[email protected]');
    Route::get('/pckUser', 'Frutdev\LaravPck\Controllers\[email protected]');
    Route::get('/pckArea', 'Frutdev\LaravPck\Controllers\[email protected]');
    Route::post('/pckArea', 'Frutdev\LaravPck\Controllers\[email protected]');
    Route::get('/{Area}/pckZones', 'Frutdev\LaravPck\Controllers\[email protected]');
    Route::post('/{Area}/pckZone', 'Frutdev\LaravPck\Controllers\[email protected]ostAreaZone');
});

The routes are not being authenticated.

I tried with the web middleware but can still see/access the routes while not logged in. I tried with the auth middleware but even after logging in with the default Laravel loggin in system(which wasn't altered) I can't access the routes. It says I'm unauthorized, even after logging in. Any idea?

4th October, 2017

frutos93 started a new conversation Require Is Not Defined. Using Vue Within Laravel Package • 1 month ago

Developing a vue package and, within it, I'm trying to use Vue. but I keep getting ReferenceError: require is not defined

This error is present within the app.js file in the line

require('./bootstrap');

I read that I whould download the require.js file and add it to the blade but after it I get the error

Error: Module name "bootstrap" has not been loaded yet for context: _. Use require([])

Whenever I try to use Vue outside of the package itself there is no problem but within the project that appears. The folders are correctly arranged within the package folder.

3rd October, 2017

frutos93 left a reply on Using JS And CSS In A Laravel Package • 1 month ago

@Ruffles not working

frutos93 left a reply on Using JS And CSS In A Laravel Package • 1 month ago

@donavyn even though it is a package? So I should create a public folder within the package? src/public/js?

frutos93 started a new conversation Using JS And CSS In A Laravel Package • 1 month ago

I want to develop a package but how can I use JS and CSS files in the Views of the package?

Example:

How can I make this work:

<script src="js/app.js"></script>

28th September, 2017

frutos93 started a new conversation Good Practice To Make A Broadcast Of An Event For Every User's Channel? • 1 month ago

I'm making a chat application and at first I had a general channel in which every user joined as soon as the app was created.

        Echo.join('chat')
            .listen('ThreadPosted', (e) => {});

ThreadPosted Is an event that is broadcasted whenever a user creates a new Thread with certain users on it.

The downside of this approach is that EVERY user within the 'chat' channel gets that Thread(later validation makes them not able to post but they still get it when it is created).

I was thinking that a way to approach this is by having each user have their own private channel whenever the app is created:

        Echo.private('App.User.' + userId)
            .listen('ThreadPosted', (e) => {
                console.log(e);
            });

And when the new Thread is created then fire, several times, the broadcast event.

//ThreadController

//$users contain all the users that will be in the new thread
foreach($users as $user){
    broadcast(new ThreadPosted($newThread, $user->id));
}


//ThreadPosted Event
public function __construct(Thread $thread, $user_id) {
        $this->thread = $thread;
        $this->user_id= $user_id;
    }

public function broadcastOn() {
        return new PrivateChannelChannel('chat'.$user_id);
    }

I'm not sure this is the best approach or if it is going to work but is there any other way to do that?

26th September, 2017

frutos93 started a new conversation Echo: On Successful Channel Join. • 1 month ago

How can I trigger an event/instructions when the user joins successfully a channel. I'm not saying how can I check whenever another user joins the channel because that is done using .join() I want to know how can I do something when the user, requesting to join the channel, joins succesfully

For example

 Echo.join('channel')
.onSuccessfulJoin({
//instructions
});

Obviously .onSuccessfulJoin() is not a method but that's the idea of what I would like to do.

19th September, 2017

frutos93 left a reply on How To Broadcast To Certain Users Within A Channel? • 2 months 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? • 2 months 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? • 2 months 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 • 2 months 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]. • 2 months 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.