oziel

oziel

Member Since 3 Months Ago

Adamawa

Web Developer at Jos

Experience Points 480
Experience Level 1

4,520 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.

23 Jun
4 weeks ago

oziel started a new conversation Slow Internet

Am in a place where the ISP provide only 2G internet connection. Is there any device that can boost the networt to 3G or 4G?

09 May
2 months ago

oziel left a reply on Manually Add Value To Request

@JLRDW - Thank. i have solve my problem myself. But give me link to your free videos because am new to laravel.

08 May
2 months ago

oziel left a reply on Manually Add Value To Request

@NAKOV - i did, but the for validation still did'nt see it.

        $user_id = Auth::user()->id;

        $input = $request->all() + ['user_id' => $user_id ];

        $post = $this->postRepository->create($input);

But it work when i store the Auth value as hidden field in the form. which i don't want it that way.

oziel started a new conversation Manually Add Value To Request

It is not adding the Auth value i passed

$user_id = Auth::user()->id;

        $request->request->add(['user_id' => $user_id ]);

        $input = $request->all();
        $post = $this->postRepository->create($input);

        Flash::success('Post saved successfully.');

        return redirect(route('posts.index'));

oziel left a reply on Saving Data To Database

@CRONIX - Am new to laravel pls. i changed it to:

$input = $request->all();
        $input['user_id'] = Auth::user()->user_id;
        $post = $this->postRepository->create($input);

        Flash::success('Post saved successfully.');

        return redirect(route('posts.index'));

this is the new error i got

"Class 'App\Http\Controllers\Auth' not found"

What can i do

oziel started a new conversation Saving Data To Database

i want to store form data and Auth user ID to the database. this seems not to work for me

$input = $request->all()->with('user_id', Auth::user()->user_id);

oziel left a reply on Select Field Autoload LGAs From State

i have seen the problem from my Controller

$lgas = DB::table('lgas')->where('state_id',$request->state_id)->pluck("name","lga_id")->all();

i used $state instead of $lgas

oziel left a reply on Select Field Autoload LGAs From State

@FTIERSCH - corrected. But still not autoloading

$("select[name='lga_id']").html('');

$("select[name='lga_id']").html(data.options);

oziel left a reply on Select Field Autoload LGAs From State

@FTIERSCH - Yes. the JS code is after, just before the closing body tag.

oziel started a new conversation Select Field Autoload LGAs From State

The LGA field is not auto loading after state selection fields.blade.php

<!-- State Id Field -->
<div class="form-group col-sm-6">
    {!! Form::label('state_id', 'State Id:') !!}
    {!! Form::select('state_id',[''=>'--- Select Country ---']+$states,null,['class'=>'form-control']) !!}
     
</div>

<!-- Lga Field -->
<div class="form-group col-sm-6">
    {!! Form::label('lga', 'Lga:') !!}
    {!! Form::select('lga_id',[''=>'--- Select LGA ---'],null,['class'=>'form-control']) !!}
</div>

postController.php

public function create()
    {
        
        $states = DB::table('states')->pluck("name","state_id")->all();
        return view('posts.create', compact('states'));
    }

        /**
     * Show the application selectAjax.
     *
     * @return \Illuminate\Http\Response
     */

    public function selectAjax(Request $request)

    {

        if($request->ajax()){

            $states = DB::table('lgas')->where('state_id',$request->state_id)->pluck("name","lga_id")->all();

            $data = view('posts.ajax-select',compact('lgas'))->render();

            return response()->json(['options'=>$data]);

        }

    }

ajax-select.blade.php

<option>--- Select LGA ---</option>

@if(!empty($lgas))

  @foreach($lgas as $key => $value)

    <option value="{{ $key }}">{{ $value }}</option>

  @endforeach

@endif

route

Route::post('ajax-select', ['as'=>'ajax-select','uses'=>'[email protected]']);

app.blade.php

<!-- this is dropdown for states and lgas -->
<script type="text/javascript">

  $("select[name='state_id']").change(function(){

      var state_id = $(this).val();

      var token = $("input[name='_token']").val();

      $.ajax({

          url: "<?php echo route('ajax-select') ?>",

          method: 'POST',

          data: {state_id:state_id, _token:token},

          success: function(data) {

            $("select[name='lga_id'").html('');

            $("select[name='lga_id'").html(data.options);

          }

      });

  });

</script>
07 May
2 months ago

oziel left a reply on Looking For Wrong Table Column

@NAKOV - WOOOW. Am so grateful. Worked perfectly and beautiful.

oziel started a new conversation Looking For Wrong Table Column

Am having this errors

 ErrorException (E_ERROR)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'states.id' in 'where clause' (SQL: select * from `states` where `states`.`id` = 2 and `states`.`deleted_at` is null limit 1) (View: C:\wamp64\www\groupone\resources\views\posts\show_fields.blade.php) (View: C:\wamp64\www\groupone\resources\views\posts\show_fields.blade.php)

Post Model

public function user()
    {
        return $this->belongsTo('App\Models\User');
    }
    /**
     * Get the user that owns the Post.
     */
    public function state()
    {
        return $this->belongsTo('App\Models\State','state_id');
    }

    public function lga()
    {
        return $this->belongsTo('App\Models\Lga', 'lga_id');
    }

Migration

Schema::create('states', function (Blueprint $table) {
            $table->bigIncrements('state_id');
            $table->string('name');
            $table->timestamps();
            $table->softDeletes()->nullable();
        });
11 Apr
3 months ago

oziel left a reply on Get Data From Database Error.

@STEREOH - Thank you. i have found the problem. from my User Model

hasMany('App\Post')

instead i used hasMany('App\User');

oziel left a reply on Get Data From Database Error.

@STEREOH - Have you Seen?

oziel left a reply on Get Data From Database Error.

this is where i want to display the data

<table class="table table-striped">
                        <tr>
                            <th>Title</th>
                            <th></th>
                            <th></th>
                        </tr>
                        @foreach ($posts as $post)
                            <tr>
                                <td>{{ $post->title }}</td>
                                <td></td>
                                <td><a href="/post/{{ $post->id }}/edit">Edit</a></td>
                            </tr>
                        @endforeach
                    </table>

oziel left a reply on Get Data From Database Error.

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

    public function posts(){
        return $this->hasMany('App\User');
    }
}

oziel started a new conversation Get Data From Database Error.

$user_id = Auth()->user()->id;
        $user = User::find($user_id);
        return view('Dashboard')->with('posts',$user->posts);

i have the following errors

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.user_id' in 'where clause' (SQL: select * from users where users.user_id = 1 and users.user_id is not null)

05 Apr
3 months ago

oziel left a reply on Routing

Thank you all. i have seen my error. the ID and passing has $, which should not.

04 Apr
3 months ago

oziel left a reply on Routing

@FKWOK - thank you. but it is still showing same error.

oziel started a new conversation Routing

Route::get('/users/{$id}', function($id){ return "this is user with an id of ". $id; });

this shows me page 404 not found after something like /users/123