renec112

renec112

Member Since 3 Years Ago

Experience Points 5,080
Experience Level 2

4,920 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 30
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.

17 Aug
3 years ago

renec112 left a reply on Ajax Returns Json. Doesn't Append It.

Thank you so much! Runs like a charm ! :)

renec112 left a reply on Ajax Returns Json. Doesn't Append It.

@gator you are right and that works perfectly when i run this code:

<script type="text/javascript">
$('select').change(function(){
var data = $(this).children('option:selected').data('id');

$.ajax({
    type    :"POST",
    url     :"urls/myurls",
    dataType:"html",
    data    :{ data1:data },

    success :function(response)
    $('#yourdiv').append(html);
    }),
});
</script>

But this only works if the div is already loaded with the scripts and all that. But if a user opens the browser and types www.mySite.com/urls/myurls, the layout doesn't get rendered, and the html doesn't get appneded. Instead, the user just see some json /:

renec112 started a new conversation Ajax Returns Json. Doesn't Append It.

Hi. I have a working site that's doesn't use Ajax yet. I wan't to change that. So being able to render views and return them works perfectly for me. I'm using this code:

    $returnHTML = view('urls.myUrls')->with('url_database', $url_database)->render();
         return response()->json(array('success' => true, 'html'=>$returnHTML));

The example above works perfectly to return some html and append it on a div. However, if a user types in the url: www.mySite.com/urls/myurls with the code above, the user just get some json - it's not appended to a div.

What can i do to change this?I hope won't have to make 2 views. .. 1 for Ajax call, and 1 for accessing the page directly..

Thank you so much.

31 Jul
3 years ago

renec112 left a reply on Setting Up Lets Encrypt On Forge

Or i meant: site.com & www.site.com is dead. The only thing that works is https://site.com or https://www.site.com

Can i fix that there @mstnorris ?

renec112 left a reply on Setting Up Lets Encrypt On Forge

@mstnorris I'm using digital ocean too for the DNS. Can you be a bit more specific about how to do that? I'm looking under: https://cloud.digitalocean.com/networking/domains

renec112 left a reply on Setting Up Lets Encrypt On Forge

I got it working thank you very much @mstnorris As you said, it was just a 30 second processes.

Now i have to figure out how to edit the .hacces so users get redirected from site.com and from www.site.com :p

Anyways just checked out your website looks awesome - but my browser warns me that your ssl certificate is too old. Just wanted to let you know.

30 Jul
3 years ago

renec112 left a reply on Setting Up Lets Encrypt On Forge

Thanks man. I might do that tomorrow. - I truly appreciate that.

renec112 left a reply on Setting Up Lets Encrypt On Forge

@mstnorris thank you so much. I'm about to go out i so don't dare to do this today.

Will take a look at this tomorrow. Thank you so much for your help. You just made my life 400x times easier :D

renec112 left a reply on Setting Up Lets Encrypt On Forge

Omg @mstnorris ! Thank you so much.

How did i miss that haha :D Can i ask you, is this what you mean when you say: "Make sure that your domains are listed"? http://imgur.com/a/l5o0u

This "default,www.default" is whats comming when i press "LetsEncrypt (Beta)" button

i'm not sure what to type instead :)

renec112 started a new conversation Setting Up Lets Encrypt On Forge

Hi. I'm a total server rookie and i'm about to add https with lets encrypt.

All the guides i could find seemed very outdated. The best guide i could find was this: https://sysops.forlaravel.com/letsencrypt

Is this too outdated? would this do? Hope you want to help a rookie out. Thank you :)

renec112 left a reply on Compiled.php Line 8565: Controller Does Not Exist?

Thank you guys very much! @bobbybouwmann you got it. I spelled it messagesController not MessagesController.

renec112 started a new conversation Compiled.php Line 8565: Controller Does Not Exist?

Hi guys. I'm notsure what's happening here. When i post a message using request i get this error:

ReflectionException in compiled.php line 8565:
Class App\Http\Controllers\MessagesController does not exist

Strangely i only get this error on my server, everything works fine locally.

This is the messageController:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Controllers\Controller;
use App\User;
use Auth;
use App\Activity;
use App\messages;
Use Carbon\Carbon;

class MessagesController extends Controller

Am i missing something? Thank you so much

