Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
Add default layout
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekkarki committed Feb 14, 2019
1 parent 025390d commit adc2067
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/Generators/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ public function generate()

$fullFilePath = $this->getPath("resources/views/" . $this->module->getModuleName()) . "/{$view}.blade.php";
file_put_contents($fullFilePath, $viewTemplate);
$generatedFiles[] = $fullFilePath;
$generatedFiles[] = $fullFilePath;
}

$layoutPath = $this->getPath("resources/views/laragen/layouts/") . "app.blade.php";
if(!file_exists($layoutPath)){

$viewTemplate = $this->buildTemplate('Views/layouts/app', []);
file_put_contents($layoutPath, $viewTemplate);
$generatedFiles[] = $layoutPath;
}

return $generatedFiles;
}
}
2 changes: 1 addition & 1 deletion src/resources/stubs/Views/index.stub
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends('layouts.app')
@extends('laragen.layouts.app')

@section('content')

Expand Down
39 changes: 39 additions & 0 deletions src/resources/stubs/Views/layouts/app.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
@auth
<meta name="api-token" content="{{ auth()->user()->api_token }}">
@endauth

<title>{{ config('app.name', 'Laravel') }}</title>


<!-- Styles -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href="{{ asset('css/style.css') }}" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<div id="app">
<div class="wrap">
<div class="header">
<div class="logo">
<a href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
</div>
</div>
</div>

@yield('content')

</div>

@stack('inline-scripts')
</body>
</html>
2 changes: 1 addition & 1 deletion src/resources/stubs/Views/show.stub
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends('layouts.app')
@extends('laragen.layouts.app')

@section('content')

Expand Down

0 comments on commit adc2067

Please sign in to comment.