Exemple #1
0
function uploadLogoCanal()
{
    $canal = Canales::find(Input::get('id'));
    Input::file('media')->move(public_path("/img/logo/canales/"), $canal->nombre . "." . Input::file('media')->getClientOriginalExtension());
    $canal->media = $canal->nombre . "." . Input::file('media')->getClientOriginalExtension();
    $canal->save();
}
 public function Canales($action = null)
 {
     if (isset($action)) {
         if ($action == "create") {
             $data = Canales::firstOrCreate(Input::except("_token", "_user"));
             return $respuesta = array('Record' => $data, 'Result' => "OK");
         }
         if ($action == "edit") {
             Canales::where("id", Input::get("id"))->update(Input::except("_token", "id", "_user"));
             return $respuesta = array('Record' => Canales::find(Input::get('id')), 'Result' => "OK");
         }
         if ($action == "remove") {
             Canales::where('id', Input::get("id"))->delete();
             return '{"Result":"OK"}';
         }
         if ($action == "list") {
             $Records = Canales::get();
             $respuesta = array('Records' => $Records, 'Result' => "OK");
             return json_encode($respuesta);
         }
         if ($action == "empresas") {
             $nulos = DB::table('empresas')->select(DB::raw("'NO POSEE' as DisplayText, NULL as Value"));
             $respuesta = DB::table('empresas')->select("nombre as DisplayText", "id as Value")->union($nulos)->orderby('value', 'asc')->distinct()->get();
             return "var opciones=" . json_encode($respuesta);
         }
     }
 }
Exemple #3
0
 public function canales()
 {
     return Canales::wherein("id", $this->canales)->get();
 }