10 Jul
3 years ago

renec112 left a reply on Sum For Each Id?

Worked perfectly. Thank you so much :)

05 Jul
3 years ago

renec112 started a new conversation Sum For Each Id?

quick question - i have been googling for 1,5 hours now without luck :D

How can i sum each users data for each id?

i have a query.. table::where("pointsToUser", Auth::user()->id)->get(); By doing this i'll get:

belongsToId 1, userId 2, points: 5
belongsToId 1, userId 5, points: 7
belongsToId 1, userId 2, points: 5

I would love to sum the points where id is the same.. so the results is this instead:

belongsToId 1, userId 2, points: 10 // 5+5
belongsToId 1, userId 5, points: 7
04 Jul
3 years ago

renec112 left a reply on Building Small Analytics Log With MySql

Thank you for the input guys :D

I need data for 31 days, i'm not sure why 31 rows with 1 coloumns is better than 1 row with 31 columns? If i do user_id|date|points for one user i will get:

user_id|date|points
1       day2    31
1       day3    40
1       day4    45

Is that better than:

user_id|day2|day3||day4
1         31   40  45

I see your solution would work as well. It's great with some input thank you :)

// edit I your solution will be great to manage actually. Each day cron jobs delete rows older than 31 days. Each day cron jobs creates one new row, and stores the daily data.

Great idea :)

renec112 left a reply on Building Small Analytics Log With MySql

I might have explained it a bit weird sorry. Some data/points for each user is being collected all the time on my site. I want to store how many points was collected for each user, everyday.

So a user might have 3500 points in total. But i would like to make some small analytics data on how many points each user got each day. Example to show points gotten 5 days ago: 274 points. I'm thinking about creating a Analytics table.

        Schema::create('data', function (Blueprint $table) {
$table->increments('id');
$table->integer("user_id");

// columns to collect each day
 $table->integer("day1");
 $table->integer("day2");
 $table->integer("day3");
 $table->integer("day4");
.....
 $table->integer("day31");
         
            $table->timestamps();
});

Does this makes sense? Then each day the cron jobs store the new value. So if it was Januar the 3rd, points this day gets stored in day 3, by the cron job :)

I could then use this data, to show the users a curve of "Points latest month" :)

renec112 left a reply on Building Small Analytics Log With MySql

I'm thinking maybe do one of these:

  1. I could also create 32 coloumns on the table. The last column stores "latestDayLogged" so maybe it says latestDay: 15. Then when the cronjob runs it select coloumn 15, logs the data, then increment "latestDayLogged" to 16.

  2. Maybe there's a carbon function to get DayOfTheMonth? and then use this to select what day should be logged.

renec112 started a new conversation Building Small Analytics Log With MySql

Hi guys :) I want to build a small analytics table. I'm not the best coder so i'm there's proberbly much more advanced ways to do this. I want to store a integer for each user, each day. But this data only has to be stored for a month.

So what i'm thinking is, to create a mysql table, have 31 coloumn integers on it, then run a cron job every day to log the newest data, on the oldest field.

But i have no clue if this is really a terrible idea, or how to get the oldest field. How could i do this? would love your input!

17 Jun
3 years ago

renec112 left a reply on I Made A Huge Mistake Server Is Down. Composer Wont Update

thank you so much for the help @EmilMoe :) ! I think that wouln't be possible though - somehow no commands wored because of this compiled.php. Not even dump-autoload. If somebody runs into the same issue i think they should try to move or rename compiled.php, then run php artisan optimize

renec112 left a reply on I Made A Huge Mistake Server Is Down. Composer Wont Update

i fixed it by deleting: compiled.php in /home/forger/default/bootrap/cache/compiled.php and running php artisan optimize :)

renec112 left a reply on Missing Argument 3 On Server - Bootstrap Cache ?

I fixed it by deleting compiled.php and running php artisan optimize :)

renec112 left a reply on Missing Argument 3 On Server - Bootstrap Cache ?

Thank you @d3xt3r i just checked the vendor file permission with stat -c %a it says 755.

Weird. On bitbucket there's no compiled.php but on the server there is :) will try to view this file on my server.

I heard you could just delete compiled.php and run php artisan optimize? What do you guys think about this?

16 Jun
3 years ago

