michaelabraham

michaelabraham

Member Since 3 Weeks Ago

Experience Points 220
Experience Level 1

4,780 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 0
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.

13 Jul
1 week ago

michaelabraham left a reply on How To Add An Image Upload In The Form In Laravel

hey, sorry i replied your answer to long i was busy doing my other assignment, btw i really apreciate your answer @dry7 , so i tried that but it showed an error

FatalErrorException

Call to a member function store() on null

should i make a correct folder first ?

08 Jul
2 weeks ago

michaelabraham started a new conversation How To Add An Image Upload In The Form In Laravel

So i already made a form that upload a title and a content(in text editor) in laravel to a database, how do i include an image upload before content in the form to be posted in the same table in database and show it in the view, i know in ck editor you can also upload image, but i also want to edit how the image is shown for other view, i have made and additional column in the table called thumbnail, and routes for the image upload function but i haven't made the method function

this is my controller BlogController.php for the form and view

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Blog;

class BlogController extends Controller
{
    public function index()
    {
        $blogs = Blog::get();
        return view('post.post_textarea',[
            'blogs' => $blogs
        ]);
    }

    public function store(Request $request)
    {
        Blog::create([
            'name' => $request->name,
            'message' => $request->message
        ]);
        return redirect()->back();
    }

    public function getFullPost($blog_id) {
    $blogs = Blog::where('id', '=', $blog_id)->get();
    return view('post.read')->with(compact('blogs'));
    }
}

this is the view for the from post_textarea.blade.php

<section class="games-single-page">
        <div class="container">

            <div class="card">
                <div class="card-body">
                    <form enctype="multipart/form-data" method="POST">
                        {{csrf_field()}}
                        <div class="form-group">
                            <label style="color: black;" >Judul</label>
                            <input type="text" class="form-control" name="name">
                        </div>
                        <div class="form-group">
                            <label style="color: black;" >Thumbnail</label>
                            <br>
                            <input type="file" name="select_file">
                        </div>
                        <div class="form-group">
                            <label style="color: black;" >Isi</label>
                            <br>
                                <textarea class="form-control" name="message" id="" rows="10"></textarea>
                        </div>
                        <div class="form-group">
                            <button class="pull-right site-btn" type="submit" >Upload<img src="../public/asset/img/icons/double-arrow.png" alt="#"/></button>
                        </div>                     
                    </form>
                </div>
            </div>
        </div>
    </section>

this is the view for the full post read.blade.php

<section class="games-single-page">
        <div class="container">
            <div class="row">
                <div class="col-xl-9 col-lg-8 col-md-7 game-single-content">
                    @foreach ($blogs as $blog)
                    <div class="gs-meta">{{ Carbon\Carbon::parse($blog->created_at)->format('d-m-Y')  }} /  di <a href="">Games</a></div>
                    <h2 class="gs-title">{{ $blog->name }}</h2>
                    <p>{!! $blog->message !!}</p>
                    @endforeach
                </div>
            </div>
        </div>
    </section>

this is the model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Blog extends Model
{
    protected $fillable = ['name','thumbnail','message'];
}

and this is the routes

Route::get('/posting','[email protected]')->name('blog');
Route::post('/posting','[email protected]')->name('blog.store');
Route::post('/profile','[email protected]')->name('blog.thumb');
Route::post('/posting','[email protected]')->name('blog.store');
04 Jul
2 weeks ago

michaelabraham left a reply on Laravel How To Make Multiple Autocomplete Form From Two Diferent Tables?

ouw so that's how ot works, thanks a lot @mstrauss, now i know how to make the other fields and tables

michaelabraham started a new conversation Laravel How To Make Multiple Autocomplete Form From Two Diferent Tables?

So i was trying to make a form with multiple fields, and each field has an autocomplete that was fetched from a table in database, but each field has a different autocomplete suggestion beacause it's from different tables.

i was following a tutorial that only show me how to make a single autocomplete field from a single database. but i am stuck when i try to make a second field it shows the data from a different table but when i clicked it it chose the same suggestion to the other field automaticaly, and when i try to change the others when i clicked it the other are filling the same value automaticaly

this is my AutocompleteController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;

class AutocompleteController extends Controller
{
    //for create controller - php artisan make:controller AutocompleteController

    function index()
    {
     return view('autocomplete');
    }

    function fetchcpu(Request $request)
    {
     if($request->get('query'))
     {
      $query = $request->get('query');
      $data = DB::table('cpu')
        ->where('name', 'LIKE', "%{$query}%")
        ->get();
      $output = '<ul class="dropdown-menu" style="display:block; position:relative">';
      foreach($data as $row)
      {
       $output .= '
       <li><a href="#">'.$row->name.'</a></li>
       ';
      }
      $output .= '</ul>';
      echo $output;
     }
    }

