本文整理汇总了PHP中Artist::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Artist::find方法的具体用法?PHP Artist::find怎么用?PHP Artist::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artist
的用法示例。
在下文中一共展示了Artist::find方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeArtist
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);
}
示例2: header
<?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");
}
示例3: show
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]);
}
}
示例4: artistPage
/**
* 艺术家页面
*
* @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);
}
示例5: header
<?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);
}
}
示例6: api_get_artist_by_id
public function api_get_artist_by_id($artist_id)
{
$artist = Artist::find($artist_id);
return Response::json($artist);
}
示例7: isset
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-->
示例8: alias_name
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;
}