public function removeArtist($id) { $artist = Artist::find($id); $name = $artist->name; $artist->delete(); return Redirect::route('account')->with('status', 'alert-success')->with('global', 'You just deleted ' . $name); }
<?php include 'models.php'; if (isset($_GET['id'])) { $a = Artist::find($_GET['id']); if ($a->delete()) { header("Location: ../index.php"); } } else { header("Location: ../index.php"); }
public function show() { if ($this->params()->name) { $this->artist = Artist::where(['name' => $this->params()->name])->first(); } else { $this->artist = Artist::find($this->params()->id); } if (!$this->artist) { $this->redirectTo(['#create', 'name' => $this->params()->name]); } else { $this->redirectTo(['wiki#show', 'title' => $this->artist->name]); } }
/** * 艺术家页面 * * @param int $id * @return Response */ public function artistPage($id) { // fetch artist $artist = Artist::find($id); // collect the total counts $total = []; foreach ($artist->programs as $pm) { empty($total[$pm->dates->year]) and $total[$pm->dates->year] = 0; $total[$pm->dates->year]++; } $total = self::fillChartData($total); // TDK $title = $artist->name; $description = '飞鱼秀歌曲歌手, 飞鱼秀音乐艺人'; return View::make('music.artist')->with('artist', $artist)->with('total', $total)->with('title', $title)->with('description', $description); }
<?php include 'models.php'; if (isset($_POST['id'])) { $a = Artist::find($_POST['id']); $a->Name = $_POST['name']; if ($a->save()) { header("Location: " . "artist.php?id=" . $a->ArtistId); } } else { $a = Artist::create($_POST['name']); if ($a->save()) { header("Location: " . "artist.php?id=" . $a->ArtistId); } }
public function api_get_artist_by_id($artist_id) { $artist = Artist::find($artist_id); return Response::json($artist); }
var uno = !!document.forms["formulario"]["name"].value; //Esta es la representación booleana de la cadena if ( uno && (isNaN(document.forms["formulario"]["name"].value)) ) { return true; }else{ return false; }; } </script> <?php include 'models.php'; $artist = isset($_GET['id']) ? Artist::find($_GET['id']) : Artist::create(null); ?> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous"> <title>New Artist</title> </head> <body> <div class="container"> <div class="jumbotron"> <h1>Nuevo Artista</h1> </div> <div class="row"> <!--Sección para hacer el formulario en medio de la pantalla-->
public function alias_name() { $name = ''; if ($this->alias_id) { try { $name = Artist::find($this->alias_id)->name; } catch (Rails\ActiveRecord\Exception\RecordNotFoundException $e) { } } return $name; }