    function fetchvga(Request $request)
    {
     if($request->get('query'))
     {
      $query = $request->get('query');
      $data = DB::table('vga')
        ->where('namevga', 'LIKE', "%{$query}%")
        ->get();
      $output = '<ul class="dropdown-menu" style="display:block; position:relative">';
      foreach($data as $row)
      {
       $output .= '
       <li><a href="#">'.$row->namevga.'</a></li>
       ';
      }
      $output .= '</ul>';
      echo $output;
     }
    }

}

this is my view

@extends('layouts.master')
@section('content')
    <!-- Page top section -->
    <section class="page-top-section set-bg" data-setbg="../public/asset/img/page-top-bg/2.jpg">
        <div class="page-info">
            <h2>Spesifikasi Sistem</h2>
            <div class="site-breadcrumb">
                <a href="">Tentang</a>  /
                <span>Spesifikasi Sistem</span>
            </div>
        </div>
    </section>
    <!-- Page top end-->
<!DOCTYPE html>
<html>
 <head>
  <title>Ajax Autocomplete Textbox in Laravel using JQuery</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <section class="contact-page">
        <div class="container">  
            <div class="form-group">
                <label style="color: white">CPU :</label>
                <input type="text" name="name" id="name" class="form-control input-lg" placeholder="Masukan Tipe CPU" />
                    <div id="cpuList"></div>
                <label style="color: white">VGA :</label>
              <input type="text" name="namevga" id="namevga" class="form-control input-lg" placeholder="Masukan Tipe CPU" />
                <div id="vgaList"></div>
            </div>
            {{ csrf_field() }}
        </div>
    </section>


<script>
$(document).ready(function(){

 $('#name').keyup(function(){ 
        var query = $(this).val();
        if(query != '')
        {
         var _token = $('input[name="_token"]').val();
         $.ajax({
          url:"{{ route('autocomplete.fetchcpu') }}",
          method:"POST",
          data:{query:query, _token:_token},
          success:function(data){
           $('#cpuList').fadeIn();  
                    $('#cpuList').html(data);
          }
         });
        }
    });

$('#namevga').keyup(function(){ 
        var query = $(this).val();
        if(query != '')
        {
         var _token = $('input[name="_token"]').val();
         $.ajax({
          url:"{{ route('autocomplete.fetchvga') }}",
          method:"POST",
          data:{query:query, _token:_token},
          success:function(data){
           $('#vgaList').fadeIn();  
                    $('#vgaList').html(data);
          }
         });
        }
    });


    $(document).on('click', 'li', function(){  
        $('#name').val($(this).text());  
        $('#cpuList').fadeOut();  
        $('#namevga').val($(this).text());  
        $('#vgaList').fadeOut();  

    });  

});
</script>

@endsection

and this is my routes

Route::get('/autocomplete','[email protected]');
Route::post('/autocomplete/fetchcpu','[email protected]')->name('autocomplete.fetchcpu');
Route::post('/autocomplete/fetchvga','[email protected]')->name('autocomplete.fetchvga');
29 Jun
3 weeks ago

michaelabraham started a new conversation ErrorException Undefined Variable: Blogs

Soi was trying to display data from a database in a view from controller and model, i have already made a proper method that define the variable, and the variable that i try to display in the view is already in @foreach statement but ,it still shows the same error in the $blogs line in my view this is my view post_textarea.blade.php

@extends('layouts.master')
@section('content')
    <section class="games-single-page">
        <div class="container">
            @foreach ($blogs as $blog)

                    <h3 style="color: white;">{{ $blog->name }}</h3>
                    <h3>{!! $blog->message !!}</h3>

            @endforeach
            <div class="card">
                <div class="card-body">
                    <form action="" method="POST">
                        {{csrf_field()}}
                        <div class="form-group">
                            <label style="color: black;" >Judul</label>
                            <input type="text" class="form-control" name="name">
                        </div>
                        <div class="form-group">
                            <label style="color: black;" >Your Input</label>
                            <br>
                                <textarea class="form-control" name="message" id="" rows="10"></textarea>
                        </div>
                        <div class="form-group">
                            <input type="submit" class="btn btn-primary" value"Send">  
                        </div>                     
                    </form>
                </div>
            </div>
        </div>
    </section>
@endsection

this is my controller BlogController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Blog;

class BlogController extends Controller
{
    public function index()
    {
        $blogs = Blog::get();
        return view('post.post_textarea',[
            'blogs' => $blogs
        ]);
    }

    public function store(Request $request)
    {
        Blog::create([
            'name' => $request->name,
            'message' => $request->message
        ]);
        return redirect()->back();
    }
}

and this is my routes

    Route::get('/posting','[email protected]')->name('blog');
Route::post('/posting','[email protected]')->name('blog.store');