Recent Topics

Do I have to use the CMS option to add a page ?



  • I want to edit the contact us page but do I have to follow the bagisto documentation or can I do it the traditional laravel way for creating the page and the flow. Because I don't fully I understand if I'm going to edit the page in the CMS option where exactly do I put the code that does the logic.



  • @MattWithCurls
    you can easily update or add content in contact us page by clicking here https://prnt.sc/vfyrb6



  • @Vaishali-Agarwal Thanks bro will let you if I stumble upon any hurdles.



  • For example lets say this is the form

    <h3>Contact Form</h3>
    
    <div class="container">
      <form action="/action_page.php">
        <label for="email">Email</label>
        <input type="text" id="email" name="email" placeholder="Your email..">
        
        <label for="fname">First Name</label>
        <input type="text" id="fname" name="firstname" placeholder="Your name..">
    
        <label for="lname">Last Name</label>
        <input type="text" id="lname" name="lastname" placeholder="Your last name..">
    
        <label for="subject">Subject</label>
        <textarea id="subject" name="subject" placeholder="Write something.." style="height:200px"></textarea>
    
        <input type="submit" value="Submit">
      </form>
    </div>
    

    So I can still create model,controller. But where do i place the route since bagisto is a package.

    @Vaishali-Agarwal



  • @MattWithCurls,

    This depends if you are using Bagisto Standard you can place your routes and controllers stuffs in the default Laravel app.

    If you have taken a clone of the Bagisto repo then you can place your stuff in your package where it is more suitable.

    For e.g., if I am making changes in Velocity theme I will place in Velocity package.



  • Hi @devansh-webkul I'm using the one from the repo.



  • Hi @MattWithCurls,

    If you are good too with the packages then you can place your routes and other stuff in velocity otherwise if you want to keep them separate you can place it in the default Laravel app as well.

    It's your choice.



  • okay thanks @devansh-webkul will do that and get back to you.



  • This post is deleted!


  • @MattWithCurls
    you just need to add this form source code in admin-> CMS-> add page

    once done, then go to the velocity-> meta -> footer middle content, here you need to pass the cms page url key.



  • @Vaishali-Agarwal
    I inserted the contact us source code but when I want to edit it in the CMS option the page is blank.



  • I figured it out 👍. Just deleted the source code from the database.



  • @Vaishali-Agarwal can i insert this type of source in cms for that form.

    <!DOCTYPE html>
    <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Laravel</title>
        <!-- Bootstrap CSS -->
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="{{ asset('css/style.css') }}">
    </head>
    <body>
        <div class="container mt-5">
            <!-- Success message -->
            @if(Session::has('success'))
                <div class="alert alert-success">
                    {{Session::get('success')}}
                </div>
            @endif
            <form action="" method="post" action="{{ route('contact.store') }}">
        @csrf
        <div class="form-group">
            <label>First Name</label>
            <input type="text" class="form-control {{ $errors->has('first_name') ? 'error' : '' }}" name="first_name" id="first_name">
            <!-- Error -->
            @if ($errors->has('first_name'))
            <div class="error">
                {{ $errors->first('first_name') }}
            </div>
            @endif
        </div>
        <div class="form-group">
            <label>Last Name</label>
            <input type="text" class="form-control {{ $errors->has('last_name') ? 'error' : '' }}" name="last_name" id="last_name">
            <!-- Error -->
            @if ($errors->has('last_name'))
            <div class="error">
                {{ $errors->first('last_name') }}
            </div>
            @endif
        </div>
        <div class="form-group">
            <label>Email</label>
            <input type="email" class="form-control {{ $errors->has('email') ? 'error' : '' }}" name="email" id="email">
            @if ($errors->has('email'))
            <div class="error">
                {{ $errors->first('email') }}
            </div>
            @endif
        </div>
        <div class="form-group">
            <label>Phone</label>
            <input type="text" class="form-control {{ $errors->has('phone') ? 'error' : '' }}" name="phone" id="phone">
            @if ($errors->has('phone'))
            <div class="error">
                {{ $errors->first('phone') }}
            </div>
            @endif
        </div>
        <div class="form-group">
            <label>Subject</label>
            <input type="text" class="form-control {{ $errors->has('subject') ? 'error' : '' }}" name="subject"
                id="subject">
            @if ($errors->has('subject'))
            <div class="error">
                {{ $errors->first('subject') }}
            </div>
            @endif
        </div>
        <div class="form-group">
            <label>Message</label>
            <textarea class="form-control {{ $errors->has('message') ? 'error' : '' }}" name="message" id="message"
                rows="4"></textarea>
            @if ($errors->has('message'))
            <div class="error">
                {{ $errors->first('message') }}
            </div>
            @endif
        </div>
        <input type="submit" name="send" value="Submit" class="btn btn-dark btn-block">
    </form>
        </div>
    </body>
    </html>```


  • Hi @MattWithCurls

    Please insert as given below -

      <form action="" method="POST">
            @csrf
    
            <div class="form-container">
                <div class="control-group" :class="[errors.has('location') ? 'has-error' : '']">
                    <label for="location" class="required">Zip Code</label>
    
                    <input type="text" v-validate="'required'" class="control" name="location" />
    
                    <span class="control-error" v-if="errors.has('location')">Above field is required</span>
                </div>
    
                <button type="submit" class="btn btn-lg btn-primary" style="margin-top: 20px;">
                    submit
                </button>
            </div>
    
        </form>
    

    and in admin like this - https://prnt.sc/vxij7d

    Thanks
    Rahul Shukla



  • Thanks @rahul



  • @rahul
    So whats wrong with using the one i posted.


Log in to reply