renec112 left a reply on Missing Argument 3 On Server - Bootstrap Cache ?

Yes i'm sure :) Heres the error from the server: http://imgur.com/0IESj5u

Also when i push files to the server, forge says

Loading composer repositories with package information
Installing dependencies from lock file
  - Removing symfony/dom-crawler (v3.0.7)

                                                                                        
  [RuntimeException]                                                                    
  Could not delete /home/forge/default/vendor/symfony/dom-crawler/Tests/LinkTest.php:   
                                                                                        

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...

Would really love your input on this..

renec112 started a new conversation Missing Argument 3 On Server - Bootstrap Cache ?

Hey guys I installed Googlitics on my server https://github.com/bradcornford/Googlitics. But i changed my mind and wanted to remove it agian. So i removed "cornford/googlitics": "2.*" on compsoer.json, and the correct files in app/config/app.php

After pushing these changes somehow my composer an php artisan is completely wrecked on my server, but everything runs perfect locally. No matter what i do to try to fix it like: php artisan clear-compiled or dumpautoload or composer update i get the error:

[ErrorExeption]
Missing argument 3 for Illuminate\Session \FileSessioNHandler::__construct(), called in /home/forger/default/bootrap/cache/compiled.php on line 12291 and defined 

I'm looking at the bootstrap cache folder and i don't even have the compiled.php or any config.php files. What am i doing wrong?

i Would love your help!

renec112 left a reply on I Made A Huge Mistake Server Is Down. Composer Wont Update

@EmilMoe delete composer.lock omn the server or locally?

renec112 started a new conversation I Made A Huge Mistake Server Is Down. Composer Wont Update

Hey Guys i made a huge mistake and took my server down. I installed Googlitics on my server https://github.com/bradcornford/Googlitics. But i changed my mind and wanted to remove it agian. So i removed "cornford/googlitics": "2.*" on compsoer.json, and the correct files in app/config/app.php

running a local "composer update" works correct now But when i push the files with forge or login the server and do a composer update i get this error:

Loading composer repositories with package information
Installing dependencies from lock file
  - Removing symfony/dom-crawler (v3.0.7)

                                                                                        
  [RuntimeException]                                                                    
  Could not delete /home/forge/default/vendor/symfony/dom-crawler/Tests/LinkTest.php:   
                                                                                        

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...

Please help me!

29 May
3 years ago

renec112 left a reply on Laravel OrderBy Works Locally But Not On Server?

Not really a solution but i just sorted the data in my view instead.

@foreach($users->sortByDesc("ratio") as $userlist)
     @include("user/partials/userblockfreinds")
