本文整理匯總了PHP中app\models\Contact::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Contact::all方法的具體用法?PHP Contact::all怎麽用?PHP Contact::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Contact
的用法示例。
在下文中一共展示了Contact::all方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$validator = Validator::make($data = $request->all(), Contact::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$contact = Contact::all()->first();
$contact = $contact ? $contact : new Contact();
$contact->fill($data);
$contact->save();
return Redirect::route('contact.index');
}
示例2: index
public function index(Contact $contact)
{
$contacts = $contact->all();
return view('contact.index')->with('contacts', $contacts);
}
示例3: index
public function index()
{
$data = ['title' => 'Список контактов', 'view_all' => true, 'contacts' => Contact::all()->toArray()];
//dd($data);
return view('templates.index', $data);
}
示例4: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
// get a list of all contacts
return view('contact.index', ['contacts' => \App\Models\Contact::all()]);
}
示例5:
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>Rendering engine</th>
<th>Browser</th>
<th>Platform(s)</th>
<th>Engine version</th>
<th>CSS grade</th>
</tr>
</thead>
<tbody>
<?php
use App\Models\Contact;
?>
<?php
$contacts = Contact::all();
?>
<tr>
<td><?php
echo $contacts[0]->fullname;
?>
</td>
<td><?php
echo $contacts[0]->address;
?>
</td>
<td><?php
echo $contacts[0]->telephone;
?>
</td>
<td><?php
示例6: contacts
/**
* Returns contacts.blade.php page
* @return type view
*/
public function contacts()
{
$data = ['title' => 'Contacts', 'number' => Contact::find(1)->tel, 'contacts' => Contact::all()];
return view('pages.mainUserPages.contacts')->with($data);
}
示例7: changeContacts
/**
* Returns the page with all changable and deletable contacts
* @return type view | Redirect
*
*/
public function changeContacts()
{
if (Auth::check()) {
$data = ['title' => 'Contacts list', 'contacts' => Contact::all()];
return view('pages.options.changeContacts')->with($data);
} else {
return Redirect::route('admin');
}
}