本文整理汇总了PHP中Message::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::all方法的具体用法?PHP Message::all怎么用?PHP Message::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::all方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: messageList
public function messageList()
{
if (Auth::user()->role == 1) {
$messages = Message::all();
return View::make('backend.user.messagelist')->with('data', $messages);
} elseif (Auth::user()->role == 2) {
$messages = Message::where('recipient_id', '=', Auth::user()->id)->orWhere('mass_message', '=', 1)->get();
return View::make('backend.user.messagelist')->with('data', $messages);
}
}
示例2: createTopic
/**
* createTopics-funktio lähettää Topic-mallille kutsun luoda uusi keskustelu ja Message-mallille lisätä uusi viesti
*/
public static function createTopic()
{
$params = $_POST;
if ($params['title'] != null && $params['content'] != null && !ctype_space($params['title']) && !ctype_space($params['content'])) {
$topic = Topic::createTopic($params['title'], $params['category']);
$message = Message::createMessage($topic->id, $params['content']);
$messages = Message::all($topic->id);
View::make('keskustelu.html', array('topic' => $topic, 'messages' => $messages));
}
$categories = Category::all();
View::make('luokeskustelu.html', array('categories' => $categories, 'error' => "Otsikko tai aloitusviestisi oli tyhjä"));
}
示例3: fetchMessages
/**
* Returns all the messages of a user
* @param int userid
* @return JSON $messages (object)
*/
public function fetchMessages()
{
$inputJson = Input::json();
$input = (array) $inputJson;
//We need to validate the input first
$rules = array('userid' => ['required']);
$errorMessages = array('userid.required' => 'userid can not be empty');
$validator = Validator::make($input, $rules, $errorMessages);
//Exit early if the validator fails
if ($validator->fails()) {
return Response::json(array('success' => false, 'errors' => $validator->getMessageBag()->toArray()), 400);
// 400 being the HTTP code for an invalid request.
}
$messages = Message::all();
return Response::json($messages);
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$messages = Message::all();
return $this->render('messages.index', compact('messages'));
}
示例5: PDO
<?php
spl_autoload_register(function ($class) {
require_once str_replace('\\', '/', $class) . '.php';
});
$file = __DIR__ . '/storage/database.sqlite';
$options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ];
$pdo = new PDO("sqlite:{$file}", null, null, $options);
$pdo->exec("\n CREATE TABLE IF NOT EXISTS\n messages (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n content TEXT,\n published_at DATETIME )\n");
$pdo->exec("\n CREATE TABLE IF NOT EXISTS\n histories (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n published_at DATETIME )\n");
// observers
$db = new Observers\DB($pdo, 'histories');
$splFile = new \SplFileObject(__DIR__ . '/storage/data.txt', 'a+');
$file = new Observers\File($splFile);
// subjects
$message = new Message($pdo);
$message->attach($db);
$message->attach($file);
$message->create('Hello world');
var_dump($message->all());
$stmt = $pdo->query('select * from histories');
var_dump($stmt->fetchAll());
var_dump(file_get_contents(__DIR__ . '/storage/data.txt'));
示例6: getIndex
public function getIndex()
{
return View::make('messages.index')->with('messages', Message::all());
}
示例7: getMessages
public function getMessages()
{
return Message::all(array('conditions' => array('conversation_id' => $this->id), 'order' => 'timestamp asc'));
}
示例8: get
Route::get('/associate/{id}', ['as' => 'associate', 'uses' => 'ApartmentController@associateApartment']);
Route::patch('/set-default/{id}', ['as' => 'set-default', 'uses' => 'ApartmentController@setDefaultApartment']);
Route::post('/apartment-userinfo', ['as' => 'post-apartment-userinfo', 'uses' => 'ApartmentController@storeApartmentUserInfo']);
Route::resource('members', 'AdduserController');
Route::resource('polls', 'PollingController');
Route::post('/voteup', ['as' => 'voteup', 'uses' => 'PollingController@voteUp']);
Route::post('/votedown', ['as' => 'votedown', 'uses' => 'PollingController@voteDown']);
Route::get('/accept/{id}', ['as' => 'accept', 'uses' => 'AdminController@acceptAddRequest']);
Route::get('/reject/{id}', ['as' => 'reject', 'uses' => 'AdminController@rejectAddRequest']);
Route::patch('/setflatfloor/{id}', ['as' => 'setflatfloor', 'uses' => 'AdminController@update']);
Route::resource('bank', 'BankController');
Route::get('/linkBank/{id}', ['as' => 'linkBank', 'uses' => 'BankController@linkBank']);
Route::get('/searchbank', ['as' => 'searchbank', 'uses' => 'BankController@searchbank']);
// API
get('api/messages', function () {
return Message::all();
});
post('api/messages', function () {
return Message::create(Request::all());
});
#Image Uploader
#Route::get('/complaint', ['as' => 'complaint', 'uses' => 'ImageController@getUpload']);
Route::resource('complaints', 'ComplaintController');
Route::post('complaint', ['as' => 'complaint-post', 'uses' => 'ImageController@postUpload']);
Route::post('complaint/delete', ['as' => 'complaint-remove', 'uses' => 'ImageController@deleteUpload']);
Route::resource('classifieds', 'ClassifiedController');
Route::get('/timeline', ['as' => 'timeline', 'uses' => 'ComplaintController@getTimeline']);
#External Routes
Route::resource('visitors', 'VisitorController');
#Accounting Controllers
Route::resource('crm', 'CrmController');
示例9: getModerer
public function getModerer()
{
// Are we logged in?
//
if (Auth::check()) {
return View::make('/moderer')->with('messages', Message::all());
}
return View::make('/');
}