Ejemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     if ($request->hasFile('logo')) {
         $file = $request->file('logo');
         $name = 'logo_' . time() . '.' . $file->getClientOriginalExtension();
         $path = public_path('/assets/img');
         $file->move($path, $name);
     }
     $data = Companies::find($id);
     $data->fill($request->all());
     $data->logo = @$name;
     $data->save();
     Flash::success('Cambios Realizados!');
     return redirect()->route('empresas.edit', $id);
 }
Ejemplo n.º 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $company = Companies::find($id);
     $company->delete();
     if ($company == null) {
         return new JsonResponse(['message' => 'Not able to find this company'], 404);
     }
     return new JsonResponse([], 204);
 }