Documentation

Installation

# Creating a LaraPress CMS Project

Before creating your first LaraPress project, make sure that your local machine has PHP and Composer installed.

After you have installed PHP and Composer, you may create a new LaraPress project via Composer's create-project command:

----------------------------------------------------------

↓    composer create-project larapresscms/larapress myproject

-----------------------------------------------------------

Once the project has been created, start LaraPress local development server using:

--------------------

https://localhost/myproject

-------------------

No Need Laravel Artisan's serve command.

Here is the video tutorial:

How to make theme?

== Folder Stucture==

  • -resources/views/front/themes
  • --default /theme name
  • ---layouts/master.blade.php //main master file of headerfooter
  • ---index.blade.php //main home page or blog/post list
  • ---page.blade.php //page
  • ---sidebar.blade.php //sidebar is all widgets
  • ---single.blade.php //details of blog
  • ---slider.blade.php //home page top slider

master.blade.php

 <html>
 <head>
  <link href="{{ asset('front/css/styles.css')}}" rel="stylesheet" />//all site assets is 'public/front' folder
 </head>
 <body>
  //when login user show username
  @auth()
   Profile ({{ optional(auth()->user())->name}})
  @endauth
 //its guest mode
  @guest()
  @endguest

  @yield('content')                                 //main content

 </body>
</html>

index.blade.php

  • @Extends('front.themes.default.layouts.master') // 'default' its a theme name
  • @Section('content')
    • @include('front.themes.default.slider') //if want to enable slider in index page
  • @foreach($posts as $post)
  • {{$post->thumbnail_path}}
  • {{ $post->created_at }}
  • {{ $post->title }}
  • {!! $post->excerpt !!}
  • @endforeach
  • {!! $posts->links() !!} //pagination
  • @include('front.themes.default.sidebar') //sidebar
  • @endsection

page.blade.php

  • @Extends('front.themes.default.layouts.master')
  • @Section('content')
  • {{ $page->title }}
  • {!! $page->content !!}
  • @endsection

single.blade.php

  • @Extends('front.themes.default.layouts.master')
  • @Section('content')
  • {{ $post->title }}
  • {{ $post->thumbnail_path }}
  • {{ $post->created_at }}
  • {!! $post->content !!}
  • @include('front.themes.default.sidebar')
  • @endsection

sidebar.blade.php

sideber widget

slider.blade.php

  • @php $data = 0; @endphp
  • @foreach($sliders as $slider)
  • {{ $data == 0? 'active':''}}
  • {{ $slider->title }}
  • {{ $slider->short_des }}
  • @php $data++ @endphp
  • @endforeach

All Routing

  • {{ url('/dashboard')}} //admin page
  • {{ url('/logout')}}
  • {{ url('/login')}}
  • {{ url('/register')}}
  • {{ url('single/'.$post->id) }} //all details of single page link
  • {{$post->thumbnail_path}} //single page thumbnails
  • {{ $page->thumbnail_path }}

How to make gallery?

@php $values = explode(",",getContentBySlug('aboutus')->gallery_img); @endphp
       @php $count = 1; @endphp
       @foreach($values as $imgid)
                @if($imgid)
                      <div class="card"><img src="{{ asset('public/uploads/') }}/{{$imgid }}" alt="asdf"></div>                            
                 @php $count++; @endphp                                          
       @endif
@endforeach

How to make news page query?

@foreach(getPostsByType(getContentBySlug(collect(request()->segments())->last())->post_type) as $post)
            {{$post->title}} 
@endforeach    
Query from slug by post type.
Live example:
<section class="news-details">
    <div class="container">
        <div class="row">
            <div class="col-xl-8 col-lg-7">
                <div class="news-details__left">
                    <div class="news-details__img">
                        <img src="{!! asset('public/uploads/' . getContentBySlug(collect(request()->segments())->last())->thumbnail_path) ?? '' !!}" alt="">
                        <div class="news-details__date">
                            <p>{{ \Carbon\Carbon::parse(getContentBySlug(collect(request()->segments())->last())->updated_at)->format('d M, Y') }}</p>
                        </div>
                    </div>
                    <div class="news-details__content">
                        <!-- <ul class="list-unstyled news-details__meta">
                            <li><a href="news-details.html"><i class="far fa-user-circle"></i> Admin</a>
                            </li>
                            <li><a href="news-details.html"><i class="fas fa-comments"></i> 2
                                    Comments</a>
                            </li>
                        </ul> -->
                        <h3 class="news-details__title">{!! getContentBySlug(collect(request()->segments())->last())->title ?? '' !!}</h3>
                        <p class="news-details__text-1"><style>{!! getContentBySlug(collect(request()->segments())->last())->content_css ?? '' !!}</style>
        {!! getContentBySlug(collect(request()->segments())->last())->content ?? '' !!}</p>
                    </div>
                    <div class="news-details__bottom">
                        <div class="news-details__social-list">
                            <a href="#"><i class="fab fa-twitter"></i></a>
                            <a href="#"><i class="fab fa-facebook"></i></a>
                            <a href="#"><i class="fab fa-pinterest-p"></i></a>
                            <a href="#"><i class="fab fa-instagram"></i></a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- right -->

            <div class="col-xl-4 col-lg-5">
                <div class="sidebar">

                    <div class="sidebar__single sidebar__post">
                        <div class="sidebar-shape-1" style="background-image: url(assets/images/shapes/sidebar-shape-1.png);"></div>
                        <h3 class="sidebar__title">Latest {{ getContentBySlug(collect(request()->segments())->last())->post_type }}</h3>
                        <ul class="sidebar__post-list list-unstyled">                            
                            @foreach(getPostsByType(getContentBySlug(collect(request()->segments())->last())->post_type) as $post)
                            <li>
                                <div class="sidebar__post-image">
                                    <img src="{!! asset('public/uploads/' . $post->thumbnail_path) ?? '' !!}" alt="">
                                </div>
                                <div class="sidebar__post-content">
                                    <h3>                                        
                                        <a href="news-details.html">{{$post->title}}</a>  
                                    </h3>
                                </div>
                            </li>
                            @endforeach      
                        </ul>
                    </div>

                </div>
            </div>
        </div>
    </div>
</section>