jet

jet

Member Since 5 Months Ago

Experience Points 2,800
Experience Level 1

2,200 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 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.

06 Feb
2 weeks ago

jet left a reply on Display Image In Vue.js

@MAVERICKCHAN - thanks for this answer

jet started a new conversation How Can I Display An Image In The Browser From A Laravel API Using Vuejs

pls help, I have done this propertycomponent.vue

                    <div class="card-header">Property Component</div> 
                      <div v-for="(property, i) in properties" :key="i">
                        <div class="row">
                        
                           <div class="col-md-6">
                               <img :src="property.image"/>
                           </div> 
                            <div class="col-md-3">
                             <p class="load">Type: {{property.type}}</p>
                           </div> 
                           <div class="col-md-3">
                             <p class="load">Purpose: {{property.purpose}}</p>      
                           </div>                   
                       
                       </div>
                   </div>
                </div>
            </div>
        </div>
    </div>
  </div>
</template>

<script>
  export default{

      data () {
        return { 
         property:[],
            properties:{
              id:'',
              category_id:'',
                type:'',
                image:'',
                purpose:'',
                description:'',
                country:'',
                region:'',
                city:'',
                lon_lat:'',
                status:'',
                slug:'',
                      }
               }
            },

the images are been storged in public/imgafte createing them.

04 Feb
2 weeks ago

jet started a new conversation How Can I Make This Api To Display In The Browser

propertyComponent

<template>
      <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card card-default">
                    <div class="card-header">Property Component</div> 
                      <div v-for="(property, i) in properties" :key="i">
                         <p> {{property.category_id}}</p>
                      </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
  export default{

      data () {
        return { 
         properties:[],
            property:{
              id:'',
              category_id:'',
                type:'',
                image:'',
                purpose:'',
                description:'',
                country:'',
                region:'',
                city:'',
                lon_lat:'',
                status:'',
                slug:'',
                      }
               }
            },


  created: function() {
      this.fetchSomething()
       },


       methods:{

      fetchSomething() {
              axios.get('/api/property')
        .then(function (response) {
          console.log(response);
        })
        .catch(function (error) {
          console.log(error);
        });
             console.log('this an api');
             }
        }
    }
    
</script>

api/property

{"properties":[{"id":13,"category_id":"Iola Hayes","type":"Room","image":"1549011515.png","purpose":"Rent","description":"Ut velit dicta sed s","country":"Antarctica","region":"Dolores et qui dolor","city":"Ab sed voluptatibus","lon_lat":"Quam dolore sint asp","status":"Unsell","slug":"","user_id":"1","created_at":"2019-02-01 08:58:35","updated_at":"2019-02-02 19:23:06"}]}

please i need help

01 Feb
2 weeks ago

jet left a reply on How Can I Create Am Api From This. With Out It Routing Back To The Login Page

@AURAWINDSURFING - thanks for the help but I'm still getting redirected to the login page after doing this api.php

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['middleware' => ['secure.api']], function () {

        Route::get('property', '[email protected]');
});


Route::post('reset/password', '[email protected]');

web.php

Route::resource('/properties', 'PropertyController')->except('propertyjson');

propertyController


    public function propertyjson()
    {
      
            $properties = Property::all();
             return  ['properties' => $properties];
            // return PropertyResource::collection($properties);
    }

        public function index()
    {
            $properties = Property::orderBy('id', 'asc')->paginate(20);

             return view('properties.index', ['properties' => $properties]);
    }

    ```
31 Jan
2 weeks ago

jet started a new conversation How Can I Create Am Api From This. With Out It Routing Back To The Login Page

please anyone help I'm trying to create an API for properties

api.php

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['middleware' => ['secure.api']], function () {

    

        Route::group(['prefix' =>'properties'],function () {
        Route::get('', '[email protected]');
        Route::get('{id}', '[email protected]');
        Route::post('', '[email protected]');
        Route::put('{id}', '[email protected]');
        Route::delete('{id}', '[email protected]');

    });


});

wap.php


Route::get('/login', '[email protected]')->name('login');
Route::get('/register', '[email protected]')->name('register');
Route::get('/reset-password/email', '[email protected]');
Route::get('/reset-password/password', '[email protected]');
Route::post('/auth/register', '[email protected]');
Route::post('/auth/login', '[email protected]');
Route::post('/auth/logout', '[email protected]');

Route::get('/account', '[email protected]')->name('account')->middleware('role:admin'); 
Route::get('/profile', '[email protected]');

Route::resource('posts', 'PostsController');
Route::resource('categories', 'CategoryController');
Route::resource('properties', 'PropertyController');
Route::resource('property-categories', 'PropertyCategoryController');


Route::get('/account', '[email protected]');
Route::get('/personal-information', '[email protected]');

Route::get('/users', '[email protected]');
Route::get('/user/{id}', '[email protected]');

Route::post('reset/password', '[email protected]');
28 Jan
3 weeks ago

jet left a reply on General Error: 1364 Field 'type' Doesn't Have A Default Value

@SNAPEY - property model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Property extends Model
{
     protected $fillable = ['purpose', 'description','type', 'image', 'category_id', 'country', 'status', 'lon_lat', 'city', 'region', 'slug ', 'user_id'];

     public function propertycategory(){
        return $this->belongsTo('App\Propertycategory');
    }
}

jet left a reply on General Error: 1364 Field 'type' Doesn't Have A Default Value

@SNAPEY - i have a question for u about slugs i have dodone this

{

        $data = $request->input();
        unset($data['_token']);
         $data['user_id'] = Auth::id();
         $data['slug'] = str_start('this/string', '/');
        $properties = new Property;

but i still have this errorGeneral error: 1364 Field 'slug' doesn't have a default value what can i do to make it work

jet left a reply on General Error: 1364 Field 'type' Doesn't Have A Default Value

@SNAPEY - yes, just that i had some other things change that's why.thanks for helping me

jet started a new conversation General Error: 1364 Field 'type' Doesn't Have A Default Value

how can i do to make it have a default value create.blade.php

        <div class=" col-md-6 form-group">
          <label for="type">Type</label>
          <select type="text" name="type" placeholder="type" class="form-control" value="{{$property->type}}">
              <option>House</option>
              <option>Room</option>
              <option>Land</option>
              <option>Studio</option>
              <option>Apartment</option>
          </select>
        </div> 

propertyController

    public function store(Request $request)
    {

        $data = $request->input();
        unset($data['_token']);
         $data['user_id'] = Auth::id();
         $data['slug'] = str_start('this/string', '/');
        $properties = new Property;

         if(Property::create($data)) {
             $data = $request->all();
            Session::flash('success', 'sucessfully save!');
            return redirect('/properties');
        } else {
            return 'there was an error';
        }


        if($request->hasFile('image')){
            $image = $request->file('image');
            $filename = time() . '.' . $image->getClientOriginalExtension();
            $location = public_path('img/' . $filename);
            Image::make($image)->resize(300, 300)->save($location );
            $properties->image = $filename;
        }

        $properties->save();

        Session::flash('success', 'sucessfully save!');

        return redirect()->route('properties.index');
    }

jet started a new conversation Creating Default Object From Empty Value

pls help

    public function store(Request $request)
    {

        $data = $request->input();
        unset($data['_token']);
         $data['user_id'] = Auth::id();
         $data['slug'] = str_start('this/string', '/');
            if($request->hasFile('image')){
                        $image = $request->file('image');
                        $filename = time() . '.' . $image->getClientOriginalExtension();
                        $location = public_path('img/' . $filename);
                        Image::make($image)->resize(300, 300)->save($location );
                        $properties->image = $filename;
                    }
        $properties = new Property;

        $properties->category_id = $request->category_id;
        $properties->purpose = $request->purpose;
        //$properties->image = $request->image;
        $properties->type = $request->type;
        $properties->description = $request->description;
        $properties->country = $request->country;
        $properties->region = $request->region;
        $properties->city = $request->city;
        $properties->lon_lat = $request->lon_lat;
        $properties->status = $request->status;

        $properties->save();

        Session::flash('success', 'sucessfully save!');

        return redirect()->route('properties.index');
    }
26 Jan
3 weeks ago

jet left a reply on Trying To Get Property 'name' Of Non-object

@SNAPEY - the error is coming from the index,blade.php on this line <td>{{ substr($property->category->name, 0, 50)}}{{ strlen($property->category->name) > 50 ? "..." : "" }} </td> that is giving this errorTrying to get property 'name' of non-object

jet started a new conversation Trying To Get Property 'name' Of Non-object

pls help propertiescontroller

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;
use App\Propertycategory;
use App\Property;
use Session;


class PropertiesController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
     public function __construct()
     {
         $this->middleware('auth');
     }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */

    public function index()
    {
      
            $properties = Property::where('type', 'property')->orderBy('id', 'asc')->paginate(20);

        return view('properties.index', ['properties' => $properties]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {

        $properties = new Property();

          $pcategories = Propertycategory::all();
            return view('properties.create', [
                'categories' => $pcategories,
                'property' => $properties,
            ]);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {

        $data = $request->input();
        unset($data['_token']);
         $data['user_id'] = Auth::id();

        $this->validate($request, array(
                'categories_id' => 'required|max:255',
                'purpose' => 'required|max:255',
                'description' => 'required|max:255',
                'country' => 'required|max:255',
                'region' => 'required|max:255',
                'city' => 'required|max:255',
                'lon_lat' => 'required|max:255',
                'status' => 'required|max:255',
        ));

        $properties = new Property;

        $properties->category_id = $request->category_id;
        $properties->purpose = $request->purpose;
        $properties->description = $request->description;
        $properties->country = $request->country;
        $properties->region = $request->region;
        $properties->city = $request->city;
        $properties->lon_lat = $request->lon_lat;
        $properties->status = $request->status;
        $properties->type = $request->has('t') ? 'page' : 'property';

        $properties->save();

        Session::flash('success', 'sucessfully save!');

        return redirect()->route('properties.index');
    }
create.blade.php

@if(!!$property->id) @else @endif {{ csrf_field() }}

Category Uncategorized @foreach($categories as $category)
25 Jan
3 weeks ago

jet started a new conversation Undefined Variable: Property

show.blade.php

    <div class="row">
        <div class="col-md-8">
            <h1>{{ $property->title }}</h1>
            <p class="lead">{{ $property->post }}</p>
        </div>

the propertiescontroller

    public function show($id)
    {
        $properties = Property::find($id);
        return view('properties.show')->withProperties($properties);
    }

jet left a reply on SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'post' Cannot Be Null

@MANELGAVALDA - yes but i don't want to use a default value, i want to use the data that is been filled in through the form, how can i do that?

jet started a new conversation SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'post' Cannot Be Null

propertiesController

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;
//use App\Category;
use App\Property;
use Session;


class PropertiesController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    // public function __construct()
    // {
    //     $this->middleware('auth');
    // }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */

    public function index()
    {
        if (request()->has('t') && request()->t == 'p') {
            $properties = Property::where('type', 'page')->orderBy('id', 'asc')->paginate(20);
            $view = 'page';
        }
        else {
            $properties = Property::where('type', 'property')->orderBy('id', 'asc')->paginate(20);
            $view ='propert';
        }

        return view('properties.index', ['properties' => $properties, 'view' => $view ]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {

        $view = request()->has('t') && request()->t == 'p' ? 'page' : 'property';

        $properties = new Property();

        if($view === 'property') {
         // $categories = Category::all();
            return view('properties.create', [
                // 'categories' => $categories,
                'property' => $properties,
                'view' => $view
            ]);
        }
        else {
            $parents = Property::where('type', 'page')
                ->where('parent', 0)
                ->get();
            return view('properties.create', [
                'parents' => $parents,
                'property' => $properties,
                'view' => $view
            ]);
        }



    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {

        $data = $request->input();
        unset($data['_token']);
        // $data['user_id'] = Auth::id();

        $this->validate($request, array(
                'title' => 'required|max:255',
                //'post' => 'required|max:255',
        ));

        $properties = new Property;

        $properties->title = $request->title;
        $properties->post = $request->post;
         $properties->type = $request->has('t') ? 'page' : 'property';
        // $post->category_id = $request->category_id;



        $properties->save();

        Session::flash('success', 'sucessfully save!');

        return $request->has('t') ? redirect()->route('properties.index',  't=p') : redirect()->route('properties.index');
    }
24 Jan
3 weeks ago

jet started a new conversation Class 'App\Http\Controllers\Properties' Not Found

pis help

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Auth;
use App\Propaties;
use Session;


class PropertiesController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $property = Properties::all()->toArray();
        
        return view('properties.index', compact('property'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        
        return view('crud.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
               $property = new Propaties([
          'title' => $request->get('title'),
          'post' => $request->get('post')
        ]);

        $property->save();
        return redirect('/crud');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $property = Propaties::find($id);
        
        return view('property.edit', compact('property','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)
    {
         $property = Properties::find($id);
        $property->title = $request->get('title');
        $property->post = $request->get('post');
        $property->save();
        return redirect('/crud');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
                $property = Crud::find($id);
      $property->delete();

      return redirect('/crud');
    }
}
22 Jan
4 weeks ago

jet left a reply on Trying To Get Property 'name' Of Non-object

@CIPSAS - thanks, but i have a similar problem with the show.blade.php

<div class="row">
        <div class="col-md-8">
            <h1>{{ $post->title }}</h1>
            <h4>{{ $post->order }}</h4>
             <h4>{{ $post->category->name }}</h4> 
            <p class="lead">{{ $post->content }}</p>
            <h4>{{ $post->status }}</h4>
        </div>

        <div class="col-md-4">
            <div class="well">

                <dl class="dl-horizontal">
                    <lable>Category:</lable>
                    <p>{{ $post->category->name }}</p>
                </dl> 

jet started a new conversation Trying To Get Property 'name' Of Non-object

pls help me index.blade.php

@extends('layouts.admin')

@section('title', '| All Posts')

@section('content')
    <div class="row">
        <div class="col-md-10">
            <h3>All {{$view}}s</h3>
        </div>
        <div class="col-md-2">
            @if($view === 'post')
                <a href=" {{ route('posts.create') }}" class="btn btn-md btn-block btn-info btn-h1-spacing">Create Posts</a>
            @else
                <a href=" {{ url('posts/create?t=p') }}" class="btn btn-md btn-block btn-info btn-h1-spacing">Create Posts</a>
            @endif

        </div>
        <div class="col-md-12">
            <hr>
        </div>
    </div><!--end of row-->

    <div class="row">
        <div class="col-md-12">
            <table class="table">
                <thead>
                    <th>#</th>
                    <th>Title</th>
                    <th>Order</th>

                    @if($view === 'post')
                        <th>Category</th>
                    @endif
 
                    <th>Content</th>
                    <th>Status</th>
                    <th>..</th>
                </thead>

                <tbody>

                    @foreach ($posts as $post)
                        <tr>
                            <th>{{ $post->id }}
                            </th>
                            <td>{{ substr($post->title, 0, 50)}}{{ strlen($post->title ) > 50 ? "..." : ""  }}
                            </td>
                            <td>{{ substr($post->order, 0, 50)}}{{ strlen($post->order) > 50 ? "..." : "" }}
                            </td>

                            @if($view === 'post')
                                <td>{{ substr($post->category->name, 0, 50)}}{{ strlen($post->category->name) > 50 ? "..." : "" }}
                                </td>
                            @endif 

                            <td>{{ substr($post->content, 0, 50)}}{{ strlen($post->content) > 50 ? "..." : "" }}
                            </td>
                            <td>{{ substr($post->status, 0, 50)}}{{ strlen($post->status) > 50 ? "..." : "" }}
                            </td>
                            <td>
                                <a href="{{ route('posts.show', $post->id) }}" class="btn btn-info btn-sm">View</a>

                                @if($view === 'post')
                                    <a href="{{ route('posts.edit', $post->id) }}" class="btn btn-default btn-sm">Edit</a>
                                @else
                                    <a href="{{ url('posts/'.$post->id.'/edit?t=p') }}" class="btn btn-default btn-sm">Edit</a>
                                @endif


                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>

            <div class="text-center">
               {{ $posts->links() }}
            </div>

        </div>
    </div>
@stop

postController

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;
use App\Post;
use App\Category;
use Session;


class PostsController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */

    public function index()
    {
        if (request()->has('t') && request()->t == 'p') {
            $posts = Post::where('type', 'page')->orderBy('id', 'asc')->paginate(20);
            $view = 'page';
        }
        else {
            $posts = Post::where('type', 'post')->orderBy('id', 'asc')->paginate(20);
            $view ='post';
        }

        return view('posts.index', ['posts' => $posts, 'view' => $view ]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {

        $view = request()->has('t') && request()->t == 'p' ? 'page' : 'post';

        $post = new Post();

        if($view === 'post') {
         $categories = Category::all();
            return view('posts.create', [
                'categories' => $categories,
                'post' => $post,
                'view' => $view
            ]);
        }
        else {
            $parents = Post::where('type', 'page')
                ->where('parent', 0)
                ->get();
            return view('posts.create', [
                'parents' => $parents,
                'post' => $post,
                'view' => $view
            ]);
        }



    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {

        $data = $request->input();
        unset($data['_token']);
        $data['user_id'] = Auth::id();

        $this->validate($request, array(
                'title' => 'required|max:255',
        ));

        $post = new Post;

        $post->title = $request->title;
        $post->category_id = $request->category_id;
        $post->content = $request->content;
        $post->order = $request->order;
        $post->type = $request->has('t') ? 'page' : 'post';
        $post->status = $request->status;
        $post->slug  = str_slug($request->title);
        $post->meta = $request->meta;


        $post->save();

        Session::flash('success', 'sucessfully save!');

        return $request->has('t') ? redirect()->route('posts.index',  't=p') : redirect()->route('posts.index');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $post = Post::find($id);
        return view('posts.show')->withPost($post);
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $view = request()->has('t') && request()->t == 'p' ? 'page' : 'post';

        $post = Post::findOrFail($id);

        if($view === 'post') {
             $categories = Category::all();
            return view('posts.create', [
                'categories' => $categories,
                'post' => $post,
                'view' => $view
            ]);
        }
        else {
            $parents = Post::where('type', 'page')
                ->where('parent', 0)
                ->where('id', '!=', $id)
                ->get();
            return view('posts.create', [
                'parents' => $parents,
                'post' => $post,
                'view' => $view
            ]);
        }

    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {

        $data = $request->input();
        unset($data['_token']);
        unset($data['_method']);
        $data['user_id'] = Auth::user()->id;

         $this->validate($request, array(
                'title' => 'required|max:255'
        ));

         $post = Post::find($id);

        $post->title = $request->input('title');
        $post->content = $request->input('content');
        $post->order = $request->input('order');
        $post->views = $request->input('views');
        $post->status = $request->input('status');
        $post->slug  = str_slug($request->input('title'));
        $post->meta = $request->input('meta');

        $post->save();

        Session::flash('success', 'This post was successfully updated');

        return $request->has('t') ? redirect()->route('posts.index',  't=p') : redirect()->route('posts.index');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
         $post = Post::find($id);

        $post->delete();

        Session::flash('success', 'The post was sucessfully deleted.');
        return redirect()->route('posts.index');
    }
}
17 Jan
1 month ago

jet left a reply on Prop 'options' Requires Default Value To Be Set

@REALRANDYALLEN - i had this error after doing this Invalid prop: type check failed for prop "placeholder". Expected String with value "[object Object]", got Object

        props: {
            options: {
                type: [Array, Object],
                default: function () {
                  return {  }
                } 
            },
            selected: {
              type: [Array, Object],
              default: function () {
                  return {  }
                } 
            },
            placeholder:{ 
              type: [String],
               default: function () {
                  return {  }
                } 
            }
        },

jet started a new conversation Prop 'options' Requires Default Value To Be Set

please can any one help with that problem

<template>
    <div class="btn-group">
        <li @click="toggleMenu()" class="dropdown-toggle" v-if="selectedOption.name !== undefined">
          {{ selectedOption.name }}
          <span class="caret"></span>
        </li>

        <li @click="toggleMenu()" class="dropdown-toggle" v-if="selectedOption.name === undefined">
          {{placeholderText}}
          <span class="caret"></span>
        </li>

        <ul class="dropdown-menu" v-if="showMenu">
            <li v-for="(option,i) in options" :key="i">
                <a href="javascript:void(0)" @click="updateOption(option)">
                    {{ option.name }}
                </a>
            </li>
        </ul>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                selectedOption: {
                  name: '',
                },
                showMenu: false,
                placeholderText: 'Please select an item',
            }
        },
        props: {
            options: {
                type: [Array, Object]
            },
            selected: {},
            placeholder: [String]
        },

        mounted() {
            this.selectedOption = this.selected;
            if (this.placeholder)
            {
                this.placeholderText = this.placeholder;
            }
        },

        methods: {
            updateOption(option) {
                this.selectedOption = option;
                this.showMenu = false;
                this.$emit('updateOption', this.selectedOption);
            },

            toggleMenu() {
              this.showMenu = !this.showMenu;
            }
        }
    }
</script>
11 Jan
1 month ago

jet left a reply on Data Not Displaying On The Browser

@SMNHUNT - ``` Object ads: Array[1] 0: Object categories: "[2, 4]" created_at: "2018-12-27 02:00:55" description: "Ok" id: "1" status: "0" thumbnail: null title: "Computer Accessories" updated_at: "2018-12-27 02:00:55" user_id: "1" uuid: "e2cf82d3-edb0-4609-95a9-5aa8826fc226" proto: Object length: 1 proto: Array[0] count: 1 proto: Object

