aondoe

aondoe

Marietta, GA

Member Since 7 Months Ago

Experience Points 550
Experience
Level
Lessons Completed 2
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

26 Sep
2 months ago

aondoe left a reply on Files Don't Upload To The

Thanks for your tips. I forgot to remove one of the validation rules. I will read the link you posted thanks.

aondoe started a new conversation Files Don't Upload To The

Hello. I'm trying to upload files into the public folder. I've already created a link to the storage folder using artisan. But for some reason, the file title uploads to the MySQL field. Has anyone else experienced this?

The main code is in the if-statement near the bottom of the code.

Here is my Controller

    public function store(Request $request){
                request()->validate([
                    'title' => 'required|min:2',
                    'subject' => 'required|min:4',
                    'content' => 'required|min:50',
                    'featured_img' => 'sometimes|image'
                ]);

                $this->validate($request, [
                    'title'=>'required|min:3',
                    'content'=>'required|min:10',
                    'featured_image' => 'sometimes|image'
                ]);
                
                PostIt::create(['title'=>$request->title,
                                'content'=>$request->content,
                                'featured_img' => $request->featured_img
                ]);

                if ($request->hasFile('featured_img')){
                    

                    $path = $request->file('featured_img');
                    // $fileName=$featured_img->getClientOriginalExtension();
                    $image->move(base_path('/images'), $fileName);
                    $post->update(array_merge($request->all(), ['featured_img' => $path]));
                    
                    return "Here is the path: ".$path;
                }
                return redirect()->route('posts.index');
}

Here is my form which contains the upload field

<form onsubmit="return confirm('Are you sure you want to edit the post {{$post->title}}?')" action="{{route('posts.update', $post->id)}}" method="POST" type="multipart/form-data">
                    @method('put')
                    @csrf
            <div class="form-group">
                        <label for="title" >Title</label>
                        <input type="text" name="title" id="title" class="form-control" value="{{$post->title}}">
            </div>
        <div class="form-group">
                    <h2>Your current subject is {{$post->subject}}</h2>
            </div>
            
        <div class="form-group">
                <input type="file" name="featured_img">{{$post->featured_img}}
        </div>

Any help would be great. Thanks

16 Sep
2 months ago

aondoe left a reply on File Upload Not Working

Hey you guys are awesome. This framework is awesome, and I'm working constantly to get better. I finally got it to work. My $fillable in my model didn't match the column I was trying to upload to. So now I'm able to upload finally! Thank you all.

aondoe left a reply on File Upload Not Working

Hey tykus thanks for your prompt response and assist, but I'm getting a

"Call to a member function store() on null" error, on this line:

 $path = $request->file('featured_img')->store(public_path());
       

I suspect the request isn't to the proper file. I'm not sure actually. But I thank you for your help. I will keep working at it.

aondoe left a reply on File Upload Not Working

Hey tykus. No I was following online examples, and I just wanted it to be stored inside the storage/app/public/ directory

aondoe left a reply on File Upload Not Working

Hey guys thanks for your responses. I omitted the @csrf token from my form above. I actually include that right below the tag.

    public function update(Request $request, PostIt $post)
    {
        //The code below will update the post/record in the database.
        request()->validate([
                    'title' => 'required|min:2',
                      'content' => 'required|min:50',

                  ]);
                  
        $post->update($request->all());

        session()->flash('message', 'Your post has been created successfully');
        return redirect()->back();
    }

Here's the code from the controller:

namespace App;

use Illuminate\Database\Eloquent\Model;

class PostIt extends Model
{

    protected $fillable=['title','content', 'subject','featured_image'];

    protected $guarded=[];//For guarded data if needed


    //
}

aondoe started a new conversation File Upload Not Working

Hello everyone.

I'm having trouble with file upload in laravel 5.6 I'm trying to upload images to my CMS I've created with Laravel.

I have a table called "post_its" below:

    public function up()
    {
        Schema::create('post_its', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->text('content');
            $table->text('subject');
            $table->text('featured_img');
            $table->timestamps();
        });
    }

I had to add a column in the table to upload images so I did so like below:

    public function up()
    {
        Schema::table('post_its', function(Blueprint $table)
        {   
            //add a column to the post_its table and give it 100 characters. Also specify 100 characters
            $table->string('featured_img', 100)->nullable();
        });
    }

Here's my form data I'm trying to fix, as you can see below:

<form action="{{route('posts.update', $post->id)}}" method="POST" type="multipart/form-data">
<!--other form fields are here as well, but omitted for brevity-->
        <div class="form-group">
                <input type="file" name="featured_img" title="Featured image">
                
        </div>
</form>

Every other field works and updates the database table, but not this upload field. All the fields under the featured_img column says null. I was hoping after I added this column I could edit this column. Any suggestions?

12 Jul
4 months ago

aondoe left a reply on I'm Trying To Modify My AuthServiceProvider.php File, I Get An Error "Call To Undefined Method Illuminate\Support\Facades\Gate::define()". Anyone Else Having This Trouble?

Please dis regard this question. I didn't use the correct path. Instead of the path listed in my code above I should've typed:

use Illuminate\Contracts\Auth\Access\Gate as GateContract;

instead of: Illuminate\Support\Facades\Gate

27 May
6 months ago

aondoe left a reply on Laravel 5.6.9 : Php Artisan Migrate - Problem

Thank you takdw your solution worked for me.

15 May
6 months ago

aondoe left a reply on File Assets/css/laravel.css Not Defined In Asset Manifest

Hey bobbybouwmann. Thank for your help. I tried to run the commands but they didn't work at first. I got this weird node error.

So I uninstalled nodejs and npm.

After that, I recreated the project and tried your commands and everything worked fine. Thanks a lot.

aondoe left a reply on Where Are You All From?

In Atlanta, GA by way of West Africa

aondoe started a new conversation File Assets/css/laravel.css Not Defined In Asset Manifest

When I try to click on 'register'(register.blade.php) I get this error message:

'File assets/css/laravel.css not defined in asset manifest'

When I click the login page on public/index.php I get this message: 'View [layouts.app] not found'

When I followed the path: assets/css/laravel.css

I realize I'm missing the CSS directory in my assets folder.

Has anyone else had these issues?

Thank you for your help in advance.