@endforeach `

I could then remove the SortBy in the query:

 public function partners()
    {
        return $this->partnersOfMine()->wherePivot("accepted", true)->get()
        ->merge($this->partnersOf()
        ->where("accepted", true)
    // ->orderBy("ratio", "DESC") DELETED
        ->get());
    }

renec112 left a reply on Laravel OrderBy Works Locally But Not On Server?

Thanks @Snapey i just checked and it looks correct: http://imgur.com/x27jr7W

renec112 started a new conversation Laravel OrderBy Works Locally But Not On Server?

Hi guys. I'm trying to order a users friends/partners after their ratio wich is a float value on the user table. (there numbers like 2.6, 0.01) and so on.

I'm trying to sort the data so users with higest ratio is shown first. This is what i'm doing:

    public function partners()
    {
        return $this->partnersOfMine()->wherePivot("accepted", true)->get()
        ->merge($this->partnersOf()
        ->where("accepted", true)
        ->orderBy("ratio", "DESC")
        ->get());
    }

This orderBy works locally. But when i push this to the server it doesn't care at all about this orderBy statement.

Would love your input on how to fix this :) !

20 May
3 years ago

renec112 left a reply on Forge Scheduled Job "failed To Open Stream: Permission Denied "

I'm not sure @zachleigh forge just pulled the files from bitbucket to the server. What permission should it have?

Sorry i'm new to this. I'm assuming i can only update this on the server consol? It's not possible to change permission locally then push those new permission to the server?

renec112 started a new conversation Forge Scheduled Job "failed To Open Stream: Permission Denied "

Hey guys :) I'm trying to fire a scheduled job in forge. My command works perfectly it fires and works if do it in the console.

However when i add this commands to forge scheduled job, when it should fire the command forge returns this error:

  [ErrorException]                                                                                                                                       
  file_put_contents(/home/forge/default/storage/framework/views/40063bff7938b49f8e48cd66b155ab6672e0d867.php): failed to open stream: Permission denied 

I have no clue what's happening. Can anyone help?

19 May
3 years ago

renec112 left a reply on Route To Delete An User?

Guys thank you so much for your input. I never thought of POST for this but i see i will solve my issue.

@Frankiec91 I see that's very smart actually. Would also solve the issue.

renec112 left a reply on Route To Delete An User?

exactly @samo :) Thank you. I know it's possible to create this url: www.site.com/profile/deleteAccount But trolls can use this link to trick people to click it.

I see your solution with email would solve this issue. But i'm looking for a easier solution.. Maybe if i can call a DeleteUser method without a url. Would love your input.

renec112 started a new conversation Route To Delete An User?

Hey guys would like your input on this question. I wanna create a method for a user to delete their own account. However i don't know how to call that method. Because all my current methods a called via Routes. I think trolls will trick people to click on a link that would delete their account. I thought about making a ajax call instead. But i'm afraid trolls will still find this url and use it.

What can i do?

15 May
3 years ago

renec112 left a reply on NoSQL In Laravel

+1 !

14 May
3 years ago

renec112 left a reply on Scheduled Job Error

I have the same issue. Did you solve the problem?

renec112 left a reply on Analytics With Mysql, Laravel & Cron Jobs

I asked how to build analytics for these "clicks" an got the same answer as Ohffs is proposing - it was on larachat. Also he said it was bad practice and the solution wouldn't be scaleable so i'm looking for different options :D

I'm not sure but these cron-jobs seems like a good solution. But i'm not sure at all on how to do it or if it's really a good idea at all :p Would love your input.

renec112 left a reply on Analytics With Mysql, Laravel & Cron Jobs

I was told it was bad practice and unsaleable - what do you think?

renec112 started a new conversation Analytics With Mysql, Laravel & Cron Jobs

Hey :) I want to create some analytics for my users. I have a counter that counts total clicks on a link ´users->totalClick´. I'm thinking about making a cron job that runs every night and saves the generated clicks for this day. I'm thinking something like this:

      Schema::create('partners', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id');
            $table->integer('clicksDay1');
         $table->integer('clicksDay2');
        $table->integer('clicksDay3');
         .......
        $table->integer('clicksDay31');
        });

Then i'll be able to show on a graph how many clicks vent through each day for the month. Then each month, run a cron job to store total clicks for the month.

Is this possible? or really bad practice? Would love some input on how to select with cron jobs what day to store the current clicks. So if it's January the 16, store clicks on $table->integer('clicksDay16');

12 May
3 years ago

renec112 left a reply on Vue Updates Too Fast For Php

Oh didn't know about that method - that's good to know in the future. Thanks @jekinney :D

renec112 left a reply on Vue Updates Too Fast For Php

I solved it - i could change my data on the ajax call. Instead of:

 getPosts: function(){
                    $.ajax({
                        url: '/chatGet',
                        dataType: 'json',
                        type: 'get',
                        data: {
                            limit: this.limit,
                            forum1: this.forum
                        }
                    }).success(function(data){
                        this.posts = data.posts;
                        this.total = data.total;
                    }.bind(this));
                },

I could check with javasript what radio is selected and use that as the value. Like so:

    getPosts: function(e){
                    $.ajax({

                        url: '/chatGet',
                        dataType: 'json',
                        type: 'get',
                        data: {
                            limit: this.limit,
                            forum: document.querySelector('input[name="forum"]:checked').value
                        }
                    }).success(function(data){
                        this.posts = data.posts;
                        this.total = data.total;
                    }.bind(this));
                },

renec112 left a reply on Vue Updates Too Fast For Php

Thanks for your input. I'm not sure how to do that exactly :/ Is my current setup not doable?

10 May
3 years ago

renec112 started a new conversation Vue Updates Too Fast For Php

Hello :) I've created a small basic chat function with Vue and laravel. In the chat system i have created small chat with categories/forums. So users can switch between a forum "free for all" and "gaming", "fitness" and so on. The chat is working perfectly - however i have problems when i'm switching between forums. I want to do that on a click on a radio button:

<input type="radio" class ="FreeForAll" id="FFA" value="FFA"  checked="checked" v-model="forum"  v-on:click="getPosts">
<input type="radio" class ="Gaming" id="Ga" value="Ga"  checked="checked" v-model="forum"  v-on:click="getPosts">
<input type="radio" class ="Fitness" id="Fi" value="Fi"  checked="checked" v-model="forum" v-on:click="getPosts">

As you can see, i'm trying to refresh the forum on a click of a radio button. When you click this happens:

                getPosts: function(){
                    $.ajax({
                        url: '/chatGet',
                        dataType: 'json',
                        type: 'get',
                        data: {
                            limit: this.limit,
                            forum1: this.forum
                        }
                    }).success(function(data){
                        this.posts = data.posts;
                        this.total = data.total;
                    }.bind(this));
                },

The AJAX request goes through a route then a Controller. On the controller i'm getting all the message with the forum/category column (example GA for gamers)

public function chatGet(Request $request, Chat $chat){
        $allPosts = $chat->where("forum", $request->input("forum1"))->with("user");
        
        $chatPost = $allPosts->orderBy("created_at","desc")
        ->take($request->get("limit", 20))
        ->get();
        return response()->json([
            'posts' => $chatPost,
            'total' => $chatPost->count(),
        ]);
    }

This works perfectly. However - my problems is when you click on the button, Vue refreshes before it has changed category on the click the request is: www.mySite.com/chat?forum=oldValue (refreshes with old forum) Miliseconds after the request is: www.mySite.com/chat?forum=Correct value(doesn't refresh but forum is correct)

Would love your input on how to do this :D

05 May
3 years ago

renec112 left a reply on Database Where -> Isn't Case Sensitive?

Thank you very much @Prez ! after googling and debugging a bit i found a solution:

$url_database = (url::where(DB::raw('BINARY `code`'), $code)->first());

I¨'m not sure if that's best practice. Do you think it's slowing my server down a lot?

renec112 started a new conversation Database Where -> Isn't Case Sensitive?

Hi guys i'm really in trouble. On a live url shortining site i'm converting a short url to a real like so: www.site.com/1F

$url_database = (url::where("code", $code)->first());

Sadly this return the url from 1f not ´1F´ I'm trying with:

$url_database = (url::where("code", 'like', $code)->first());

same results!

  • Would love your input!
02 May
3 years ago

renec112 started a new conversation Setting Up Mysql Database For Analytics Like Bit.ly

Hello :)

I'm thinking about creating some analytics for my users. But i have no clue on how to do the database.. :)

Do you know how to structure a database to allow for analytics like bit.ly? specificly bit.ly counts how many clicks vent through for each day. I'm assuming the structure isn't like this, but it would probably work:

Url table 
id->integer()
user_id->integer()
link->text()
day1->timestamp()
day1Count->->integer()
day2->timestamp()
day2Count->->integer()
day3->timestamp()
day3Count->->integer()

... and so on :D

edit// sorry for being a bit unprecise. i mean like this: https://slack-imgs.com/?c=1&url=https%3A%2F%2Fbot.gyazo.com%2F582e6bbf3a55892d9ca44576d4bfa6ee.png

01 May
3 years ago

renec112 left a reply on Forge "could Not Delete .. " On Push

Crap also i deleted something mistakenly.

Here in the active firewall rules forge created 2 liens automatically. i deleted one: http://imgur.com/GErtpO3

anyone know what i deleted?

renec112 started a new conversation Forge "could Not Delete .. " On Push

Hey guys when i push my local files to bitbucket->forge->digital ocean, forge returns this error:

Loading composer repositories with package information
Installing dependencies from lock file
  - Removing symfony/dom-crawler (v3.0.4)

                                                                                           
  [RuntimeException]                                                                       
  Could not delete /home/forge/default/vendor/symfony/dom-crawler/FormFieldRegistry.php:   

I tried SSH into the server and delete the vendor folder, and i did a composer install. Sadly, didn't work. Any ideas?

18 Apr
3 years ago

renec112 left a reply on Access Denied For User 'forge'@'localhost' (using Password: NO)

Thank you very much @tykus_ikus ! 'key' => env('APP_KEY') was not set the way you wanted :)