jet left a reply on Data Not Displaying On The Browser

Object
ads
:
Array[1]
0
:
Object
categories
:
"[2, 4]"
created_at
:
"2018-12-27 02:00:55"
description
:
"Ok"
id
:
"1"
status
:
"0"
thumbnail
:
null
title
:
"Computer Accessories"
updated_at
:
"2018-12-27 02:00:55"
user_id
:
"1"
uuid
:
"e2cf82d3-edb0-4609-95a9-5aa8826fc226"
__proto__
:
Object
length
:
1
__proto__
:
Array[0]
count
:
1
__proto__
:
Object

jet started a new conversation Data Not Displaying On The Browser

pls help me am having this that shows that everything is working but when i get data from the API it does not show on the browser it indicates on the console that i have received data and it comes with this error message Invalid prop: type check failed for prop "gridData". Expected Object, got Array index.vue

<template>
  <section>
      <AdsListComponent v-bind:gridData="gridData" />
  </section>
</template>

<script>
import AdsListComponent from '~/components/AdsListComponent.vue'

export default {
  components: {
    AdsListComponent
  },

  data() {
    return {  gridData:[] }
  },

    created: function() { 
      this.fetchSomething()
       },

        methods: {
      
          async fetchSomething() {
            const data = await this.$axios.$get('/api/ads')
            console.log(data)
            this.gridData = data.gridData 
          },
  }
}
</script>

