app/Http/Controllers/ItemController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
      $newItem = new Item;
      $newItem->id = (string) Uuid::generate();
      $newItem->name = $request->name;
      $newItem->description = $request->description;
      $newItem->owner_id = auth()->user()->id;
      $newItem->state_id = 1;
      if ($newItem->save()) {
        return redirect('/items')->with('success', 'Je item is toegevoegd');
      }
    }
public function store ( Request $ request ) { $ newItem = new Item ; $ newItem -> id = ( string ) Uuid :: generate ( ) ; $ newItem -> name = $ request -> name ; $ newItem -> description = $ request -> description ; $ newItem -> owner_id = auth ( ) -> user ( ) -> id ; $ newItem -> state_id = 1 ; if ( $ newItem -> save ( ) ) { return redirect ( '/items' ) -> with ( 'success' , 'Je item is toegevoegd' ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .