本文整理汇总了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');
}
}