<style>
table {
  border: 2px solid #42b983;
  border-radius: 3px;
  background-color: #fff;
}

th {
  background-color: #42b983;
  color: rgba(255, 255, 255, 0.66);
}

td {
  background-color: #f9f9f9;
}

th,
td {
  min-width: 120px;
  padding: 10px 20px;
}
</style>

adslistcomponent

<template>
<div>
  <h2>Ads List</h2>
  <p> {{gridData}}</p>
  <table>
    <thead>
      <tr>
        <th>Title</th>
        <th>Description</th>
        <th>Category</th>
        <th>Actions</th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="data in gridData" :key="data.id">
        <td>{{ data.title }}</td>
        <td>{{ data.description }}</td>
        <td>{{ data.category }}</td>
        <td>
          <button @click="editwork(data.id)" class="btn btn-sm btn-warning">Edit</button>
          <button @click="deletework(data.id)" class="btn btn-sm btn-danger">Delete</button>
        </td>
      </tr>
    </tbody>
  </table>

</div>
</template>


<script>
export default {
  
  props: { gridData: { type: Object,
      
      default: function () {
        return {name: '', description: '' }
            }
          }
        },

  methods: {
    editwork: function () {
      console.log('edited')
    },

    deletework: function () {
      console.log('deleted')
    }
  }
}
</script>

