Giter VIP home page Giter VIP logo

laravel-blog-tutorial's People

Contributors

jacurtis avatar matthiashertel avatar sazzadr avatar waqardm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-blog-tutorial's Issues

Relation between users and comments tables.

I think id is more safe rather than email to reference a user from comments.
email is index, and also id is index. but

        Schema::create('comments', function (Blueprint $table) {
            // ...
            $table->string('email'); // from App\User
            // ...
        });

What if user update email?.

Maybe id is most proper. then just create a user has many comments relation.
to easy also get all data of single user from every comments.

This is I want to say :)

        Schema::create('comments', function (Blueprint $table) {
            // ...
            $table->integer('user_id')->unsigned(); // User model
            // ...
        });

        Schema::table('comments', function ($table){
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
        });

best regards @jacurtis
Thanks for wonderfull playlist :)
๐Ÿ‘

Not posting a new post

I find an erroe exception when creating a new post.

this is the error
ErrorException in Font.php line 78:
Array and string offset access syntax with curly braces is deprecated

Images inside post's body

This new post form is able to upload a single cover image.

I would like to know if you know how to insert multiple images inside the post's body using that text editor or if has another which you recommend (for example this text editor used by github, is possible drag and drop files).

If it's possible, how I should save the images?

Thanks in advanced.

geeting error

PHP Warning: require_once(C:\xampp\htdocs\blog\vendor/composer/autoload_real.ph
p): failed to open stream: No such file or directory in C:\xampp\htdocs\blog\ven
dor\autoload.php on line 5

Warning: require_once(C:\xampp\htdocs\blog\vendor/composer/autoload_real.php): f
ailed to open stream: No such file or directory in C:\xampp\htdocs\blog\vendor\a
utoload.php on line 5
PHP Fatal error: require_once(): Failed opening required 'C:\xampp\htdocs\blog
vendor/composer/autoload_real.php' (include_path='.;C:\xampp\php\PEAR') in C:\xa
mpp\htdocs\blog\vendor\autoload.php on line 5

Fatal error: require_once(): Failed opening required 'C:\xampp\htdocs\blog\vendo
r/composer/autoload_real.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\h
tdocs\blog\vendor\autoload.php on line 5

Why my posts can delete other users?

Hi, Alex,
first of all I can't believe that there are people like you, you are wasting your time to teach others and you are doing it for free. You are awesome, man. I have been learn so much from you and I wish that I can do something more than just say 'thank you'.
I almost went through all yours 'How to Build a Blog with Laravel 5 Series' and I figured out that when some user create post then other users can delete and edit his post. In other words said, all posts of some user appear to other users in their account and there they can delete and edit that posts which means that anyone can delete anyone's post. And I think it should not work that way. Is there some solution for that?
Thank you very much for all, you are amazing!!!

Routes?

Looks like those were excluded

Deleting Post

Deleting post will make an issue of data relation.

Having a issue just after downloading this contact form tutorial app

Ussalaam-Ou-Alaikum And Wishes Curtis, hoping you would be good. I am having a problem after downloading the source code from here : https://github.com/jacurtis/laravel-blog-tutorial/releases/tag/part_40
as i am trying to run : php artisan serve
i am getting this error :
Notice: Constant LARAVEL_START already defined in /Applications/XAMPP/xamppfiles/htdocs/Blog-part-40/bootstrap/autoload.php on line 3
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /Applications/XAMPP/xamppfiles/htdocs/Blog-part-40/bootstrap/autoload.php on line 3

it your Part 40 - Sending Email from Contact Form [How to Build a Blog with Laravel 5 Series]

why i would be getting this error
could you help me out.

Regards
Muhammad Sumair Kaleem
Web Engineer from karachi sindh pakistan west south asia

InvalidArgumentException View [posts.show]

heyy i have been following your video and i have encountered an error......i have followed the exact intructions....
since i am using the new version of laravel....i did not use "Route::group(['middleware' => ['web']], function () {" and only updated my post controller......but it is not displaying me the alert message. could you help me?? this is how my post controller looks

validate($request, array( 'title' => 'required|max:255', 'body' => 'required' )); $post = new Post; $post->title = $request->title; $post->body = $request->body; $post->save(); Session::flash('success', 'The blog is successfully saved!'); return redirect()->route('posts.show', $post->id); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { return view('posts.show'); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }

Edit the validate method in update post

We can edit the validate method in PostController to ignore a given ID during the unique check for slug (instead using if)

    public function update(Request $request, $id)
    {
        // Validate the data
        $post = Post::find($id);
        $this->validate($request, array(
            'title' => 'required|max:255',
            'slug' => [
                'required',
                'alpha_dash',
                'min:5',
                'max:255',
                Rule::unique('posts')->ignore($post->id)
            ],
            'body' => 'required|min:5',
        ));
        

        // Save the data to the database

        $post->title = $request->input('title');
        $post->slug = $request->input('slug');
        $post->body = $request->input('body');
        $post->save();
        // Set flash data with success message
        Session::flash('Success', 'This post was successfully updated.');
        // redirect with flash data to posts.show
        return redirect()->route('posts.show', $post->id);
    }

