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\Controllers; | |
use App\Services\CovidStatisticService; | |
use Carbon\Carbon; | |
class HomeController extends Controller | |
{ |
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\Services; | |
use Carbon\Carbon; | |
class CovidStatisticService | |
{ | |
public function getTotalCasesByCountryAndType($country, $type) | |
{ |
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
import React, {Component} from 'react'; | |
import ReactDOM from 'react-dom'; | |
import Task from './Task'; | |
const totalNumberOfUsers = 25; | |
// for now we'll get the userId randomly until we implement authentication | |
const userId = Math.floor(Math.random() * Math.floor(totalNumberOfUsers)); | |
class Main extends Component { |
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
import React, {Component} from 'react'; | |
const Task = ({task}) => { | |
if (!task) { | |
return ( | |
<div className="single-task-wrapper"> | |
<h4>No task selected.</h4> | |
</div> | |
) | |
} |
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\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use App\Repositories\Tasks; | |
use Illuminate\Http\Request; | |
class TaskController extends Controller |
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\Repositories; | |
class Repository implements RepositoryInterface | |
{ | |
protected $items = []; | |
protected $error = false; | |
public function getItems() |
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\Repositories; | |
use App\Task; | |
use App\Http\Resources\Task as TaskResource; | |
use Illuminate\Support\Facades\Log; | |
class Tasks extends Repository | |
{ |
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\Resources; | |
use Illuminate\Http\Request; | |
use Illuminate\Http\Resources\Json\JsonResource; | |
class Task extends JsonResource | |
{ | |
/** |
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; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Database\Eloquent\Relations\BelongsTo; | |
class Task extends Model | |
{ | |
protected $fillable = ['title', 'description', 'date', 'user_id']; |
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 | |
Route::prefix('users')->group(function () { | |
Route::get('/', 'UserController@index')->name('users'); | |
Route::post('/', 'UserController@store')->name('users.store'); | |
Route::get('/{id}', 'UserController@show')->name('users.store'); | |
Route::put('/{id}', 'UserController@update')->name('users.store'); | |
Route::delete('/{id}', 'UserController@delete')->name('users.delete'); | |
}); |
NewerOlder