don't know what to do

10 Jan
1 month ago

jet started a new conversation Trying To Get Property 'email' Of Non-object

need help pls i have tried all i could but no solution ContactController


namespace App\Http\Controllers;
use App\Http\Requests\ContactFormRequest;
use Illuminate\Http\Request;
use App\Mail\ContactEmail;
use Mail;
use Session;

class ContactController extends Controller
{
    public function create()
    {
        return view('contact.create');
    }

     public function store(ContactFormRequest $request)
  {

          $validated = $request->validated();
    $contact = [];

    $contact['name'] = $request->get('name');
    $contact['email'] = $request->get('email');
    $contact['msg'] = $request->get('msg');

    Mail::to(config('mail.support.address'))->send(new ContactEmail($contact));

     Session::flash('success', 'New Category has been created');

    return redirect()->route('contact.create');

  }

}

ContactEmail

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class ContactEmail extends Mailable
{
    use Queueable, SerializesModels;

    public $contact;
    /**
     * Create a new message instance.
     *
     * @return void
     */

    public function __construct($contact)
    {
        $this->contact = $contact;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
         return $this
            ->to(config('mail.support.address'))
            ->subject('HackerPair Inquiry')
            ->view('emails.contact');
    }
}

jet left a reply on Class App\Http\Controllers\ContactRequest Does Not Exist

@VILFAGO - please, the form is not displaying the validation messages what can i do to make it show pls help

jet started a new conversation Class App\Http\Controllers\ContactRequest Does Not Exist

pls help this is the contactController

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\ContactRequest;
use App\models\Contact;
use Session;

class ContactController extends Controller
{
    //
    public function index() {
        return view('contact.form');
    }

  
   public function store(ContactRequest $request)
    {
       
        // store it in to the date base
        $con = new Contact;
        $validated = $request->validated();
        $con->name=$request->name;
        $con->phone = $request->phone;
        $con->email = $request->email;
        $con->subject=$request->subject;
        $con->content=$request->content;

        $con->save();

        Session::flash('success', 'The blog con was sucessfully save!');

        return redirect()->route('contact.confirm');
    }

}

contactRequest form

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ContactRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'Name'  => 'required|max:255',
            'E-mail'  => 'required|email',
            'Phone'  => 'required',
            'Subject'  => 'required|max:255',
            'content' => 'required|max:255'
        ];
    }
}
07 Jan
1 month ago

jet started a new conversation Commons.app.js:11385 [Vue Warn]: The Client-side Rendered Virtual DOM Tree Is Not Matching Server-rendered Content. This Is Likely Caused By Incorrect HTML Markup, For Example Nesting Block-level Elements Inside <p>, Or Missing <tbody>. Bailing Hydration

how can i fix this

<template>
  <section>
   <table class="table">
        <thead>
        <tr>
          <th>#</th>
          <th>Name</th>
          <th class="col-sm-2">Actions</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="category in categories" :key="category.id">
          <td>{{category.id }}</td>
          <td> {{category.name}} </td>      
          <td>
            <div class="btn btn-primary btn-sm" @click="editCat('category.id')">Edit</div>
            <div class="btn btn-danger btn-sm" @click="deleteCat('category.id')">Delete</div>
          </td>
        </tr>
        </tbody>
    </table>
  </section>
</template>



<script>
export default {

  props: { categories: { type: Array, required:true,}},
  
  methods: {
    editCat: function (id) {
      this.$emit('edit-cat', id);
     // console.log('edited')
    },

    deleteCat: function (id) {
      this.$emit('delete-cat', id);
      //console.log('deleted')
    }
  }
}
05 Jan
1 month ago

jet left a reply on EditCat Is Not Defined

@REALRANDYALLEN - thanks for that, but the way I use the emitand the event is it right?

jet started a new conversation EditCat Is Not Defined

am trying to edit the form using event an emit but i have that error above please if you help me will be very greatful categories.vue form

<template>
  <section class="categories">
    <h3> Categories </h3>
    <p>
      <button
        class="btn btn-success btn-sm"
        @click="addCat()">Add</button>
    </p>
  
    <modal
      :adaptive="true"
      :max-width="600"
      :scrollable="true"
      width="100%"
      name="cat-form"
      height="auto">
      <div class="col-md-10">
        <CategoryFormComponent />
      </div>
    </modal>
     <CategoryListComponent :categories="categories" 
                            v-on:editCat="updateCat($event)" />
  </section>
</template>

<script>
import CategoryFormComponent from '~/components/CategoryFormComponent.vue'
import CategoryListComponent from '~/components/CategoryListComponent.vue'

export default {
  components: {
    CategoryFormComponent,
    CategoryListComponent
  },

data() {
    return {  categories:[] }
  },

  created: function() { 
      this.fetchSomething()
       },


  methods: {
    showForm: function() {
      this.$modal.show('cat-form')
    },
    hideForm: function() {
      this.$modal.hide('cat-form')
    },
    addCat: function() {
      this.showForm()
    },
     async fetchSomething() {
        const data = await this.$axios.$get('/api/categories')
        this.categories = data.categories 
      },
      updateCat: function (updateCat) {
        this.id = updateCat;
      },
  }
}
</script>

<style lang="scss">
.categories {
  p {
    display: block;
  }
  .container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.title {
  font-family: 'Quicksand', 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  display: block;
  font-weight: 300;
  font-size: 100px;
  color: #35495e;
  letter-spacing: 1px;
}

.subtitle {
  font-weight: 300;
  font-size: 42px;
  color: #526488;
  word-spacing: 5px;
  padding-bottom: 15px;
}
}

categorylistcomponent.vue

<template>
  <section>
   <table class="table">
        <thead>
        <tr>
          <th>#</th>
          <th>Name</th>
          <th class="col-sm-2">Actions</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="category in categories" :key="category.id">
          <td>{{category.id }}</td>
          <td> {{category.name}} </td>      
          <td>
            <div class="btn btn-primary btn-sm" @click="editCat('category.id')">Edit</div>
            <div class="btn btn-danger btn-sm" @click="deleteCat('category.id')">Delete</div>
          </td>
        </tr>
        </tbody>
    </table>
  </section>
