app/Http/Controllers/Avalon/NoteController.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)
    {
		$tags = preg_split('/\s+/', $request->input('tags'));
		$t = array();
		foreach (array_filter($tags, function ($v) {
			return $v !== '';
		}) as $tag) {
			$t[] = NoteTag::firstOrCreate(['name' => $tag])->id;
		}
		var_dump($t);
		dd(NoteTag::all()->toArray());
        $note = new Note;
        $note->doc_html = $request->input('editor-html-code') ?? '';
        $note->doc_md = $request->input('editor-markdown-doc') ?? '';
        $note->save();
        return redirect()->action('Avalon\NoteController@index');
    }
public function store ( Request $ request ) { $ tags = preg_split ( '/\s+/' , $ request -> input ( 'tags' ) ) ; $ t = array ( ) ; foreach ( array_filter ( $ tags , function ( $ v ) { return $ v !== '' ; } ) as $ tag ) { $ t [ ] = NoteTag :: firstOrCreate ( [ 'name' => $ tag ] ) -> id ; } var_dump ( $ t ) ; dd ( NoteTag :: all ( ) -> toArray ( ) ) ; $ note = new Note ; $ note -> doc_html = $ request -> input ( 'editor-html-code' ) ?? '' ; $ note -> doc_md = $ request -> input ( 'editor-markdown-doc' ) ?? '' ; $ note -> save ( ) ; return redirect ( ) -> action ( 'Avalon\NoteController@index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .