This file contains hidden or 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 | |
| public function test_get_all_books() | |
| { | |
| $book = factory(App\Book::class, 2)->create(); | |
| $this->get('books', ['accept' => 'application/json']); | |
| $this->assertResponseOk(); | |
| $this->seeJsonStructure(['data' => [0, 1]])' | |
| } |
This file contains hidden or 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 | |
| Route::get('books', 'BooksController@index'); | |
| Route::post('books', 'BooksController@store'); | |
| Route::get('books/{book_id}', 'BooksController@show'); | |
| Route::patch('books/{book_id}', 'BooksController@update'); | |
| Route::delete('books/{book_id}', 'BooksController@destroy'); |
This file contains hidden or 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 | |
| \Cache::flush(); |
This file contains hidden or 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
| $variabile = \Cache::pull('nome'); |
This file contains hidden or 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
| \Cache::forget('nome'); |
This file contains hidden or 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 | |
| // app/Http/routes.php | |
| Route::get('/se_non_ci_sono_recupera_per_sempre', function(){ | |
| \Cache::forever('lavoro', function(){ | |
| return 'Web Developer'; // questo potrebbe essere il risultato di una query | |
| }); | |
| }); |
This file contains hidden or 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 | |
| \Cache::forever('nome', 'Francesco'); |
This file contains hidden or 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 | |
| // app/Http/routes.php | |
| Route::get('/esiste_cache', function(){ | |
| if (\Cache::has('lavoro')) | |
| { | |
| return \Cache::get('lavoro'); | |
| } | |
| }); |
This file contains hidden or 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 | |
| // app/Http/routes.php | |
| Route::get('/se_non_ci_sono_recupera', function(){ | |
| $scadenza = \Carbon\Carbon::now()->addMinutes(10); | |
| \Cache::remember('lavoro', $scadenza, function(){ | |
| return 'Web Developer'; // questo potrebbe essere il risultato di una query | |
| }); | |
| }) |
This file contains hidden or 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 | |
| //app/Http/routes.php | |
| if ( \Cache::has('nome')) | |
| { | |
| return \Cache::get('nome'); | |
| } |