Skip to content

edit.blade.php(default)

Tady edited this page Sep 6, 2023 · 2 revisions
<div style="margin: 5px;">
    <h1>Posts</h1>
    <a href="{{-- route('posts.index') --}}{{ url()->previous() }}" 
        style="text-decoration:none;background-color:#5bc0de;color:white;padding:5px 5px;text-align:center;display:inline-block;border-radius:5px;">
        Go Back
    </a>
    <br>
    <form action="{{route('posts.update',  $post->id)}}" method="POST">
        @csrf
        
			<div style="display:flex;flex-wrap:wrap;margin-top:0.5rem;">
				<label style="flex:0 0 auto;width:16.66666667%;">Title :</label>
				<div style="flex:0 0 auto;width:83.33333333%;">
					<input type="text" name="title" style="display:block;width:100%;padding:0.375rem 0.75rem;appearance:none;border:1px solid #dee2e6;border-radius:0.375rem;" value="{{$post->title}}" />
				</div>
			</div>
			<div style="display:flex;flex-wrap:wrap;margin-top:0.5rem;">
				<label style="flex:0 0 auto;width:16.66666667%;">Content :</label>
				<div style="flex:0 0 auto;width:83.33333333%;">
					<textarea name="content" style="display:block;width:100%;padding:0.375rem 0.75rem;appearance:none;border:1px solid #dee2e6;border-radius:0.375rem;">{{$post->content}}</textarea>
				</div>
			</div>
			<div style="display:flex;flex-wrap:wrap;margin-top:0.5rem;">
				<label style="flex:0 0 auto;width:16.66666667%;">Created at :</label>
				<div style="flex:0 0 auto;width:83.33333333%;">
					<input type="datetime-local" name="created_at" style="display:block;width:100%;padding:0.375rem 0.75rem;appearance:none;border:1px solid #dee2e6;border-radius:0.375rem;" value="{{($post->created_at != null)?date('Y-m-d\TH:i:s',strtotime($post->created_at)):''}}" />
				</div>
			</div>
			<div style="display:flex;flex-wrap:wrap;margin-top:0.5rem;">
				<label style="flex:0 0 auto;width:16.66666667%;">Updated at :</label>
				<div style="flex:0 0 auto;width:83.33333333%;">
					<input type="datetime-local" name="updated_at" style="display:block;width:100%;padding:0.375rem 0.75rem;appearance:none;border:1px solid #dee2e6;border-radius:0.375rem;" value="{{($post->updated_at != null)?date('Y-m-d\TH:i:s',strtotime($post->updated_at)):''}}" />
				</div>
			</div>

        @method('PUT')
        <button type="submit" 
            style="background-color:#0275d8;color:white;padding:5px 5px;text-align:center;display:inline-block;border: none;border-radius:5px;">
            Update
        </button>
    </form>
    <br>
</div>
Clone this wiki locally