</template>



<script>
export default {


  props: { categories: { type: Object,
      
      default: function () {
        return {name: '', description: '' }
            }
          }
        },

  methods: {
    editCat: function (id) {
      this.$emit('editCat', id);
      console.log(editCat)
    },

    deleteCat: function (id) {
      this.$emit('deleteCat', id);
      console.log('deleted')
    }
  }
}
    
 
</script>

<style scope>
  
</style>
04 Jan
1 month ago

jet left a reply on Data Is Not Defined

@MANELGAVALDA - if I remove this this.categories =data.categories am not going to display anything on the browser

03 Jan
1 month ago

jet started a new conversation Data Is Not Defined

please, can someone help me to fix this I'm trying to pass categories from the parent and child

index.vue

<template>
  <section class="container">
    <CategoryListComponent />
  </section>
</template>

<script>
import CategoryListComponent from '~/components/CategoryListComponent.vue'

export default {
  components: {
    CategoryListComponent
  }, 
  data: function (data) {
    return {  categories:[] }
  },
 async asyncData({ app }) {
            const { data } = await app.$axios.$get(
                `/api/categories`
                .this.categories = data.categories
            );
            return { categories };

        },

}
</script>

<style>
</style>

categoryListComponent

<template>
  <section>
     <div class="actions">
         <h3>Categories</h3>
      </div>
    <br>
      
    <table class="table">
        <thead>
        <tr>
          <th>#</th>
          <th>Name</th>
          <th class="col-sm-2">Actions</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="category in categories" :key="category.id">
          <td>{{category.id }}</td>
          <td> {{category.name}} </td>      
          <td>
            <div class="btn btn-primary btn-sm" @click="editCat('edited')">Edit</div>
            <div class="btn btn-danger btn-sm" @click="deleteCat('deleted')">Delete</div>
          </td>
        </tr>
        </tbody>
    </table>
  </section>
</template>



<script>
export default {
     data () {
    return {  categories:[] }
  },
  methods: {
    editCat: function () {
      console.log('edited')
    },

    deleteCat: function () {
      console.log('deleted')
    }
  }
}
    
 
</script>

jet left a reply on I Get No Response From The Server After Doing This

here is the index.vue codes

<template>
  <section class="container">
    <CategoryListComponent />
  </section>
</template>

<script>
import CategoryListComponent from '~/components/CategoryListComponent.vue'

export default {
  components: {
    CategoryListComponent
  }, 
  props: { categories: { type: Object,
      
      default: function () {
            return {  categories:[] }
            }
          }
        }
}
</script>```
02 Jan
1 month ago

jet left a reply on I Get No Response From The Server After Doing This

@EDOC - I'm using nuxt js and it needs it

jet started a new conversation I Get No Response From The Server After This

pls help anyone

<template>
  <section>
     <div class="actions">
         <h3>Categories</h3>
      </div>
    <br>
      
    <table class="table">
        <thead>
        <tr>
          <th>#</th>
          <th>Name</th>
          <th class="col-sm-2">Actions</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="category in categories" :key="category.id">
          <td>{{category.id }}</td>
          <td> {{category.name}} </td>      
          <td>
            <div class="btn btn-primary btn-sm" @click="editCat('edited')">Edit</div>
            <div class="btn btn-danger btn-sm" @click="deleteCat('deleted')">Delete</div>
          </td>
        </tr>
        </tbody>
    </table>
  </section>
</template>



<script>
export default {
data () {
    return {  categories:[] }
  },

async asyncData({ $axios }) {
  const categories = await $axios.$get('/api/categories')
  return { categories }
},


  methods: {
    editCat: function () {
      console.log('edited')
    },

    deleteCat: function () {
      console.log('deleted')
    }
  }
}
    
 
</script>

<style scope>
  
</style>

01 Jan
1 month ago

jet left a reply on PUT Http://localhost:3000/api/categories/ 404 (Not Found)

@VILFAGO - am using nuxt js an all the configuration has been made on the server

jet left a reply on PUT Http://localhost:3000/api/categories/ 404 (Not Found)

<template>
    <section>
    <h2>Add new Category</h2>
    <form v-on:submit.prevent="createCategory">
      <CategoryFormComponent :category="category"></CategoryFormComponent>
      <button type="submit" class="btn btn-primary">Create</button>
      <nuxt-link to="/category/categorylist" class="btn btn-default">Cancel</nuxt-link>
    </form>
  </section>
</template>

<script>
import axios from 'axios';
 import CategoryFormComponent from './../../components/CategoryFormComponent.vue'

export default {
  components: { CategoryFormComponent },

   data () {
    return {category: { name: '', description: '', }}
  },

   methods: {
    async createCategory(e) {
      await axios.post('/api/categories', this.category + id

          )
          .then((response) => {})
          .catch(function(err){
          alert(err.error)
        })
       this.$router.push('/category/categorylist')
        }       
      }
    }


</script>

31 Dec
1 month ago

jet started a new conversation PUT Http://localhost:3000/api/categories/ 404 (Not Found)

please help me don't know what to do this is the category list

<template>
  <section>
    <div class="actions">
      <nuxt-link class="btn btn-default" :to="{path: '/category/add-category'}">
        <span class="glyphicon glyphicon-plus"></span>
        Add Category
      </nuxt-link>
    </div>
    <div class="filters row">
    </div>
    <table class="table">
      <thead>
      <tr>
        <th>#</th>
        <th>Name</th>
        <th>Description</th>   
        <th class="col-sm-2">Actions</th>
      </tr>
      </thead>
      <tbody>
      <tr v-for="category in categories" :key="category">
        <td> {{ category.id }} </td>
        <td> {{ category.name }} </td>
      
        <td>{{ category.description }}</td>
        <td>
          <nuxt-link class="btn btn-warning btn-xs" :to="{name: 'category-id-edit'}" >Edit</nuxt-link>
          <div class="btn btn-danger btn-xs" @click="deleteCategory(category,category.id)">Delete</div>
        </td>
      </tr>
      </tbody>
    </table>
  </section>
</template>

<script>
import axios from 'axios';

export default {
    data () {
    return {  categories:[] }
  },

  async asyncData({ app }) {
            const { categories } = await app.$axios.$get(
                `/api/categories`
            );
            return { categories };

        },

  methods: {

    async deleteCategory({category, id}) {
      await this.$axios.$delete('/api/categories/' + id )
      .then(response => {
        this.categories.splice(category,1)
        console.log(this.category);
        window.location.reload();
      });
    },
}
  
}

</script>

<style>

</style>

edit form

<template>
  <section>
    <h2>Edit category</h2>
    <form v-on:submit.prevent="updateCategory">
      <category-form :category="category"></category-form>
      <button type="submit" class="btn btn-primary">Save</button>
      <nuxt-link to="/category/categorylist" class="btn btn-default">Cancel</nuxt-link>
    </form>
  </section>
</template>

<script>
import axios from 'axios';

 import CategoryForm from '../../../components/CategoryFormComponent.vue'

export default {
  components: { CategoryForm },

  data () {
          return {category: { name: '', description: '', }}

  },
  methods: {
     async updateCategory(e) {
      await axios.put('/api/categories', this.category 
          )
          .then((response) => {})
          .catch(function(err){
          alert(err.error)
        })
        } 

}
}
</script>


jet started a new conversation Property Or Method "id" Is Not Defined On The Instance But Referenced During Render. Make Sure That This Property Is Reactive, Either In The Data Option, Or For Class-based Components, By Initializing The Property And ```Cannot Read Property 'splice' Of U

pls help i have dose error above in my delete method

<template>
  <section>
    <div class="actions">
      <nuxt-link class="btn btn-default" :to="{path: '/category/add-category'}">
        <span class="glyphicon glyphicon-plus"></span>
        Add Category
      </nuxt-link>
    </div>
    <div class="filters row">
    </div>
    <table class="table">
      <thead>
      <tr>
        <th>#</th>
        <th>Name</th>
        <th>Description</th>   
        <th class="col-sm-2">Actions</th>
      </tr>
      </thead>
      <tbody>
      <tr v-for="category in categories" :key="category">
        <td> {{ category.id }} </td>
        <td> {{ category.name }} </td>
      
        <td>{{ category.description }}</td>
        <td>
          <div class="btn btn-warning btn-xs" >Edit</div>
          <div class="btn btn-danger btn-xs" @click="deleteCategory(category, id)">Delete</div>
        </td>
      </tr>
      </tbody>
    </table>
  </section>
</template>

<script>
import axios from 'axios';

export default {
    data () {
    return {  categories:[] }
  },

  async asyncData({ app }) {
            const { categories } = await app.$axios.$get(
                `/api/categories`
            );
            return { categories };

        },

  methods: {

    deleteCategory: function(category, id) {
      axios.delete('/api/categories/' + id )
      .then(response => {
        this.category.splice(category,1)
        console.log(this.category);
 
      });
    },
}

jet started a new conversation Description Is Not Defined

don't know where i have gone wrong pls help

<template>
    <section>
    <h2>Add new Category</h2>
    <form v-on:submit.prevent="createCategory">
      <CategoryFormComponent :category="category"></CategoryFormComponent>
      <button type="submit" class="btn btn-primary">Create</button>
      <nuxt-link to="/category/categorylist" class="btn btn-default">Cancel</nuxt-link>
    </form>
  </section>
</template>

<script>
import axios from 'axios';
 import CategoryFormComponent from './../../components/CategoryFormComponent.vue'

export default {
  components: { CategoryFormComponent },

   data () {
    return {category: { name: '', description: '', }}
  },

   methods: {
    createCategory(e) {
       axios.post('api/categories',  {
              name: name,
              description: description
          })
          .then((response) => {})
          .catch(function(err){
          alert(err.error)
        })
        }
       
       // this.$router.push('/category/categorylist')
      }
    }


</script>


jet left a reply on Cannot Read Property 'post' Of Undefined

@REALRANDYALLEN - if i remove the this it will give me this error axios is not defined