leostereo

leostereo

Member Since 6 Months Ago

Experience Points
4,540
Total
Experience

460 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
36
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 1
4,540 XP
Apr
05
3 months ago
Apr
04
3 months ago
Activity icon

Started a new Conversation Redirect Exceptions And Errors To File

Hi guys , im working on a telegram app. I already stablished comunication between my app and my laravel backend. Problem is that I have a very limited output on telegram screen when error occurs. For example I receibe this:

<!DOCTYPE html><!--___UnexpectedValueException: The stream or file

Which is not usefull for debug. Is there some way to redirect those messages to a filefor a better debug? There is nothing usefull on mi log files. Regards, Leandro.

Mar
29
3 months ago
Activity icon

Replied to Session Lifetime Question.

Dear Sti3bas , thanks for the response. Why do you consider better to use cache instead of session ? (never worked with any of them. My project is to build a telegram chat aplication , I will keep track fo conversation. I appreciate your advice on this. Leandro.

Activity icon

Started a new Conversation Session Lifetime Question.

Hi guys , Im learning about sessions in laravel. I declare these routes:

Route::get('session/get','[email protected]');
Route::get('session/set','[email protected]');

One to store and other to retrieve the session key. and this is the controller:

<?php

namespace App\Http\Controllers;

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

class SessionController extends Controller
{

   public function accessSessionData(Request $request) {
        $value = $request->session()->get('key');
	return $value;
        //
    }
   public function storeSessionData(Request $request) {
        $value = $request->session()->put('key',date("Y-m-d H:i:s"));

        //
    }
}

Problem is that ... after first session->put, the stored key is never cleared. According to my .env , session lifetime is 120 (secconds I suppose).

[[email protected] api_chat]# grep SESSION .env
SESSION_DRIVER=file
SESSION_LIFETIME=120

But my key still there , allways calling at http://10.1.1.50/api_chat/public/index.php/api/session/get it returns for example: 2020-03-23 14:32:21 Shouldn`t key value be cleared autmatically after 120 seconds ?

Any thought would be wellcome. Regards. Leandro.

Mar
27
3 months ago
Activity icon

Replied to Can Not Store Session Value.

Thanks !!! It worked , I was working with api routes , so doing:

   protected $middlewareGroups = [
       'web' => [
           \App\Http\Middleware\EncryptCookies::class,
           \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
           \Illuminate\Session\Middleware\StartSession::class,
           // \Illuminate\Session\Middleware\AuthenticateSession::class,
           \Illuminate\View\Middleware\ShareErrorsFromSession::class,
           \App\Http\Middleware\VerifyCsrfToken::class,
           \Illuminate\Routing\Middleware\SubstituteBindings::class,
       ],

       'api' => [
           \Illuminate\Session\Middleware\StartSession::class,
           'throttle:60,1',
           'bindings',
       ],
   ];

btw ... looking at session documentation it does not mention anything about this line. Thankyou.

Activity icon

Started a new Conversation Can Not Store Session Value.

Hi guys , im running laravel 5.8. Im trying to set and get some session values but I got following message:

 RuntimeException
Session store not set on request.

This is my controller:

<?php

namespace App\Http\Controllers;

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

class SessionController extends Controller
{
    /**
     * Show the profile for the given user.
     *
     * @param  Request  $request
     * @param  int  $id
     * @return Response
     */
   public function storeSessionData(Request $request) {
        $value = $request->session()->put('key');

        //
    }
}

I did not tweak anything else.

Any ideas ? Leandro.

Mar
26
3 months ago
Activity icon

Started a new Conversation Telegram Stateful Chat Bot Backend

Hi guys; I will begin workin in my new project , it is a telegram chat bot. I already have my webhook done and can send and receive single messages. Now I would like to create a "dialog" between my app and the bot. So I will I need to keep track of the message states. Any ideas ... good practices ? I think , I will need to use sessions while posting to my api ... is this ok ? Ok ... any thought would be welcome. Regards. Leandro.

Mar
24
3 months ago
Activity icon

Started a new Conversation Time Elapsed Between Database Registers.

Hi guys , Im learning about elocuent. In my current project db , I need to create a column with the elapsed time from previous inserted register to current insert. On other scenario , I would try to solve it using timediff function but now I would like to use elocuent. Is there any way to do it ? If not what should be my second choice ? query builder ?

Regards. Leandro

Activity icon

Replied to Getting Timestamp Weird Format

Hi shez1983. My version:

[[email protected]_Redes fichajes]# php artisan --version
Laravel Framework 7.2.2

It worked !!!! Thanks.

Mar
22
3 months ago
Activity icon

Started a new Conversation Getting Timestamp Weird Format

Hi guys, im facing a strange behaviour: Im retriving some timestamps stored on my db doing:

 $registers = Fichajes::all()->toArray();
 $msg="Registros: \n";

                        foreach($registers as $register){
                                $msg .= $register['created_at'].' '.$register['type']."\n";
                        }
        
return urlencode($msg);

If I look at my Fichajes table , it looks like:

+----+---------------------+---------------------+---------+--------+
| id | created_at          | updated_at          | user_id | type   |
+----+---------------------+---------------------+---------+--------+
|  3 | 2020-03-22 17:49:38 | 2020-03-22 17:49:38 |       7 | begin  |
|  4 | 2020-03-22 18:03:03 | 2020-03-22 18:03:03 |       7 | finish |
|  5 | 2020-03-22 18:25:18 | 2020-03-22 18:25:18 |       7 | salida |
+----+---------------------+---------------------+---------+--------+

But when I bring the data , they looks like:

2020-03-22T17:49:38.000000Z begin
2020-03-22T18:03:03.000000Z finish
2020-03-22T18:25:18.000000Z salida
2020-03-22T18:26:21.000000Z salida
2020-03-22T18:26:27.000000Z entrada

How can I avoid those '000000Z' strings on my data ? Regards. Leandro

Feb
17
4 months ago
Activity icon

Replied to Elocuent Newbe Question

Thanks guys, im aware about the idea of "array with steroids" am learning about its power step by step. Now , I got the id , but can not find the diference in:

>>> $rtu = App\Rtu::where('mac','DEADDEAD1111')->first()->id;
=> 74
>>> $rtu = App\Rtu::where('mac','=','DEADDEAD1111')->get('id');
=> Illuminate\Database\Eloquent\Collection {#2994
     all: [
       App\Rtu {#2976
         id: 74,
       },
     ],
   }

Why in first case I got the scalar value and in second I got the collection object? Anyway , thanks for helping me!

Activity icon

Started a new Conversation Elocuent Newbe Question

Hi guys , im trying to learn using elocuent model. I think my question is easier to explai with this example. Im trying to get the id for a table row, usually I would do:

select id from rtu where mac='DEADDEAD1111';

So , im trying to do same using elocuent, I have:

>>> $rtu = App\Rtu::where('mac','=','DEADDEAD1111')->get('id');
=> Illuminate\Database\Eloquent\Collection {#2991
     all: [
       App\Rtu {#2976
         id: 71,
       },
     ],
   }

Question is ... why can not just strip and get the '17' ? Why im receiving this big array with a lot of data ? I know that my mysql result is there , but how should I take it? Regards, Leo.

Feb
13
5 months ago
Activity icon

Replied to Laravel And Git

Dear Sinnbeck. I think my post is not very clear. I will try to explain better my goal. I want to use git to sync my remote repo (production) with my local repo (development). Remote and local laravel versions are not equal , I have 6 and 5.8. (can not change this). Is it possible ? How should I proceed creating the repo, clonning and pushing ? Im newby on git and also in laravel. Regards, Leandro.

Feb
12
5 months ago
Activity icon

Started a new Conversation Laravel And Git

Hi guys , I have some issues working with laravel and git. I have an accesible cloud server where I would like to serve mi laravel app. I want to deploy tha app localy and update every change. This is what i did. In the remote server: composer create-project --prefer-dist laravel/laravel pmmc cd pmmc git init git add all git commit -m "first commit"

In my local server I did: git clone ssh://remote/gitrepopath/pmmc cd pmmc. php artisan serve (I got:)

[[email protected] pmmc]# php artisan serve PHP Warning: require(/var/www/html/pmmc/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/pmmc/artisan on line 18 PHP Fatal error: require(): Failed opening required '/var/www/html/pmmc/vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/pmmc/artisan on line 18

What is missing ? it seems I have same folder and content in my remote and my local ... why cant execute php artisan serve? Thanks! Regards.

Jan
15
6 months ago
Activity icon

Started a new Conversation Use Web Or Api Route When Building An Api.

Hi guys, after learning laravel im ready to build my own api. One thing I would like to ask is: Why whould I use api routes if I can also return jsons using web routes ?

Regards; Leandro.

Jan
12
6 months ago
Activity icon

Started a new Conversation Free Domain To Show My Laravel App.

Hi guys, is there some free place where i can upload or create my laravel app. My idea is to be able to show my app to anyone , like a testing enviromoment. Any idea would be wellcoment. Regards. Leandro.

Activity icon

Replied to Can You Recomend Some Ide For Laravel + Vue ?

hi you guys , for your recomendations. I also like vs , but ... it I never could get it working into a remote server. It is very common that you will work and deploy your app in a remote server so it should be easy to setup. Are you using it with remote connection ? btw im on arch linux. Regards.