当前位置: 首页>>代码示例>>PHP>>正文


PHP Album::create方法代码示例

本文整理汇总了PHP中Album::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::create方法的具体用法?PHP Album::create怎么用?PHP Album::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Album的用法示例。


在下文中一共展示了Album::create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRemoveTrackFromAlbum

 public function testRemoveTrackFromAlbum()
 {
     $album = Album::create('id', 'Album name');
     $album->addTrack(Track::create('id', 'Track name'));
     $album->removeTrack(Track::create('id', 'Track name'));
     $this->assertCount(0, $album->getTracks());
 }
开发者ID:alexgt9,项目名称:PlayCool,代码行数:7,代码来源:AlbumTest.php

示例2: testCreateAlbum

 public function testCreateAlbum()
 {
     $album = Album::create('My Album');
     $album2 = Album::byId($album->getId());
     $this->assertEquals($album->getId(), $album2->getId());
     $this->assertEquals($album->getName(), $album2->getName());
 }
开发者ID:softservlet,项目名称:media-album,代码行数:7,代码来源:AlbumRepositoryTest.php

示例3: testRemoveAlbumFromArtist

 public function testRemoveAlbumFromArtist()
 {
     $artist = Artist::create('id', 'Artist name');
     $artist->addAlbum(Album::create('id', 'Album name'));
     $artist->removeAlbum(Album::create('id', 'Album name'));
     $this->assertCount(0, $artist->getAlbums());
 }
开发者ID:alexgt9,项目名称:PlayCool,代码行数:7,代码来源:ArtistTest.php

示例4: run

 public function run()
 {
     $faker = Faker::create();
     $usersId = DB::table('users')->lists('id');
     for ($i = 0; $i < rand(10, 20); $i++) {
         Album::create(['name' => $faker->word(), 'owner_id' => $usersId[rand(0, sizeof($usersId) - 1)]]);
     }
 }
开发者ID:renankabal,项目名称:image-manager-system,代码行数:8,代码来源:AlbumsTableSeeder.php

示例5: testAssignToAlbum

 public function testAssignToAlbum()
 {
     $album = Album::create('My temporary album name');
     $media = MediaObject::create('path/to');
     $album->addObject($media);
     foreach ($album->getObjects() as $object) {
         $this->assertEquals($media->getId(), $object->getId());
         $this->assertEquals($media->uri(), $object->uri());
     }
 }
开发者ID:softservlet,项目名称:media-album,代码行数:10,代码来源:MediaObjectRepositoryTest.php

示例6: create

 /**
  * Create a new Album
  *
  * @param int $categoryId
  *
  * @return \Illuminate\View\View | \Illuminate\Http\RedirectResponse
  */
 public function create($categoryId)
 {
     $category = Category::findOrFail($categoryId);
     if (Request::isMethod('GET')) {
         return View::make('album.create', compact('category'));
     } elseif (Request::isMethod('POST')) {
         $validator = Validator::make(Input::all(), Album::$rules);
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator)->withInput();
         }
         Album::create(['category_id' => $categoryId, 'name' => Input::get('name')]);
         return Redirect::to('/categories/' . $categoryId . '/albums')->with('success', 'Album created');
     }
 }
开发者ID:developeman,项目名称:Laravel-Image-Archive,代码行数:21,代码来源:AlbumController.php

示例7: run

 public function run()
 {
     Album::create(['user_id' => '1', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '1', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '1', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '1', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '2', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '2', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '2', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '2', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '3', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '3', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '3', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '3', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '4', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '4', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '4', 'title' => '戏剧人生,人生戏剧']);
     Album::create(['user_id' => '4', 'title' => '戏剧人生,人生戏剧']);
 }
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:19,代码来源:AlbumsTableSeeder.php

示例8: Album

<?php 
require_once 'config.php';
require_once 'Album.php';
if (isset($_POST['submit'])) {
    $album = new Album($_POST['album_title'], $_POST['date'], $_POST['format']);
    $album->create();
}
?>

<html>
  <head>
    <title>Albums</title>
  </head>
  <body>
    <form method="POST" action="">
      Enter the name of your album:
      <input type="text" name="album_title"></input>
            Enter the release date:
      <input type="date" name="date"></input>
            Enter the album format:
      <input type="text" name="format"></input>
      <input type="submit" name="submit" value="submit"></input>
    </form>

<?php 
if (isset($album)) {
    ?>
    <p>The last album entered was "<?php 
    echo $album->album_title;
    ?>
开发者ID:hathawayhester,项目名称:dig540-1,代码行数:30,代码来源:index.php

示例9: intval

<?php

include 'models.php';
if (isset($_POST['id'])) {
    $a = Album::find($_POST['id']);
    $a->Title = $_POST['title'];
    $a->Artist = intval($_POST['artist']);
    if ($a->save()) {
        header("Location: " . "album.php?id=" . $a->AlbumId);
    }
} else {
    $a = Album::create($_POST['title'], intval($_POST['artist']));
    if ($a->save()) {
        header("Location: " . "album.php?id=" . $a->AlbumId);
    }
}
开发者ID:stealthrob,项目名称:Dangerous_Eagle,代码行数:16,代码来源:guardar_album.php

示例10: isset

<!DOCTYPE html>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript">

</script>
<?php 
include 'models.php';
$album = isset($_GET['id']) ? Album::find($_GET['id']) : Album::create(null, 1);
?>
<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 Album</title>
</head>
<body>
	<div class="container">
		<div class="jumbotron">
			<h1>Nuevo Album</h1>
			<p></p>
		</div>
		<div class="row">
			<div class="col-md-3 col-md-offset-4 col-xs-5 col-xs-offset-2 col-sm-4 col-sm-offset-4 ">
				
<form action="guardar_album.php" method="POST">
<?php 
if (isset($album->AlbumId)) {
    ?>
	<label for="id">Id</label>
	<input type="text"  <?php 
    echo "value='{$album->AlbumId}'";
开发者ID:stealthrob,项目名称:Dangerous_Eagle,代码行数:31,代码来源:album.php


注:本文中的Album::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。