Blog Comments Date Error

Code is currently

<img src="{{ "https://www.gravatar.com/avatar/" . md5(strtolower(trim($comment->email))) . "?s=50&d=monsterid" }}" class="author-image"> <div class="author-name"> <h4>{{ $comment->name }}</h4> <p class="author-time">{{ date('F nS, Y - g:iA' ,strtotime($comment->created_at)) }}</p> </div>

You have use 'n' which is the numeric representation for month, correct one should be 'd' as noted below:

<img src="{{ "https://www.gravatar.com/avatar/" . md5(strtolower(trim($comment->email))) . "?s=50&d=monsterid" }}" class="author-image"> <div class="author-name"> <h4>{{ $comment->name }}</h4> <p class="author-time">{{ date('F dS, Y - g:iA' ,strtotime($comment->created_at)) }}</p> </div>

How to correctly download the project and add it to my local development folder

Hi @jacurtis ,

Thanks so much for your amazing laravel tutorials! I was wondering if you could help me with a really basic issue that I'm having.

I got stuck at tutorial part 13 and made a mess of the code, but I had been committing everything to github so I wanted to go back to older code after part 12 (which I knew worked perfectly). So I downloaded the zip of my project from my github, and pasted it into my local development folder. But when I go to test the site in my (Chrome) browser, I get this error "Whoops, looks like something went wrong." and the error message "Failed to load resource: the server responded with a status of 500 (Internal Server Error)".

I just tried to instead use the code that you put up from your first commit just after part 13, but I got the same errors.

Here's a description of my issues exactly and what I did: http://stackoverflow.com/questions/38292410/laravel-website-doesnt-run-on-browser-anymore-after-downloading-older-github-co
I'm thinking now that it must be a configuration issue perhaps.

My question is, what's the best way to download your code so I can continue following along with the tutorials, so I don't get the same errors like in that link?

Showing filtered tags by tag name (not id)?

Hey, how do you show the filtered tags by tag name, not id in tags.show?
In the URL it shows ../tags/2/...
I'm wanting to show ../tags/coding/...
what file needs tweaking?

whenever new post is created with no tags errors occur

ErrorException in BelongsToMany.php line 866:
Argument 1 passed to Illuminate\Database\Eloquent\Relations\BelongsToMany::formatSyncList() must be of the type array, null given, called in C:\xampp\htdocs\blog\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\BelongsToMany.php on line 831 and defined

Assign tags to categories?

Just thought of it..
How would you assign tags to categories?
for example, If you had a category named Coding, and wanted tags associated with that category,
and another category named thoughts this week, and have tags associated with that category?
What files would need tweaking?

New post BelongsToMany error

very good job and a great help, thanks
but I found a small error in the code, you may have passed
when you create a new post and leave blank tags or just a tag jumps error
Type error: Argument 1 passed to Illuminate \ Database \ Eloquent \ Relations \ BelongsToMany :: formatSyncList () must be of the type array, null given, called in

Getting Error of non object property when i try to put Category title in Blog.

Hi, I am getting an error of non object property

   @foreach( $posts as $post)
 .....
 ....
        <a href="singlepage.html"><img src="images/2.jpg" class="img-responsive" alt=""/>{{ 
       $post->$category->id}}</a>
.... 
 ....

here is my controller part:

  $posts= Post::paginate(10);

     $categories = Category::all();

     $tags = Tag::all();
     $tags2 = array();
     foreach ($tags as $tag) {
         $tags2[$tag->id] = $tag->name;
     }

return view('blog.index')->withPosts($posts)->withCategory($categories)->withTags($tags2);

}

Where is Vendor Folder ??

There is no vendor folder in your blog project. when i am setting it into my pc it returns a lots of errors.

blog/single.blade.php

Hey Alex,

This isn't an issue so much as an improvement (hopefully). In the file

/resources/views/blog/single.blade.php

you can change the following...

<?php $titleTag = htmlspecialchars($post->title); ?> @section('title', "| $titleTag")
to...

@section('title') | {{ $post->title }} @stop
You will get the same output.

Hope this helps.

Migrate:refresh

I finished project and when I try to do php artisan migrate:refresh I get the message: Call to undefined method Illuminate\Database\Schema\MySqlBuilder::dropForeign()

Change name of variable

in the views.blog.single.blade.php this

<?php $titleTag = htmlspecialchars($post->title); ?>
@section('title', $titleTag)

should be replaced by something like:

<?php $postTitle = htmlspecialchars($post->title); ?>
@section('title', $postTitle)

As the blog uses tags, the tag can be confused with the title of a tag. I didn't make the association with the HTML title tag.

xss

laravel-blog-tutorial/resources/views/blog/single.blade.php
@extends('main')

@section('title', "| $post->title")

@section('content')

    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <h1>{{ $post->title }}</h1>
            <p>{{ $post->body }}</p>
            <hr>
            <p>Posted In: {{ $post->category->name }}</p>
        </div>
    </div>

@endsection

line 3 $post->title is not escaped ... and vulnerable for xss ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.