app/Http/Controllers/AdminPersonController.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)
    {
        $input = $request->all();
        if($file = $request->file('photo_id')){
            $name = $input['name'].'.jpg';
            $file->move('images', $name);
            $photo = Photo::create(['file'=>$name]);
            $input['photo_id'] = $photo->id;
        }
        $index = Person::all()->count();
        $input['sort-index'] = $index + 1;
        $input['archive_status_id'] = config('status.aktiv');
        Person::create($input);
        return redirect('/admin/people');
    }
public function store ( Request $ request ) { $ input = $ request -> all ( ) ; if ( $ file = $ request -> file ( 'photo_id' ) ) { $ name = $ input [ 'name' ] . '.jpg' ; $ file -> move ( 'images' , $ name ) ; $ photo = Photo :: create ( [ 'file' => $ name ] ) ; $ input [ 'photo_id' ] = $ photo -> id ; } $ index = Person :: all ( ) -> count ( ) ; $ input [ 'sort-index' ] = $ index + 1 ; $ input [ 'archive_status_id' ] = config ( 'status.aktiv' ) ; Person :: create ( $ input ) ; return redirect ( '/admin/people' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//