/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $photoParent = PhotoParent::create($request->except('images', 'q')); // getting all of the post data $files = Input::file('images'); $result = array(); $file_count = count($files); // start count how many uploaded $uploadcount = 0; foreach ($files as $key => $file) { // $rules = array('file' => 'required'); //'required|mimes:png,gif,jpeg,txt,pdf,doc' // $validator = Validator::make(array('file'=> $file), $rules); // if($validator->passes()){ $storage = \Storage::disk('public'); $destinationPath = 'froala/uploads'; $storage->makeDirectory($destinationPath); $filename = time() . $key . '.' . $file->getClientOriginalExtension(); $upload_success = $file->move($destinationPath, $filename); $file_array = array(); $file_array = array_collapse([$file_array, ['id' => $key + 1, 'name' => $filename]]); $result = array_add($result, $key, $file_array); $jsonresult = json_encode($result); //$files_ser = serialize($result); $photoParent->images = $jsonresult; $photoParent->save(); $uploadcount++; // } // endif } return redirect()->route('admin.photoParent.index'); }
/** * @function all_tags_from_xml() * returns an asociative array containing all selected tag-names as keys * and all tag content as the values. * * @param $xml (object): The an XML object containing the relevant children * obtained from the XML. Could be obtained by XML->children('oml', true) * or something similar, to get all childeren in the OML namespace. * @param $configuration (2d string array): an array configuring which fields to be * included in the return value. $configuration can contain 4 sub arrays, 'array', * 'csv', 'plain' and 'string'. Putting a field in one of these sub arrays, deter- * mines * @param $return_array (string array): The base array to add tags to. Usually, when * some fields are already set, these can be joined with the fields to * be set within this function. * * @return (MULTIPLE VALUES array): asociative array containing all selected tag-names * as keys and all tag content as the values. */ function all_tags_from_xml($xml, $configuration = array(), $return_array = array()) { $csv_tags = array(); $include = array_collapse($configuration); foreach ($xml as $key => $value) { if (in_array($key, $include)) { if (array_key_exists('array', $configuration) && in_array($key, $configuration['array'])) { // returned in plain array if (!array_key_exists($key, $return_array)) { $return_array[$key] = array(); } $return_array[$key][] = $value; } elseif (array_key_exists('csv', $configuration) && in_array($key, $configuration['csv'])) { // returned in CSV format if (!array_key_exists($key, $csv_tags)) { $csv_tags[$key] = array(); } $csv_tags[$key][] = trim($value); } elseif (array_key_exists('plain', $configuration) && in_array($key, $configuration['plain'])) { // returned plain (xml object) $return_array[$key] = $value; } elseif (array_key_exists('string', $configuration) && in_array($key, $configuration['string'])) { // returned as string $return_array[$key] = trim($value); } else { // an illegal or undefined category } } } foreach ($csv_tags as $key => $value) { $return_array[$key] = putcsv($value); } return $return_array; }
public function aliasFacades() { $facades = []; foreach ($this->phpna->getServices() as $package) { if (key_exists('facades', $package) && is_array($package['facades'])) { $facades = array_collapse([$facades, $package['facades']]); } } foreach ($facades as $facade) { $loader = AliasLoader::getInstance(); foreach ($facades as $name => $serve) { $loader->alias($name, $serve); } } }
private function sliceData($sezione, $prodotti_raw, $pagine_repo, $listini_repo) { $listini = $listini_repo->getAllFront(); $contenuti = $pagine_repo->getContentForPage($sezione); $prodotti = []; foreach ($prodotti_raw as $prodotto) { $prodotti[strtoupper($prodotto['nome'])][] = $prodotto; } $categorie = collect(array_pluck(array_collapse($prodotti), 'categoria_terapeutica'))->unique(); $principi_validi = array_pluck(collect(array_pluck(array_collapse($prodotti), 'principio_attivo'))->unique(), 'slug'); $principi = collect(array_sort(array_pluck(array_collapse($prodotti), 'principio_attivo'), function ($value) { return $value['nome']; }))->unique(); return array($prodotti, $categorie, $principi, $principi_validi, $contenuti, $listini); }
public function getQuemSomos2() { $gp = DB::table('members')->where('diretoria', 'gp')->where('cargo', 'diretor')->get(); $ge = DB::table('members')->where('diretoria', 'ge')->where('cargo', 'diretor')->get(); $proj = DB::table('members')->where('diretoria', 'proj')->where('cargo', 'diretor')->get(); $jufin = DB::table('members')->where('diretoria', 'jufin')->where('cargo', 'diretor')->get(); $pres = DB::table('members')->where('diretoria', 'pres')->where('cargo', 'diretor')->get(); $mkt = DB::table('members')->where('diretoria', 'mkt')->where('cargo', 'diretor')->get(); $conselho = DB::table('members')->where('cargo', 'conselheiro')->get(); $gp = array_collapse([$gp, DB::table('members')->where('diretoria', 'gp')->where('cargo', 'assessor')->get()]); $ge = array_collapse([$ge, DB::table('members')->where('diretoria', 'ge')->where('cargo', 'assessor')->get()]); $proj = array_collapse([$proj, DB::table('members')->where('diretoria', 'proj')->where('cargo', 'assessor')->get()]); $jufin = array_collapse([$jufin, DB::table('members')->where('diretoria', 'jufin')->where('cargo', 'assessor')->get()]); $mkt = array_collapse([$mkt, DB::table('members')->where('diretoria', 'mkt')->where('cargo', 'assessor')->get()]); return view('quem2')->with(['gp' => $gp, 'ge' => $ge, 'proj' => $proj, 'jufin' => $jufin, 'pres' => $pres, 'mkt' => $mkt, 'conselho' => $conselho]); }
public function reportePedidos($codigos) { $value = explode(",", $codigos); $codigoNegocio = (int) $value[0]; $codigoLocal = (int) $value[1]; $negocio = \DB::table('negocio')->select('negocio.razonsocial', 'negocio.ruc', 'negocio.telefono', 'negocio.correo', 'logonegocio.nombre')->where('negocio.codigo', $codigoNegocio)->join('logonegocio', 'logonegocio.codigonegocio', '=', 'negocio.codigo')->first(); $raw = \DB::raw("CONCAT(persona.nombres, ' ', persona.apellidopaterno,' ', persona.apellidomaterno) as cliente"); $raw2 = \DB::raw("(select SUM(DOP.total) from detalleordenpedido as DOP where DOP.codigoordenpedido= ordenpedido.codigo ) as total"); $PedidosCP = \DB::table('ordenpedido')->select('ordenpedido.codigo', 'ordenpedido.via', 'ordenpedido.estado', 'ordenpedido.numero', 'ordenpedido.fechaemision', $raw, $raw2)->distinct()->where('detalleordenpedido.codigonegocio', $codigoNegocio)->where('detalleordenpedido.codigolocal', $codigoLocal)->where('ordenpedido.estado', 'R')->join('detalleordenpedido', 'detalleordenpedido.codigoordenpedido', '=', 'ordenpedido.codigo')->join('persona', 'persona.codigo', '=', 'ordenpedido.codigoclientepersona')->get(); $PedidosCE = \DB::table('ordenpedido')->select('ordenpedido.codigo', 'ordenpedido.via', 'ordenpedido.estado', 'ordenpedido.numero', 'ordenpedido.fechaemision', 'clienteempresa.razonsocial as cliente', $raw2)->distinct()->where('detalleordenpedido.codigonegocio', $codigoNegocio)->where('detalleordenpedido.codigolocal', $codigoLocal)->where('ordenpedido.estado', 'R')->join('detalleordenpedido', 'detalleordenpedido.codigoordenpedido', '=', 'ordenpedido.codigo')->join('clienteempresa', 'clienteempresa.codigo', '=', 'ordenpedido.codigoclienteempresa')->get(); $Pedidos = array_collapse([$PedidosCE, $PedidosCP]); $pdf = new reportePedidos(); $pdf->AddPage(); $pdf->SetFont('Arial', '', 10); $pdf->cabecera($negocio); $pdf->BasicTable($Pedidos); $pdf->Output('reportePedidos', 'F'); exit; }
public function processScreenResults($screen_response) { //dd(json_decode($screen_response)); $screen_response = json_decode($screen_response); $screen_symbols = array(); foreach ($screen_response as $page) { $page_symbols = $page->pageFunctionResult; array_push($screen_symbols, $page_symbols); } $screen_symbols = collect(array_collapse($screen_symbols)); $screen_instances = $screen_symbols->map(function ($screen_symbol) { $instance = new Instance(); $symbol = new Symbol(); //Transform to an instance $symbol = $symbol->firstOrCreate(['symbol' => $screen_symbol->symbol]); $instance->source_type = 'screener'; $instance->source_name = $screen_symbol->source_name; //Save new instances $symbol->instances()->save($instance); return $instance; }); return $screen_instances; }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function UpdateAction(ProductEditFormRequest $request, $id) { if ($request->get('pcategories')) { if ($request->get('category')) { $p = [$request->get('pcategories'), $request->get('category')]; $value = array_collapse($p); $product = products::find($id); if ($product) { $product->name = $request->get('name'); $product->is_active = $request->get('is_active'); $product->description = $request->get('description'); $product->price = $request->get('price'); $product->starting_pound = $request->get('starting_pound'); $product->ending_pound = $request->get('ending_pound'); $product->save(); $product->category()->sync($value); return redirect()->route('cake/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The product table item updated'])); } return redirect()->route('cake/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'The product could not updated'])); } return redirect()->route('cake/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'The product could not updated'])); } return redirect()->route('cake/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'The product could not updated'])); }
public function update(array $reps) { $divisions = []; foreach ($reps as $rep) { if (!empty($rep->division) && !in_array($rep->division, $divisions)) { array_push($divisions, $rep->division); } } $requests = array_map(function ($d) { return GoogleAPI::division($d); }, $divisions); $results = Promise\unwrap($requests); return array_collapse(array_map(function ($result) { return $result->reps; }, $results)); }
public function __construct() { $this->defaults = ['title' => 'Home', 'title-spacer' => ' – ', 'title-description' => 'Laravel Blue', 'keywords' => array_collapse([['home'], ['laravel', 'blue', 'cms', 'meestorhok']]), 'description' => 'This amazing site was created by Laravel Blue!', 'images' => [], 'twitter' => '@BlueCMS', 'copyright' => '© 2016 Laravel Blue', 'robots' => 'index,follow', 'colors' => ['safari_pinned' => '#151e4f', 'ms_tile' => '#ffffff', 'theme' => '#151e4f']]; }
</div> <div class="form-group"> {!! Form::label( @trans('auth.email') ) !!} {!! Form::text('email', null, ['class' => 'form-control']) !!} </div> <!-- select --> <div class="form-group"> {!! Form::label( @trans('prado.role') ) !!} <?php $lista = array(); foreach ($roles as $role) { $lista[] = array($role->name => $role->name); } $lista = array_collapse($lista); ?> @if ($user->exists) <?php //trae el primer registro desde roles $user_roles = $user->roles()->first(); $name = $user_roles['name']; ?> {!! Form::select('role', $lista, $name, ['class' => 'form-control']) !!} @else {!! Form::select('role', $lista, null, ['class' => 'form-control']) !!} @endif </div> <div class="form-group">
public function update(Request $request, PhotoChild $photoChild) { $photoChild->update($request->except('file', 'tag_kg', 'tag_ru', 'q')); $tag_kg_string = $request->input('tag_kg'); $tags = explode("; ", $tag_kg_string); $tag_ru_string = $request->input('tag_ru'); $tags2 = explode("; ", $tag_ru_string); if (!empty($tags)) { foreach ($tags as $key => $name) { if (!is_numeric($name) && !empty($name)) { $tag = \Model\Tag\Tag::firstOrNew(['name' => $name]); $tag->name = $name; $tag->save(); $tags[$key] = $tag->id(); } } // $post->tags()->sync($tags); } // end if if (!empty($tags2)) { foreach ($tags2 as $key => $name) { if (!is_numeric($name) && !empty($name)) { $tag = \Model\Tag\Tag::firstOrNew(['name' => $name]); $tag->name = $name; $tag->save(); $tags2[$key] = $tag->id(); } } // $post->tags()->sync($tags2); } // end if $tagsCommon = array_collapse([$tags, $tags2]); $photoChild->tags()->sync($tagsCommon); if ($request->hasFile('file')) { $file = $request->file('file'); $time = time(); $dir = 'froala/uploads'; $name = $photoChild->id() . $time . '.' . $file->getClientOriginalExtension(); $storage = \Storage::disk('public'); $storage->makeDirectory($dir); Image::make($_FILES['file']['tmp_name'])->heighten(600)->save($dir . '/' . $name); $photoChild->file = $dir . '/' . $name; $photoChild->save(); } return redirect()->route('admin.photoChild.show', $photoChild); }
public function scopeUnrated($query, $course_id = null) { $course = Course::findBySlugOrId($course_id); $tasks = $course->tasks(); $tasksIds = $tasks->get(['id'])->toArray(['id']); $articlesTaskIds = array_flatten(Article::whereIn('task_id', array_flatten($tasksIds))->get(['id'])->toArray()); $articlesWithoutAnyRating = Article::whereNotExists(function ($query) { $query->select(DB::raw(1))->from('ratings')->whereRaw('articles.id = ratings.article_id'); })->whereIn('articles.id', $articlesTaskIds)->get(['articles.id'])->toArray(); $articlesWithSomeRating = Article::whereExists(function ($query) { $query->select(DB::raw(1))->from('ratings')->whereRaw('articles.id = ratings.article_id')->where('ratings.text', '=', ''); })->whereIn('articles.id', $articlesTaskIds)->get(['articles.id'])->toArray(); $articles = array_collapse([array_flatten($articlesWithoutAnyRating), array_flatten($articlesWithSomeRating)]); return $query->whereIn('id', $articles); }
public function lista(Request $request) { $raw = \DB::raw("CONCAT(persona.nombres, ' ', persona.apellidopaterno,' ', persona.apellidomaterno) as cliente"); $listaV = \DB::table('documentoventa')->select('documentoventa.codigo', 'documentoventa.via', 'detalleordenpedido.codigoordenpedido', $raw, 'documentoventa.totalventa', 'documentoventa.estado', 'documentoventa.numero', 'documentoventa.fechaemision')->distinct()->where('detalleordenpedido.codigonegocio', $request->codigoNegocio)->where('detalleordenpedido.codigolocal', $request->codigoLocal)->join('detalleordenpedido', 'detalleordenpedido.codigoordenpedido', '=', 'documentoventa.codigoordenpedido')->join('persona', 'persona.codigo', '=', 'documentoventa.codigoclientepersona')->join('pago', 'pago.codigodocumentoventa', '=', 'documentoventa.codigo')->get(); $listaV2 = \DB::table('documentoventa')->select('documentoventa.codigo', 'documentoventa.via', 'detalleordenpedido.codigoordenpedido', 'clienteempresa.razonsocial as cliente', 'documentoventa.totalventa', 'documentoventa.estado', 'documentoventa.numero', 'documentoventa.fechaemision')->distinct()->where('detalleordenpedido.codigonegocio', $request->codigoNegocio)->where('detalleordenpedido.codigolocal', $request->codigoLocal)->join('detalleordenpedido', 'detalleordenpedido.codigoordenpedido', '=', 'documentoventa.codigoordenpedido')->join('clienteempresa', 'clienteempresa.codigo', '=', 'documentoventa.codigoclienteempresa')->join('pago', 'pago.codigodocumentoventa', '=', 'documentoventa.codigo')->get(); $Ventas = array_collapse([$listaV, $listaV2]); return response()->json(['msg' => "Success", 'listaVentas' => $Ventas], 200); }
public function ReporterAdd(Request $request) { $lc = app()->getlocale(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $reporter = \Model\PeopleReporter\ModelName::create($request->except('images', 'video', 'q')); $images = $request->file('images'); $rules = array('image' => 'image'); $result = array(); if ($request->hasFile('images')) { foreach ($images as $key => $image) { $target = array('image' => $image); $validator = Validator::make($target, $rules); if ($validator->fails()) { return redirect()->route('front.reporter'); } else { $storage = \Storage::disk('public'); $destinationPath = 'froala/uploads'; $storage->makeDirectory($destinationPath); $filename = time() . $key . '.' . $image->getClientOriginalExtension(); Image::make($_FILES['images']['tmp_name'][$key])->heighten(600)->save($destinationPath . '/' . $filename); $files_array = array(); $files_array = array_collapse([$files_array, ['id' => $key + 1, 'name' => $filename]]); $result = array_add($result, $key, $files_array); $jsonresult = json_encode($result); $reporter->thumbnail = $jsonresult; $reporter->save(); } } } $video = $request->file('video'); $video_rules = array('video' => 'mimes:mimes:m4v,avi,flv,mp4,mov,3gp | max:51200'); if ($request->hasFile('video')) { $targetVideo = array('video' => $video); $validator = Validator::make($targetVideo, $video_rules); if ($validator->fails()) { return redirect()->route('front.reporter'); } else { $storage = \Storage::disk('public'); $destinationPath = 'froala/videos'; $storage->makeDirectory($destinationPath); $filename = time() . '.' . $video->getClientOriginalExtension(); $video->move($destinationPath, $filename); $reporter->video = $filename; $reporter->save(); } } return redirect()->route('front.reporter'); }
public function listaOnline(Request $r) { $raw = \DB::raw("CONCAT(persona.nombres, ' ', persona.apellidopaterno,' ', persona.apellidomaterno) as cliente"); $raw2 = \DB::raw("(select SUM(DOP.total) from detalleordenpedido as DOP where DOP.codigoordenpedido= ordenpedido.codigo ) as total"); $PedidosCP = \DB::table('ordenpedido')->select('ordenpedido.codigo', 'ordenpedido.estado', 'ordenpedido.numero', 'ordenpedido.fechaemision', $raw, $raw2)->distinct()->where('detalleordenpedido.codigonegocio', $r->id)->where('ordenpedido.estado', 'R')->join('detalleordenpedido', 'detalleordenpedido.codigoordenpedido', '=', 'ordenpedido.codigo')->join('persona', 'persona.codigo', '=', 'ordenpedido.codigoclientepersona')->get(); $PedidosCE = \DB::table('ordenpedido')->select('ordenpedido.codigo', 'ordenpedido.estado', 'ordenpedido.numero', 'ordenpedido.fechaemision', 'clienteempresa.razonsocial as cliente', $raw2)->distinct()->where('detalleordenpedido.codigonegocio', $r->id)->where('ordenpedido.estado', 'R')->join('detalleordenpedido', 'detalleordenpedido.codigoordenpedido', '=', 'ordenpedido.codigo')->join('clienteempresa', 'clienteempresa.codigo', '=', 'ordenpedido.codigoclienteempresa')->get(); $Pedidos = array_collapse([$PedidosCE, $PedidosCP]); return response()->json(['msg' => "Success", "listaPedidosOnline" => $Pedidos], 200); }
function route_request($route = false) { $controller = $this->default_controller; $function = $this->default_function; $class = strtolower(get_class($this)); $request = $this->request_uri_parts; $remove = array(); $p = !$route ? array_collapse($request) : $route; if (isset($p[0]) && $p[0] == $class) { $controller = $p[0]; $remove[] = $p[0]; if (isset($p[1]) && method_exists($this, $p[1])) { $function = $p[1]; $remove[] = $p[1]; } } else { if (isset($p[0]) && method_exists($this, $p[0])) { $function = $p[0]; $remove[] = $p[0]; } } // lastly convert the params in pairs $params = $this->normalize_params($request, $remove); // if the method doesn't exist revert to a generic 404 page if (!preg_match('#^[A-Za-z_][A-Za-z0-9_-]*$#', $function) || !method_exists($this, $function)) { $this->request_not_found(); } // calculate the path - possibly this can be merged with parse_http_request() $path = preg_replace('#^' . addslashes(WEB_FOLDER) . '#', '', $_SERVER['REQUEST_URI']); // check if we have a trailing slash (and remove it) $path = substr($path, -1) == "/" ? substr($path, 0, -1) : $path; // save the path for later use by controllers and helpers $GLOBALS['path'] = $this->data['path'] = $path; // save a reference to the endpoint $this->_endpoint = $function; // call the method $this->{$function}($params); return $this; }
/** * Collapse the collection of items into a single array. * * @return static */ public function collapse() { return new static(array_collapse($this->items)); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, Post $post) { $post->update($request->except('tag_kg', 'tag_ru', 'thumbnail', 'q', 'channel_id', 'created_at', 'time')); $tag_kg_string = $request->input('tag_kg'); $tags = explode("; ", $tag_kg_string); $tag_ru_string = $request->input('tag_ru'); $tags2 = explode("; ", $tag_ru_string); if (!empty($tags)) { foreach ($tags as $key => $name) { if (!is_numeric($name) && !empty($name)) { $tag = \Model\Tag\Tag::firstOrNew(['name' => $name]); $tag->name = $name; $tag->save(); $tags[$key] = $tag->id(); } } // $post->tags()->sync($tags); } // end if if (!empty($tags2)) { foreach ($tags2 as $key => $name) { if (!is_numeric($name) && !empty($name)) { $tag = \Model\Tag\Tag::firstOrNew(['name' => $name]); $tag->name = $name; $tag->save(); $tags2[$key] = $tag->id(); } } // $post->tags()->sync($tags2); } // end if $tagsCommon = array_collapse([$tags, $tags2]); $post->tags()->sync($tagsCommon); if ($request->hasFile('thumbnail')) { $file = $request->file('thumbnail'); $dir = 'img/thumbnail'; $btw = time(); $name = $post->id() . $btw . '.' . $file->getClientOriginalExtension(); $name2 = $post->id() . $btw . '_big.' . $file->getClientOriginalExtension(); $storage = \Storage::disk('public'); $storage->makeDirectory($dir); Image::make($_FILES['thumbnail']['tmp_name'])->fit(250, 150)->save($dir . '/' . $name); Image::make($_FILES['thumbnail']['tmp_name'])->fit(500, 300)->save($dir . '/' . $name2); $post->thumbnail = $dir . '/' . $name; $post->thumbnail_big = $dir . '/' . $name2; $post->save(); } if ($request->input('channel_id') == null) { $channel_id = 1; $post->channel_id = $channel_id; } if ($request->input('created_at') != null) { $time = $request->input('time'); $postDate = $request->input('created_at'); $timeToSave = date('H:i:s', strtotime($time)); $saveDate = date('Y-m-d', strtotime($postDate)); $result = $saveDate . ' ' . $timeToSave; $post->created_at = $result; $post->save(); } else { $today = date('Y-m-d H:i:s'); dd($today); $post->created_at = date('Y-m-d H:i:s'); $post->save(); } return redirect()->route('admin.post.show', $post); }
/** * Guess the database column from the given attribute name. * * @param string $attribute * @return string */ public function guessColumnForQuery($attribute) { if (in_array($attribute, array_collapse($this->implicitAttributes)) && !is_numeric($last = last(explode('.', $attribute)))) { return $last; } return $attribute; }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, PhotoParent $photoParent) { $photoParent->update($request->except('images', 'q', 'status')); // dd($request->images); // dd($_FILES["images"]); if ($request->hasFile('images')) { $files = Input::file('images'); $result = array(); $uploadcount = 0; foreach ($files as $key => $file) { // if($key > 1) // { $storage = \Storage::disk('public'); $destinationPath = 'froala/uploads'; $storage->makeDirectory($destinationPath); $filename = time() . $key . '.' . $file->getClientOriginalExtension(); // $name2 = $photoParent->id().$btw.'_big.'.$file->getClientOriginalExtension(); // $upload_success = $file->move($destinationPath, $filename); Image::make($_FILES['images']['tmp_name'][$key])->heighten(600)->save($destinationPath . '/' . $filename); $file_array = array(); $file_array = array_collapse([$file_array, ['id' => $key + 1, 'name' => $filename]]); $result = array_add($result, $key, $file_array); $jsonresult = json_encode($result); $photoParent->images = $jsonresult; $photoParent->save(); $uploadcount++; // } // end if } } if ($request->hasFile('status')) { $file = $request->file('status'); $dir = 'img/thumbnail'; $btw = time(); $name = $photoParent->id() . $btw . '.' . $file->getClientOriginalExtension(); $name2 = $photoParent->id() . $btw . '_big.' . $file->getClientOriginalExtension(); $storage = \Storage::disk('public'); $storage->makeDirectory($dir); // Image::make($_FILES['status']['tmp_name'])->resize(250, 150)->save($dir.'/'.$name); Image::make($_FILES['status']['tmp_name'])->fit(250, 150)->save($dir . '/' . $name); Image::make($_FILES['status']['tmp_name'])->fit(300, 180)->save($dir . '/' . $name2); $photoParent->status = $dir . '/' . $name; $photoParent->thumbnail_big = $dir . '/' . $name2; $photoParent->save(); } // start count how many uploaded return redirect()->route('admin.photoParent.show', $photoParent); }