This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.list{ | |
display: flex; | |
flex-wrap: wrap; | |
} | |
.list-item{ | |
background-color: #eee; | |
display: flex; | |
color: white; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// phones and other small devices | |
@media (min-width: 34em) { … } | |
// tablets and phablets | |
@media (min-width: 48em) { … } | |
// large devices like desktops | |
@media (min-width: 62em) { … } | |
// for the big screened desktops | |
@media (min-width: 75em) { … } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php artisan make:middleware AdMiddleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
class AdMiddleware | |
{ | |
/** | |
* Handle an incoming request. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected $middleware = [ | |
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, | |
\App\Http\Middleware\EncryptCookies::class, | |
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, | |
\Illuminate\Session\Middleware\StartSession::class, | |
\Illuminate\View\Middleware\ShareErrorsFromSession::class, | |
\App\Http\Middleware\VerifyCsrfToken::class, | |
// our new class. | |
\App\http\Middleware\AdMiddleware::class, | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The application's route middleware. | |
* | |
* @var array | |
*/ | |
protected $routeMiddleware = [ | |
'auth' => \App\Http\Middleware\Authenticate::class, | |
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, | |
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!! Form::open(array('route' => 'queries.search’, 'class'=>'form navbar-form navbar-right searchform')) !!} | |
{!! Form::text('search', null, | |
array('required', | |
'class'=>'form-control', | |
'placeholder'=>'Search for a tutorial...')) !!} | |
{!! Form::submit('Search', | |
array('class'=>'btn btn-default')) !!} | |
{!! Form::close() !!} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::resource('queries', 'QueryController'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function search(Request $request) | |
{ | |
// Gets the query string from our form submission | |
$query = Request::input('search'); | |
// Returns an array of articles that have the query string located somewhere within | |
// our articles titles. Paginates them so we can break up lots of search results. | |
$articles = DB::table('articles')->where('title', 'LIKE', '%' . $query . '%')->paginate(10); | |
// returns a view and passes the view the list of articles and the original query. | |
return view('page.search', compact('articles', 'query')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if (count($articles) === 0) | |
... html showing no articles found | |
@elseif (count($articles) >= 1) | |
... print out results | |
@foreach($articles as $article) | |
print article | |
@endforeach | |
@endif |
OlderNewer