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


PHP Album::find方法代码示例

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


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

示例1: showAlbum

 public function showAlbum($id)
 {
     $album = Album::find($id);
     //Album::find(array(1, 3));
     //Album::first();
     return $album;
 }
开发者ID:nattaphat,项目名称:cuse2,代码行数:7,代码来源:AlbumController.php

示例2: eventBeforeDelete

 public function eventBeforeDelete($event)
 {
     $items = Album::find()->where(['cat_id' => $this->id])->all();
     if (count($items) > 0) {
         $this->addError('Diese Kategorie wird noch von einem oder mehreren Alben benutzt und kann nicht gelöscht werden.');
         $event->isValid = false;
         return;
     }
     $event->isValid = true;
 }
开发者ID:gitter-badger,项目名称:luya,代码行数:10,代码来源:Cat.php

示例3: __construct

 /**
  * These methods are handled by the BaseUploadHandler
  * 
  * public function Start();
  * public function get_response();
  * public function get_headers();
  * public function set_option(string $key, string $value);
  */
 function __construct($options, $arguments = null)
 {
     $folder = $arguments;
     if (!$folder instanceof \Album and (!is_numeric($arguments) or !($folder = \Album::find($arguments)))) {
         throw new \Exception("DatabaseUploadHandler needs the Album id or the Album model to start!");
     }
     $this->folder = $folder;
     $options['upload_dir'] = $folder->upload_dir;
     $options['upload_url'] = $folder->upload_url;
     parent::__construct($options);
 }
开发者ID:ajayvaineela,项目名称:laravel-juploader,代码行数:19,代码来源:DatabaseUploadHandler.php

示例4: postAlbumComment

 public function postAlbumComment($id)
 {
     $album = Album::find($id);
     if ($album === null) {
         $error = 'Can not post comment. No such album found.';
         return View::make('errors.error', array('errorMsg' => $error));
     }
     $input = Input::all();
     $comment = new Comment(['content' => $input['content'], 'author_id' => Auth::user()->id, 'album_id' => $id]);
     $comment->save();
     return Redirect::to('/albums/' . $id);
 }
开发者ID:renankabal,项目名称:image-manager-system,代码行数:12,代码来源:CommentsController.php

示例5: delete

 public function delete($id)
 {
     $album = Album::find($id);
     if ($album === null) {
         $error = 'Invalid album.';
         return View::make('errors.error', array('errorMsg' => $error));
     }
     if ($album->owner_id !== Auth::user()->id) {
         $error = 'You don\'t have permission to delete this album. You are not it\'s owner.';
         return View::make('errors.error', array('errorMsg' => $error));
     }
     //delete all photos
     Photo::where('album_id', '=', $album->id)->delete();
     //delete album
     $album->delete();
     return Redirect::to('/albums/own');
 }
开发者ID:renankabal,项目名称:image-manager-system,代码行数:17,代码来源:AlbumsController.php

示例6: vote

 public function vote($id)
 {
     $album = Album::find($id);
     if ($album === null) {
         $error = 'Can not vote. No such album found.';
         return View::make('errors.error', array('errorMsg' => $error));
     }
     $input = Input::all();
     if (1 > $input['vote'] || $input['vote'] > 10) {
         $error = 'Invalid vote. Must be between 1 and 10.';
         return View::make('errors.error', array('errorMsg' => $error));
     }
     $vote = new Vote(['value' => $input['vote'], 'album_id' => $album->id, 'voter_id' => Auth::user()->id]);
     $album->rank = $album->rank + $vote->value;
     $album->save();
     $vote->save();
     return Redirect::to('/albums/' . $album->id);
 }
开发者ID:renankabal,项目名称:image-manager-system,代码行数:18,代码来源:VotesController.php

示例7: save

 public static function save($data, $id = null)
 {
     if ($id == null) {
         $album = new Album();
         $album->category_id = $data['category_id'];
         $album->user_id = Session::get('current_user');
         $album->public = $data['public'];
         $album->title = $data['title'];
         $album->description = $data['description'];
         $album->is_single = $data['is_single'];
         $album->post_id = $data['post_id'];
         $album->count_like = 0;
     } else {
         $album = Album::find($id);
         $album->title = $data['title'];
         $album->description = isset($data['description']) ? $data['description'] : "";
         $album->category_id = $data['category_id'];
     }
     if ($album->save()) {
         return $album;
     }
 }
开发者ID:huuson94,项目名称:btlwebapp,代码行数:22,代码来源:AlbumsHelper.php

示例8: picture

 public function picture()
 {
     $album_id = Input::get('album_id');
     $album = Album::find($album_id);
     if ($album == null) {
         return Response::json(array('errCode' => 1, 'message' => '此相册不存在!', 'pictures' => ''));
     }
     $pictures = $album->hasManyPictures()->get();
     if (count($pictures) != 0) {
         return Response::json(array('errCode' => 0, 'message' => '返回相片', 'pictures' => $pictures));
     }
     return Response::json(array('errCode' => 1, 'message' => '该相册没有图片', 'pictures' => ''));
 }
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:13,代码来源:UserPageController.php

示例9: detail_gallery

 public function detail_gallery($id)
 {
     $album = Album::find($id);
     $detail = DB::table('detail_album')->where('id_album', '=', $id)->get();
     return View::make('web.detailalbum')->with('album', $album)->with('detail', $detail);
 }
开发者ID:jamalapriadi,项目名称:sia,代码行数:6,代码来源:WebController.php

示例10: getGallery

 /**
  * Get model gallery
  * @param Model $Model
  * @return mixed
  */
 public function getGallery(Model $Model)
 {
     $Album = new Album();
     return $Album->find('first', array('conditions' => array('model' => $Model->alias, 'model_id' => $Model->id)));
 }
开发者ID:AntonKost,项目名称:cakegallery,代码行数:10,代码来源:GalleryBehavior.php

示例11: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $album = Album::find($id);
     if (empty($album)) {
         return App::abort('404');
     }
     if (!$album->deleteAlbum()) {
         Session::flash('flash_error', trans('message.album.error.delete_failed'));
     } else {
         Session::flash('flash_success', trans('message.album.success.delete_ok'));
     }
     return Redirect::route('secured.album.index');
 }
开发者ID:hungdo89,项目名称:file-manager,代码行数:19,代码来源:AlbumController.php

示例12: getThumburlAttribute

 public function getThumburlAttribute()
 {
     $album = Album::find($this->album_id);
     return Config::get('filegallery.imagesfolder') . '/' . $album->folder . '/thumbs/' . $this->image;
 }
开发者ID:abhishekchaudhary996,项目名称:auto-generating-gallery,代码行数:5,代码来源:Image.php

示例13: saveSong

 public function saveSong($id)
 {
     $validator = Validator::make(Input::all(), array('song_title' => 'required', 'video_code' => 'required'));
     if ($validator->fails()) {
         return Redirect::route('edit-albums')->withInput()->withErrors($validator)->with('song_modal', '#song_modal')->with('album-id', $id);
     } else {
         $album = Album::find($id);
         if ($album == null) {
             return Redirect::route('edit-albums')->with('fail', "That album doesn't exist.");
         }
         $song = new Song();
         $song->title = Input::get('song_title');
         $song->video = Input::get('video_code');
         $song->album_id = $id;
         if ($song->save()) {
             return Redirect::route('edit-albums')->with('success', 'The song was added.');
         } else {
             return Redirect::route('edit-albums')->with('fail', 'An error occured while saving the new song.');
         }
     }
 }
开发者ID:kylehagler,项目名称:CHP,代码行数:21,代码来源:AlbumsController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $album = Album::find($id);
     $album->getEntry()->delete();
     foreach ($album->images as $image) {
         $image->delete();
     }
     $album->delete();
     Session::flash('status', true);
     Session::flash('messages', array('Đã xóa ảnh'));
     return Redirect::route('admin.album.index');
 }
开发者ID:huuson94,项目名称:btlwebapp,代码行数:19,代码来源:BEAlbumController.php

示例15: 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


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