learn-by-flying

learn-by-flying

Member Since 3 Months Ago

Experience Points 1,170
Experience Level 1

3,830 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 9
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.

09 Jul
1 week ago

learn-by-flying started a new conversation Send HTTP Request Through Other Server

I have a very interesting question of possibility regarding sending a HTTP request through a private network and not the public internet. Honestly I have no idea where to start looking for help so I am posting in a few different places.

I have two servers, 1 & 2 with #2 being connected to our corporate VPN but does not publicly face the internet. #1 hosts my laravel application and I need to call a web service which runs on our corporate network.

Is there a way which I can specify when a controller asks for a json request from an internal only address to route through server #2?

Ideally I would not connect #1 to the VPN unless absolutely necessary.

Server #1 is Centos 7 running Plesk Server #2 is Windows 2016

Thanks,

29 May
1 month ago

learn-by-flying left a reply on Where Should Basic Logic Be Placed?

@martinbean & @devfrey thank you very much, I've got plenty to keep going.

learn-by-flying started a new conversation Where Should Basic Logic Be Placed?

Hi Everyone,

Have successfully gotten laravel up and running, published the hello world app and starting to dive deeper into a basic production prototype; however I am at a loss regarding best practice on some simple logic and where to place these items:

-IP Blocking, traditional I would have this within the html header for the page so that users not on a specific IP would be re-directed to another page (normally my "how to connect to the VPN"). Is it best practice or appropriate to place these specific small scripts in a blade file and then call them with the @yield method?

-Is there a way to define some master global variables for the entire framework?

Thanks,

09 May
2 months ago

learn-by-flying left a reply on Two Tables From One Controller

@punksolid,

Thank you very much, I must have missed this and have added laravels default time stamp columns to the table and everything is working.

08 May
2 months ago

learn-by-flying started a new conversation Two Tables From One Controller

Hello everyone, I am brand new to laravel and frameworks in general and have hit a wall in my googlefu and need some assistance with the following.

Background: I am working on my Hello World laravel application and working through the laravel from scratch tutorial on Laracasts and following a laravel from scratch tutorial from YouTube (https://www.youtube.com/watch?v=EU7PRmCpx-0).

I have created a table called Posts, and now I am working on extending the functionality of this table so that each time a user edits a post the prior title and body of the post is saved in the posts_update table.

I have two models (Posts.php & Post_Update.php), and a single PostsController.php, from the edit.blade.php I am utilizing the [email protected] function which looks like this:

public function update(Request $request, $id)
    {
        //Validate the request
        $this->validate ($request, [
            'post_title' => 'required',
            'post_body' => 'required'
            
        ]);
        //Determine the post ID to use
        $post = Post::find($id);
        
        //Create the Post_Update Object
        $post_update = new Post_Update;
        
        //Storing the Post history
        $post_update->user_id = auth()->user()->id;
        $post_update->post_id = $id;
        $post_update->prior_post_title = $post->post_title;
        $post_update->prior_post_body = $post->post_body;
        $post_update->save();        
        
        //Store the edited post in the post table
        $post->post_title = $request->input('post_title');
        $post->post_body = $request->input('post_body');
        $post->save();
        
        //Returning to the post home, with a success message that we have created. The message is telling the index then overriding the default success message. 
        return redirect('/posts')->with('success', 'Post Updated');
    }

and have brought in both models at the top of the PostsController.php:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
//Bring in the model
use App\Post;
//Posts Update model
use App\Post_Update;

class PostsController extends Controller
{

Post_Update.php:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post_Update extends Model
{
    //Table Name - Can be changed if needed. 
    protected $table = 'posts_update';
    
    //Primary Key
    public $primaryKey = 'update_id';
    
    //Create the timestamps
    public $timestamps = true;
}

Posts.php:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    //Table Name - Can be changed if needed. 
    protected $table = 'posts';
    
    //Primary Key
    public $primaryKey = 'id';
    
    //Create the timestamps
    public $timestamps = true;
}

However when I attempt to run the function, I am receiving the following error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into `posts_update` (`user_id`, `post_id`, `prior_post_title`, `prior_post_body`, `updated_at`, `created_at`) values (1, 4, New Post, <p>I am a new post.&nbsp;</p>

<p>&nbsp;</p>

<p><em><strong>Edit, I am the update.&nbsp;</strong></em></p>

<p>&nbsp;</p>

<p><em><strong>Another Update. 123</strong></em></p>

<p>&nbsp;</p>

<p><em><strong>Another update.&nbsp;</strong></em></p>, 2019-05-08 17:34:15, 2019-05-08 17:34:15))

What I cannot understand is that even though I am referencing $post_update-> calls the function is attempting to write to the columns updated_at and created_at even through they are not called out.

My questions are:

Can I use this approach to write to two tables?

Is there a better method than the one I am using once I have resolved the errors?

I have explored trying to run two functions from one form however that is not allowed.

Thanks very much for your assistance.